int main(void) {
  printf("%d\n", SubReg(100, 10));
  printf("%d\n", Sub(100, 10));
  int a = 100, b = 10, sub;
  __asm__ __volatile__("subl %%ebx, %%eax" : "=a"(sub) : "b"(b), "a"(a));
  printf("%d\n", sub);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x18,%rsp
movl   $0x0,-0xc(%rbp)
mov    $0x64,%edi
mov    $0xa,%esi
mov    $0x0,%al
call   1040 <SubReg@plt>
mov    %eax,%esi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x64,%edi
mov    $0xa,%esi
mov    $0x0,%al
call   1050 <Sub@plt>
mov    %eax,%esi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x64,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
mov    -0x14(%rbp),%ebx
mov    -0x10(%rbp),%eax
sub    %ebx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe5b(%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   %r14
push   %rbx
push   %rax
mov    $0x64,%edi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <SubReg@plt>
lea    0xeb4(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x64,%edi
mov    $0xa,%esi
xor    %eax,%eax
call   1050 <Sub@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xa,%ebx
mov    $0x64,%eax
sub    %ebx,%eax
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i32, i32, ...) bitcast (i32 (...)* @SubReg to i32 (i32, i32, ...)*)(i32 100, i32 10)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 (i32, i32, ...) bitcast (i32 (...)* @Sub to i32 (i32, i32, ...)*)(i32 100, i32 10)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
store i32 100, i32* %2
store i32 10, i32* %3
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = call i32 asm sideeffect "subl %ebx, %eax", "={ax},{bx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 %9, i32 %10)
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @SubReg to i32 (i32, i32, ...)*)(i32 100, i32 10)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @Sub to i32 (i32, i32, ...)*)(i32 100, i32 10)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 asm sideeffect "subl %ebx, %eax", "={ax},{bx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 10, i32 100)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}