int main() {
  if (bar(22) != 24 || bar(20) != 128)
    abort();
  register long r10 __asm__("r10") = 0xdeadbeefdeadbeefUL;
  asm volatile("" : "+r"(r10));
  if (baz(0, 0, 0, 0, 0, 0, 22) != 24 || baz(0, 0, 0, 0, 0, 0, 20) != 128)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x16,%edi
mov    $0x0,%al
call   1050 <bar@plt>
cmp    $0x18,%eax
jne    116b <main+0x3b>
mov    $0x14,%edi
mov    $0x0,%al
call   1050 <bar@plt>
cmp    $0x80,%eax
je     1170 <main+0x40>
call   1030 <abort@plt>
movabs $0xdeadbeefdeadbeef,%rax
be ad de
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%r10
mov    %r10,-0x10(%rbp)
xor    %r9d,%r9d
mov    %r9d,%edi
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x16,(%rsp)
mov    $0x0,%al
call   1040 <baz@plt>
cmp    $0x18,%eax
jne    11da <main+0xaa>
xor    %r9d,%r9d
mov    %r9d,%edi
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x14,(%rsp)
mov    $0x0,%al
call   1040 <baz@plt>
cmp    $0x80,%eax
je     11df <main+0xaf>
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x16,%edi
xor    %eax,%eax
call   1050 <bar@plt>
cmp    $0x18,%eax
jne    11a7 <main+0x77>
mov    $0x14,%edi
xor    %eax,%eax
call   1050 <bar@plt>
cmp    $0x80,%eax
jne    11a7 <main+0x77>
movabs $0xdeadbeefdeadbeef,%r10
be ad de
movl   $0x16,(%rsp)
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
xor    %eax,%eax
call   1040 <baz@plt>
cmp    $0x18,%eax
jne    11a7 <main+0x77>
movl   $0x14,(%rsp)
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
xor    %eax,%eax
call   1040 <baz@plt>
cmp    $0x80,%eax
jne    11a7 <main+0x77>
xor    %eax,%eax
pop    %rcx
ret
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
%3 = call i32 (i32, ...) bitcast (i32 (...)* @bar to i32 (i32, ...)*)(i32 22)
%4 = icmp ne i32 %3, 24
br i1 %4, label %8, label %5
5: ; preds = %0
%6 = call i32 (i32, ...) bitcast (i32 (...)* @bar to i32 (i32, ...)*)(i32 20)
%7 = icmp ne i32 %6, 128
br i1 %7, label %8, label %9
8: ; preds = %5, %0
unreachable
9: ; preds = %5
store i64 -2401053088876216593, i64* %2
%10 = load i64, i64* %2
%11 = call i64 asm sideeffect "", "={r10},{r10},~{dirflag},~{fpsr},~{flags}"(i64 %10)
store i64 %11, i64* %2
%12 = call i32 (i32, i32, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @baz to i32 (i32, i32, i32, i32, i32, i32, i32, ...)*)(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 22)
%13 = icmp ne i32 %12, 24
br i1 %13, label %17, label %14
14: ; preds = %9
%15 = call i32 (i32, i32, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @baz to i32 (i32, i32, i32, i32, i32, i32, i32, ...)*)(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 20)
%16 = icmp ne i32 %15, 128
br i1 %16, label %17, label %18
17: ; preds = %14, %9
unreachable
18: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (i32, ...) bitcast (i32 (...)* @bar to i32 (i32, ...)*)(i32 22)
%2 = icmp eq i32 %1, 24
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @bar to i32 (i32, ...)*)(i32 20)
%5 = icmp eq i32 %4, 128
br i1 %5, label %7, label %6
6: ; preds = %3, %0
tail call void @abort()
unreachable
7: ; preds = %3
%8 = tail call i64 asm sideeffect "", "={r10},{r10},~{dirflag},~{fpsr},~{flags}"(i64 -2401053088876216593)
%9 = tail call i32 (i32, i32, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @baz to i32 (i32, i32, i32, i32, i32, i32, i32, ...)*)(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 22)
%10 = icmp eq i32 %9, 24
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = tail call i32 (i32, i32, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @baz to i32 (i32, i32, i32, i32, i32, i32, i32, ...)*)(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 20)
%13 = icmp eq i32 %12, 128
br i1 %13, label %15, label %14
14: ; preds = %11, %7
tail call void @abort()
unreachable
15: ; preds = %11
ret i32 0
}