int main(void) {
  int a, b;
  int c, d;
  a = 4;
  b = 7;
  c = d = 0;
  printf("a # %d  b # %d  c # %d  d = %d\n", a, b, c, d);
  __asm__("movl %2, %%eax;"
          "movl %3, %%ebx;"
          "subl $1, %%ebx;"
          "movl %%eax, %0;"
          "movl %%ebx, %1;"
          : "=r"(c), "=r"(d)
          : "r"(a), "r"(b)
          : "%eax", "%ebx");
  printf("a # %d  b # %d  c # %d  d = %d\n", a, b, c, d);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x18,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0x4,-0x10(%rbp)
movl   $0x7,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%edx
mov    %ecx,%eax
mov    %edx,%ebx
sub    $0x1,%ebx
mov    %eax,%ecx
mov    %ebx,%edx
mov    %edx,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %ecx,-0x18(%rbp)
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xee2(%rip),%r14
mov    $0x4,%r15d
mov    $0x7,%ebp
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0x7,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15d,%eax
mov    %ebp,%ebx
sub    $0x1,%ebx
mov    %eax,%ecx
mov    %ebx,%r8d
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0x7,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"a # %d b # %d c # %d d = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 4, i32* %2
store i32 7, i32* %3
store i32 0, i32* %5
store i32 0, i32* %4
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7, i32 %8, i32 %9)
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = call { i32, i32 } asm "movl $2, %eax;movl $3, %ebx;subl $$1, %ebx;movl %eax, $0;movl %ebx, $1;", "=r,=r,r,r,~{eax},~{ebx},~{dirflag},~{fpsr},~{flags}"(i32 %11, i32 %12)
%14 = extractvalue { i32, i32 } %13, 0
%15 = extractvalue { i32, i32 } %13, 1
store i32 %14, i32* %4
store i32 %15, i32* %5
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %17, i32 %18, i32 %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"a # %d b # %d c # %d d = %d\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 4, i32 7, i32 0, i32 0)
%2 = tail call { i32, i32 } asm "movl $2, %eax;movl $3, %ebx;subl $$1, %ebx;movl %eax, $0;movl %ebx, $1;", "=r,=r,r,r,~{eax},~{ebx},~{dirflag},~{fpsr},~{flags}"(i32 4, i32 7)
%3 = extractvalue { i32, i32 } %2, 0
%4 = extractvalue { i32, i32 } %2, 1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 4, i32 7, i32 %3, i32 %4)
ret i32 0
}