title: too many memory references for `mov' when calling a golang function with C by using inline assembly
body: <p>I'm trying to call a golang function from my C code. Golang does not use the standard x86_64 calling convention, so I have to resort to implementing the transition myself. As gcc does not want to mix cdecl with the x86_64 convention,
  I'm trying to call the function using inline assembly:</p>
  
  <pre><code>void go_func(struct go_String filename, void* key, int error){
      void* f_address = (void*)SAVEECDSA;
      asm volatile("  sub     rsp, 0xe0;           \t\n\
                      mov     [rsp+0xe0], rbp;   \t\n\
                      mov     [rsp], %0;            \t\n\
                      mov     [rsp+0x8], %1;       \t\n\
                      mov    [rsp+0x18], %2;       \t\n\
                      call    %3;                     \t\n\
                      mov     rbp, [rsp+0xe0];   \t\n\
                      add     rsp, 0xe0;"          
                      :
                      : "g"(filename.str), "g"(filename.len), "g"(key), "g"(f_address)
                      : );
      return;
  }
  </code></pre>
  
  <p>Sadly the compiler always throws an error at me that I dont understand:</p>
  
  <pre><code>./code.c:241: Error: too many memory references for `mov'
  </code></pre>
  
  <p>This corresponds to this line: <code>mov     [rsp+0x18], %2;       \t\n\</code> If I delete it, the compilation works. I don't understand what my mistake is...</p>
  
  <p>I'm compiling with the -masm=intel flag so I use Intel syntax. Can someone please help me?</p>