#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int add(int, int);
int add_smart(int, int);
int test_add() {
  return 10 == add(7, 3) && 10 == add_smart(7, 3) && 20 == add(10, 10) &&
         20 == add_smart(10, 10) && 1000 == add(123, 877) &&
         1000 == add_smart(123, 877);
}


x86 assembly (clang, -O0):
<test_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x7,%edi
mov    $0x3,%esi
call   1030 <add@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0xa,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    11ef <test_add+0xcf>
mov    $0x7,%edi
mov    $0x3,%esi
call   1040 <add_smart@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0xa,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    11ef <test_add+0xcf>
mov    $0xa,%esi
mov    %esi,%edi
call   1030 <add@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x14,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    11ef <test_add+0xcf>
mov    $0xa,%esi
mov    %esi,%edi
call   1040 <add_smart@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x14,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    11ef <test_add+0xcf>
mov    $0x7b,%edi
mov    $0x36d,%esi
call   1030 <add@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x3e8,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    11ef <test_add+0xcf>
mov    $0x7b,%edi
mov    $0x36d,%esi
call   1040 <add_smart@plt>
mov    %eax,%ecx
mov    $0x3e8,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_add>:
push   %rbx
mov    $0x7,%edi
mov    $0x3,%esi
call   1030 <add@plt>
xor    %ebx,%ebx
cmp    $0xa,%eax
jne    11a2 <test_add+0x82>
mov    $0x7,%edi
mov    $0x3,%esi
call   1040 <add_smart@plt>
cmp    $0xa,%eax
jne    11a2 <test_add+0x82>
mov    $0xa,%edi
mov    $0xa,%esi
call   1030 <add@plt>
cmp    $0x14,%eax
jne    11a2 <test_add+0x82>
mov    $0xa,%edi
mov    $0xa,%esi
call   1040 <add_smart@plt>
cmp    $0x14,%eax
jne    11a2 <test_add+0x82>
mov    $0x7b,%edi
mov    $0x36d,%esi
call   1030 <add@plt>
cmp    $0x3e8,%eax
jne    11a2 <test_add+0x82>
mov    $0x7b,%edi
mov    $0x36d,%esi
call   1040 <add_smart@plt>
xor    %ebx,%ebx
cmp    $0x3e8,%eax
sete   %bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @test_add() {
%1 = call i32 @add(i32 7, i32 3)
%2 = icmp eq i32 10, %1
br i1 %2, label %3, label %18
3: ; preds = %0
%4 = call i32 @add_smart(i32 7, i32 3)
%5 = icmp eq i32 10, %4
br i1 %5, label %6, label %18
6: ; preds = %3
%7 = call i32 @add(i32 10, i32 10)
%8 = icmp eq i32 20, %7
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = call i32 @add_smart(i32 10, i32 10)
%11 = icmp eq i32 20, %10
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = call i32 @add(i32 123, i32 877)
%14 = icmp eq i32 1000, %13
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = call i32 @add_smart(i32 123, i32 877)
%17 = icmp eq i32 1000, %16
br label %18
18: ; preds = %15, %12, %9, %6, %3, %0
%19 = phi i1 [ false, %12 ], [ false, %9 ], [ false, %6 ], [ false, %3 ], [ false, %0 ], [ %17, %15 ]
%20 = zext i1 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
define i32 @test_add() {
%1 = tail call i32 @add(i32 7, i32 3)
%2 = icmp eq i32 %1, 10
br i1 %2, label %3, label %19
3: ; preds = %0
%4 = tail call i32 @add_smart(i32 7, i32 3)
%5 = icmp eq i32 %4, 10
br i1 %5, label %6, label %19
6: ; preds = %3
%7 = tail call i32 @add(i32 10, i32 10)
%8 = icmp eq i32 %7, 20
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = tail call i32 @add_smart(i32 10, i32 10)
%11 = icmp eq i32 %10, 20
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = tail call i32 @add(i32 123, i32 877)
%14 = icmp eq i32 %13, 1000
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = tail call i32 @add_smart(i32 123, i32 877)
%17 = icmp eq i32 %16, 1000
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %15, %12, %9, %6, %3, %0
%20 = phi i32 [ 0, %12 ], [ 0, %9 ], [ 0, %6 ], [ 0, %3 ], [ 0, %0 ], [ %18, %15 ]
ret i32 %20
}