xunge/DecIR huggingface dataset:
int larger(int x, int y) { return x > y; }


x86 assembly (clang, -O0):
<larger>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<larger>:
xor    %eax,%eax
cmp    %esi,%edi
setg   %al
ret

LLVM IR (-O0):
define i32 @larger(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sgt i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @larger(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void foo(int p) {
  static int q = 0;
  if (q == 0)
    q = p;
  else if (q != p)
    abort();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,0x2f0a(%rip)
jne    1136 <foo+0x26>
mov    -0x4(%rbp),%eax
mov    %eax,0x2efb(%rip)
jmp    1151 <foo+0x41>
mov    0x2ef0(%rip),%eax
cmp    -0x4(%rbp),%eax
je     114c <foo+0x3c>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1151 <foo+0x41>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
mov    0x2f15(%rip),%eax
test   %eax,%eax
je     1121 <foo+0x11>
cmp    %edi,%eax
jne    1129 <foo+0x19>
pop    %rax
ret
mov    %edi,0x2f05(%rip)
pop    %rax
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@foo.q = internal global i32 0
define void @foo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @foo.q
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load i32, i32* %2
store i32 %6, i32* @foo.q
br label %14
7: ; preds = %1
%8 = load i32, i32* @foo.q
%9 = load i32, i32* %2
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %7
br label %14
14: ; preds = %13, %5
ret void
}

LLVM IR (-O2):
@foo.q = internal unnamed_addr global i32 0
define void @foo(i32 %0) {
%2 = load i32, i32* @foo.q
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %1
store i32 %0, i32* @foo.q
br label %9
5: ; preds = %1
%6 = icmp eq i32 %2, %0
br i1 %6, label %9, label %7
7: ; preds = %5
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %5, %4
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t SET_b_r(uint8_t const val, uint8_t const bit) {
  return val | (0x1 << bit);
}


x86 assembly (clang, -O0):
<SET_b_r>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SET_b_r>:
mov    %edi,%eax
bts    %esi,%eax
ret

LLVM IR (-O0):
define i32 @SET_b_r(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = shl i32 1, %6
%8 = or i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @SET_b_r(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = or i32 %3, %0
ret i32 %4
}
unsigned xrop3_201_0_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = T | D;
  stk1 = S ^ stk2;
  stk1 = ~stk1;
  return (stk1 & S) | (stk1 & (~T)) | (T & (~S) & D);
}


x86 assembly (clang, -O0):
<xrop3_201_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
and    -0x8(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_201_0_1>:
mov    %edi,%ecx
shl    $0x8,%ecx
or     %edi,%ecx
mov    %esi,%eax
shl    $0x8,%eax
lea    (%rax,%rsi,1),%edx
or     $0xff,%eax
mov    %eax,%edi
xor    %ecx,%edi
or     %edx,%edi
not    %edi
xor    %esi,%eax
and    %ecx,%eax
xor    %esi,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_201_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = or i32 %12, %14
store i32 %15, i32* %6
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = load i32, i32* %5
%24 = or i32 %22, %23
store i32 %24, i32* %9
%25 = load i32, i32* %6
%26 = load i32, i32* %9
%27 = xor i32 %25, %26
store i32 %27, i32* %8
%28 = load i32, i32* %8
%29 = xor i32 %28, -1
store i32 %29, i32* %8
%30 = load i32, i32* %8
%31 = load i32, i32* %6
%32 = and i32 %30, %31
%33 = load i32, i32* %8
%34 = load i32, i32* %7
%35 = xor i32 %34, -1
%36 = and i32 %33, %35
%37 = or i32 %32, %36
%38 = load i32, i32* %7
%39 = load i32, i32* %6
%40 = xor i32 %39, -1
%41 = and i32 %38, %40
%42 = load i32, i32* %5
%43 = and i32 %41, %42
%44 = or i32 %37, %43
ret i32 %44
}

LLVM IR (-O2):
define i32 @xrop3_201_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = shl nuw nsw i32 %5, 8
%7 = or i32 %6, %5
%8 = or i32 %6, 255
%9 = xor i32 %8, %4
%10 = and i32 %8, %4
%11 = or i32 %7, %9
%12 = xor i32 %11, -1
%13 = xor i32 %4, -1
%14 = and i32 %13, %5
%15 = or i32 %10, %14
%16 = or i32 %15, %12
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ i2cWrite(int, int);
void PAC9685SetPeriod() { i2cWrite(0xFE, 0x79); }


x86 assembly (clang, -O0):
<PAC9685SetPeriod>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfe,%edi
mov    $0x79,%esi
call   1030 <i2cWrite@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<PAC9685SetPeriod>:
mov    $0xfe,%edi
mov    $0x79,%esi
jmp    1030 <i2cWrite@plt>

LLVM IR (-O0):
define void @PAC9685SetPeriod() {
%1 = call i32 @i2cWrite(i32 254, i32 121)
ret void
}

LLVM IR (-O2):
define void @PAC9685SetPeriod() {
%1 = tail call i32 @i2cWrite(i32 254, i32 121)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PMU_EVENT_DriverIRQHandler();
__attribute__((weak)) void PMU_EVENT_IRQHandler(void) {
  PMU_EVENT_DriverIRQHandler();
}


x86 assembly (clang, -O0):
<PMU_EVENT_IRQHandler>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <PMU_EVENT_DriverIRQHandler@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<PMU_EVENT_IRQHandler>:
xor    %eax,%eax
jmp    1030 <PMU_EVENT_DriverIRQHandler@plt>

LLVM IR (-O0):
define weak void @PMU_EVENT_IRQHandler() {
%1 = call i32 (...) @PMU_EVENT_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @PMU_EVENT_IRQHandler() {
%1 = tail call i32 (...) @PMU_EVENT_DriverIRQHandler()
ret void
}
/* Variables and functions */
double RAND_MAX;
double ran1() {
  int rand();
  return (rand() / (RAND_MAX + 1.0));
}


x86 assembly (clang, -O0):
<ran1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2sd %eax,%xmm0
movsd  0xed9(%rip),%xmm1
mov    0x2eba(%rip),%rax
addsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ran1>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2sd %eax,%xmm0
mov    0x2ec5(%rip),%rax
movsd  (%rax),%xmm1
addsd  0xed1(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define double @ran1() {
%1 = call i32 (...) @rand()
%2 = sitofp i32 %1 to double
%3 = load double, double* @RAND_MAX
%4 = fadd double %3, 1.000000e+00
%5 = fdiv double %2, %4
ret double %5
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define double @ran1() {
%1 = tail call i32 (...) @rand()
%2 = sitofp i32 %1 to double
%3 = load double, double* @RAND_MAX
%4 = fadd double %3, 1.000000e+00
%5 = fdiv double %2, %4
ret double %5
}
/* Type definitions */
typedef int /*<<< orphan*/ value;

/* Variables and functions */
int setxattr(char *, char *, char *, int, int /*<<< orphan*/);
int main(void) {
  char value[] = "valuestring";
  return setxattr("/some/path/to/somewhere", "name", value, sizeof(value), 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed8(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x10(%rbp),%rdx
lea    0xece(%rip),%rdi
lea    0xedf(%rip),%rsi
mov    $0xc,%ecx
xor    %r8d,%r8d
call   1030 <setxattr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movabs $0x72747365756c6176,%rax
73 74 72
mov    %rax,0x8(%rsp)
movl   $0x676e69,0x10(%rsp)
lea    0xeda(%rip),%rdi
lea    0xeeb(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    $0xc,%ecx
xor    %r8d,%r8d
call   1030 <setxattr@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.value = [12 x i8] c"valuestring\00"
@.str = [24 x i8] c"/some/path/to/somewhere\00"
@.str.1 = [5 x i8] c"name\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [12 x i8]
store i32 0, i32* %1
%3 = bitcast [12 x i8]* %2 to i8*
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%5 = call i32 @setxattr(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 12, i32 0)
ret i32 %5
}

LLVM IR (-O2):
@__const.main.value = [12 x i8] c"valuestring\00"
@.str = [24 x i8] c"/some/path/to/somewhere\00"
@.str.1 = [5 x i8] c"name\00"
define i32 @main() {
%1 = alloca [12 x i8]
%2 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%3 = call i32 @setxattr(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 12, i32 0)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ val;
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ TCP_NODELAY;
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int32_t SetSocketNoDelay(int32_t sock) {
  int32_t val = 1;
  if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val)) < 0)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<SetSocketNoDelay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2eb4(%rip),%rax
mov    (%rax),%esi
mov    0x2eb3(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0x0,%rax
jge    115c <SetSocketNoDelay+0x4c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1163 <SetSocketNoDelay+0x53>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetSocketNoDelay>:
push   %rax
movl   $0x1,0x4(%rsp)
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
mov    0x2ebf(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
sar    $0x3f,%rax
pop    %rcx
ret

LLVM IR (-O0):
@IPPROTO_TCP = global i32 0
@TCP_NODELAY = global i32 0
define i32 @SetSocketNoDelay(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* @IPPROTO_TCP
%7 = load i32, i32* @TCP_NODELAY
%8 = call i64 @setsockopt(i32 %5, i32 %6, i32 %7, i32* %4, i32 4)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 -1, i32* %2
br label %12
11: ; preds = %1
store i32 0, i32* %2
br label %12
12: ; preds = %11, %10
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@IPPROTO_TCP = global i32 0
@TCP_NODELAY = global i32 0
define i32 @SetSocketNoDelay(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%4 = load i32, i32* @IPPROTO_TCP
%5 = load i32, i32* @TCP_NODELAY
%6 = call i64 @setsockopt(i32 %0, i32 %4, i32 %5, i32* %2, i32 4)
%7 = ashr i64 %6, 63
%8 = trunc i64 %7 to i32
ret i32 %8
}
int isX12(const int source) {
  switch (source) {
  case 13:
  case 42:
  case 62:
  case 32:
    return 1;
  }
  if ((source >= '0') && (source <= '9')) {
    return 1;
  }
  if ((source >= 'A') && (source <= 'Z')) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<isX12>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0xd,%eax
je     114e <isX12+0x4e>
jmp    111b <isX12+0x1b>
mov    -0xc(%rbp),%eax
sub    $0x20,%eax
je     114e <isX12+0x4e>
jmp    112c <isX12+0x2c>
mov    -0xc(%rbp),%eax
sub    $0x2a,%eax
je     114e <isX12+0x4e>
jmp    113d <isX12+0x3d>
mov    -0xc(%rbp),%eax
sub    $0x3e,%eax
jne    115a <isX12+0x5a>
jmp    114e <isX12+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    11a1 <isX12+0xa1>
cmpl   $0x30,-0x8(%rbp)
jl     117a <isX12+0x7a>
cmpl   $0x39,-0x8(%rbp)
jg     117a <isX12+0x7a>
movl   $0x1,-0x4(%rbp)
jmp    11a1 <isX12+0xa1>
cmpl   $0x41,-0x8(%rbp)
jl     119a <isX12+0x9a>
cmpl   $0x5a,-0x8(%rbp)
jg     119a <isX12+0x9a>
movl   $0x1,-0x4(%rbp)
jmp    11a1 <isX12+0xa1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isX12>:
mov    $0x1,%eax
cmp    $0x3e,%edi
ja     111d <isX12+0x1d>
mov    %edi,%ecx
movabs $0x4000040100002000,%rdx
bt     %rcx,%rdx
jae    111d <isX12+0x1d>
ret
lea    -0x30(%rdi),%ecx
cmp    $0xa,%ecx
jb     111c <isX12+0x1c>
add    $0xffffffbf,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @isX12(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 13, label %5
i32 42, label %5
i32 62, label %5
i32 32, label %5
]
5: ; preds = %1, %1, %1, %1
store i32 1, i32* %2
br label %21
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sge i32 %7, 48
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = load i32, i32* %3
%11 = icmp sle i32 %10, 57
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 1, i32* %2
br label %21
13: ; preds = %9, %6
%14 = load i32, i32* %3
%15 = icmp sge i32 %14, 65
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i32, i32* %3
%18 = icmp sle i32 %17, 90
br i1 %18, label %19, label %20
19: ; preds = %16
store i32 1, i32* %2
br label %21
20: ; preds = %16, %13
store i32 0, i32* %2
br label %21
21: ; preds = %20, %19, %12, %5
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @isX12(i32 %0) {
switch i32 %0, label %2 [
i32 13, label %9
i32 42, label %9
i32 62, label %9
i32 32, label %9
]
2: ; preds = %1
%3 = add i32 %0, -48
%4 = icmp ult i32 %3, 10
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = add i32 %0, -65
%7 = icmp ult i32 %6, 26
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %5, %2, %1, %1, %1, %1
%10 = phi i32 [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %2 ], [ %8, %5 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf(
      "-p <num>   TCP port to listen on (default: 9898)\n"
      "-l <ip_addr>  interface to listen on, default is INDRR_ANY\n"
      "-c <num>      max simultaneous connections (default: 1024)\n"
      "-d            daemon\n"
      "-h            help\n"
      "-v            verbose (print errors/warnings)\n"
      "-s            strict mode (exit while open hdb failed before startup)\n"
      "-t <num>      number of worker threads to use, default 4\n"
      "-T <num>      timeout in millisecond, 0 for none, default 0\n");
  return;
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [441 x i8] c"-p <num> TCP port to listen on (default: 9898)\0A-l <ip_addr> interface to listen on, default is INDRR_ANY\0A-c <num> max simultaneous connections (default: 1024)\0A-d daemon\0A-h help\0A-v verbose (print errors/warnings)\0A-s strict mode (exit while open hdb failed before startup)\0A-t <num> number of worker threads to use, default 4\0A-T <num> timeout in millisecond, 0 for none, default 0\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([441 x i8], [441 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [440 x i8] c"-p <num> TCP port to listen on (default: 9898)\0A-l <ip_addr> interface to listen on, default is INDRR_ANY\0A-c <num> max simultaneous connections (default: 1024)\0A-d daemon\0A-h help\0A-v verbose (print errors/warnings)\0A-s strict mode (exit while open hdb failed before startup)\0A-t <num> number of worker threads to use, default 4\0A-T <num> timeout in millisecond, 0 for none, default 0\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([440 x i8], [440 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
void cmdClearScreen(void) { printf("%s%s", "\x1B[2J", "\x1B[1;1H"); }


x86 assembly (clang, -O0):
<cmdClearScreen>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee3(%rip),%rsi
lea    0xee1(%rip),%rdx
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdClearScreen>:
lea    0xee9(%rip),%rdi
lea    0xee7(%rip),%rsi
lea    0xee5(%rip),%rdx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [5 x i8] c"\1B[2J\00"
@.str.2 = [7 x i8] c"\1B[1;1H\00"
define void @cmdClearScreen() {
%1 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [5 x i8] c"\1B[2J\00"
@.str.2 = [7 x i8] c"\1B[1;1H\00"
define void @cmdClearScreen() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Type definitions */
struct addrinfo {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
void closeAddressInfo(struct addrinfo *servinfo) { freeaddrinfo(servinfo); }


x86 assembly (clang, -O0):
<closeAddressInfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <freeaddrinfo@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<closeAddressInfo>:
jmp    1030 <freeaddrinfo@plt>

LLVM IR (-O0):
%struct.addrinfo = type { i32 }
define void @closeAddressInfo(%struct.addrinfo* %0) {
%2 = alloca %struct.addrinfo*
store %struct.addrinfo* %0, %struct.addrinfo** %2
%3 = load %struct.addrinfo*, %struct.addrinfo** %2
%4 = call i32 @freeaddrinfo(%struct.addrinfo* %3)
ret void
}

LLVM IR (-O2):
%struct.addrinfo = type { i32 }
define void @closeAddressInfo(%struct.addrinfo* %0) {
%2 = tail call i32 @freeaddrinfo(%struct.addrinfo* %0)
ret void
}
/* Variables and functions */
scalar_t__ flog_get_level();
int flog_is_trace_enabled() { return 0 >= flog_get_level(); }


x86 assembly (clang, -O0):
<flog_is_trace_enabled>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <flog_get_level@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
setge  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<flog_is_trace_enabled>:
push   %rax
xor    %eax,%eax
call   1030 <flog_get_level@plt>
xor    %ecx,%ecx
test   %rax,%rax
setle  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @flog_is_trace_enabled() {
%1 = call i64 (...) @flog_get_level()
%2 = icmp sge i64 0, %1
%3 = zext i1 %2 to i32
ret i32 %3
}

LLVM IR (-O2):
define i32 @flog_is_trace_enabled() {
%1 = tail call i64 (...) @flog_get_level()
%2 = icmp slt i64 %1, 1
%3 = zext i1 %2 to i32
ret i32 %3
}
int intComparer(const void *a, const void *b) {
  const int *ibPtr = b;
  const int *iaPtr = a;
  return *iaPtr - *ibPtr;
}


x86 assembly (clang, -O0):
<intComparer>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<intComparer>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

LLVM IR (-O0):
define i32 @intComparer(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %5
%9 = load i8*, i8** %3
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %6
%11 = load i32*, i32** %6
%12 = load i32, i32* %11
%13 = load i32*, i32** %5
%14 = load i32, i32* %13
%15 = sub nsw i32 %12, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @intComparer(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = bitcast i8* %0 to i32*
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = sub nsw i32 %5, %6
ret i32 %7
}
/* Variables and functions */
double *ReflexTestData_GetHighScores();
double *LcdModel_GetHighScores() { return ReflexTestData_GetHighScores(); }


x86 assembly (clang, -O0):
<LcdModel_GetHighScores>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <ReflexTestData_GetHighScores@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<LcdModel_GetHighScores>:
xor    %eax,%eax
jmp    1030 <ReflexTestData_GetHighScores@plt>

LLVM IR (-O0):
define double* @LcdModel_GetHighScores() {
%1 = call double* (...) @ReflexTestData_GetHighScores()
ret double* %1
}

LLVM IR (-O2):
define double* @LcdModel_GetHighScores() {
%1 = tail call double* (...) @ReflexTestData_GetHighScores()
ret double* %1
}
int neko_is_big_endian() { return 1; }


x86 assembly (clang, -O0):
<neko_is_big_endian>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<neko_is_big_endian>:
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @neko_is_big_endian() {
ret i32 1
}

LLVM IR (-O2):
define i32 @neko_is_big_endian() {
ret i32 1
}
int test_imm_E2uint8_reg(unsigned char val) {
  return ((val) & (0xE2 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_E2uint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xe2,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_E2uint8_reg>:
test   $0xe2,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_E2uint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 226
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_E2uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -30
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int fn(int, int);
int second(int a) { return fn(a, 3); }


x86 assembly (clang, -O0):
<second>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x3,%esi
call   1030 <fn@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<second>:
mov    $0x3,%esi
jmp    1030 <fn@plt>

LLVM IR (-O0):
define i32 @second(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @fn(i32 %3, i32 3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @second(i32 %0) {
%2 = tail call i32 @fn(i32 %0, i32 3)
ret i32 %2
}
int foo(void) { return 199; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc7,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    $0xc7,%eax
ret

LLVM IR (-O0):
define i32 @foo() {
ret i32 199
}

LLVM IR (-O2):
define i32 @foo() {
ret i32 199
}
int foo(int *buf, int *p) {
  int result;
  const int *tmp;
  if (*buf)
    return 1;
  result = 2;
  *buf = 2;
  tmp = buf;
  switch (*tmp) {
  case 3:
  case 4:
  case 6:
  case 14:
    return 1;
  case 0:
    result = *p;
  default:
    if (result)
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
je     1125 <foo+0x25>
movl   $0x1,-0x4(%rbp)
jmp    11c1 <foo+0xc1>
movl   $0x2,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
test   %eax,%eax
je     1196 <foo+0x96>
jmp    1154 <foo+0x54>
mov    -0x2c(%rbp),%eax
add    $0xfffffffd,%eax
sub    $0x2,%eax
jb     118a <foo+0x8a>
jmp    1168 <foo+0x68>
mov    -0x2c(%rbp),%eax
sub    $0x6,%eax
je     118a <foo+0x8a>
jmp    1179 <foo+0x79>
mov    -0x2c(%rbp),%eax
sub    $0xe,%eax
jne    119f <foo+0x9f>
jmp    118a <foo+0x8a>
movl   $0x1,-0x4(%rbp)
jmp    11c1 <foo+0xc1>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     11b5 <foo+0xb5>
movl   $0x1,-0x4(%rbp)
jmp    11c1 <foo+0xc1>
jmp    11ba <foo+0xba>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
cmpl   $0x0,(%rdi)
je     110b <foo+0xb>
mov    $0x1,%eax
ret
movl   $0x2,(%rdi)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @foo(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 1, i32* %3
br label %27
12: ; preds = %2
store i32 2, i32* %6
%13 = load i32*, i32** %4
store i32 2, i32* %13
%14 = load i32*, i32** %4
store i32* %14, i32** %7
%15 = load i32*, i32** %7
%16 = load i32, i32* %15
switch i32 %16, label %21 [
i32 3, label %17
i32 4, label %17
i32 6, label %17
i32 14, label %17
i32 0, label %18
]
17: ; preds = %12, %12, %12, %12
store i32 1, i32* %3
br label %27
18: ; preds = %12
%19 = load i32*, i32** %5
%20 = load i32, i32* %19
store i32 %20, i32* %6
br label %21
21: ; preds = %12, %18
%22 = load i32, i32* %6
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %21
store i32 1, i32* %3
br label %27
25: ; preds = %21
br label %26
26: ; preds = %25
store i32 0, i32* %3
br label %27
27: ; preds = %26, %24, %17, %11
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
define i32 @foo(i32* nocapture %0, i32* nocapture readnone %1) {
%3 = load i32, i32* %0
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %2
store i32 2, i32* %0
br label %6
6: ; preds = %2, %5
ret i32 1
}
/* Variables and functions */
scalar_t__ eq(char const *, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ usg0();
void usg(int c, const char **v) {
  if (c >= 1 && eq(v[1], "-h")) {
    usg0();
    exit(0);
  }
}


x86 assembly (clang, -O0):
<usg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
jl     1175 <usg+0x45>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xea8(%rip),%rsi
call   1050 <eq@plt>
cmp    $0x0,%rax
je     1175 <usg+0x45>
mov    $0x0,%al
call   1030 <usg0@plt>
xor    %edi,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usg>:
push   %rax
test   %edi,%edi
jle    114a <usg+0x1a>
mov    0x8(%rsi),%rdi
lea    0xec0(%rip),%rsi
call   1050 <eq@plt>
test   %rax,%rax
jne    114c <usg+0x1c>
pop    %rax
ret
xor    %eax,%eax
call   1030 <usg0@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
define void @usg(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp sge i32 %5, 1
br i1 %6, label %7, label %16
7: ; preds = %2
%8 = load i8**, i8*** %4
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i64 @eq(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %7
%14 = call i32 (...) @usg0()
%15 = call i32 @exit(i32 0)
unreachable
16: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
define void @usg(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @eq(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = tail call i32 (...) @usg0()
%11 = tail call i32 @exit(i32 0)
unreachable
12: ; preds = %4, %2
ret void
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ printf(char *, int);
main(void) {
  int c;
  int l = 0;
  while ((c = getchar()) != EOF) {
    if (c == '\n')
      l++;
  }
  printf("%d\n", l + 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%eax
je     1167 <main+0x47>
cmpl   $0xa,-0x8(%rbp)
jne    1162 <main+0x42>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1136 <main+0x16>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb6(%rip),%r14
mov    $0x1,%ebx
cmp    (%r14),%eax
je     1159 <main+0x39>
xor    %ebx,%ebx
xchg   %ax,%ax
xor    %ecx,%ecx
cmp    $0xa,%eax
sete   %cl
add    %ecx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%eax
jne    1140 <main+0x20>
add    $0x1,%ebx
lea    0xea0(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %14, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %2
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %15
8: ; preds = %4
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 10
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %14
14: ; preds = %11, %8
br label %4
15: ; preds = %4
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %15, label %4
4: ; preds = %0, %4
%5 = phi i32 [ %10, %4 ], [ %1, %0 ]
%6 = phi i32 [ %9, %4 ], [ 0, %0 ]
%7 = icmp eq i32 %5, 10
%8 = zext i1 %7 to i32
%9 = add nuw nsw i32 %6, %8
%10 = tail call i32 (...) @getchar()
%11 = load i32, i32* @EOF
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %4
13: ; preds = %4
%14 = add nuw i32 %9, 1
br label %15
15: ; preds = %13, %0
%16 = phi i32 [ 1, %0 ], [ %14, %13 ]
%17 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ DIV_ROUND_UP(unsigned long, int);
int /*<<< orphan*/ udelay(int /*<<< orphan*/);
void ndelay(unsigned long nsec) { udelay(DIV_ROUND_UP(nsec, 1000)); }


x86 assembly (clang, -O0):
<ndelay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3e8,%esi
call   1030 <DIV_ROUND_UP@plt>
mov    %eax,%edi
call   1040 <udelay@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ndelay>:
push   %rax
mov    $0x3e8,%esi
call   1030 <DIV_ROUND_UP@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <udelay@plt>

LLVM IR (-O0):
define void @ndelay(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @DIV_ROUND_UP(i64 %3, i32 1000)
%5 = call i32 @udelay(i32 %4)
ret void
}

LLVM IR (-O2):
define void @ndelay(i64 %0) {
%2 = tail call i32 @DIV_ROUND_UP(i64 %0, i32 1000)
%3 = tail call i32 @udelay(i32 %2)
ret void
}
/* Variables and functions */
int is_prime(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a;
  printf("Enter Number:");
  scanf("%d", &a);
  printf("%d", is_prime(a));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1040 <is_prime@plt>
mov    %eax,%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
call   1040 <is_prime@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Enter Number:\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = call i32 @is_prime(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Enter Number:\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @is_prime(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}
f(int x, char y, char buf[(__typeof(y))sizeof x]) { return buf[5]; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x5(%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movsbl 0x5(%rdx),%eax
ret

LLVM IR (-O0):
define i32 @f(i32 %0, i8 signext %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8*
store i32 %0, i32* %4
store i8 %1, i8* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = getelementptr inbounds i8, i8* %7, i64 5
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @f(i32 %0, i8 signext %1, i8* nocapture %2) {
%4 = getelementptr inbounds i8, i8* %2, i64 5
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
ret i32 %6
}
char test_75_0(char *mem) { return __atomic_fetch_nand(mem + 4, -1, 4); }


x86 assembly (clang, -O0):
<test_75_0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0xff,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    %cl,-0xc(%rbp)
mov    0x4(%rax),%al
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%al
mov    -0x18(%rbp),%rcx
mov    -0xc(%rbp),%sil
mov    %al,%dl
and    %sil,%dl
mov    %dl,-0x1a(%rbp)
not    %dl
lock cmpxchg %dl,(%rcx)
sete   %cl
mov    %al,-0x19(%rbp)
test   $0x1,%cl
mov    %al,-0xb(%rbp)
jne    1157 <test_75_0+0x57>
jmp    1127 <test_75_0+0x27>
mov    -0x19(%rbp),%al
mov    %al,-0xa(%rbp)
movsbl -0xa(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_75_0>:
mov    0x4(%rdi),%al
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%ecx
not    %cl
lock cmpxchg %cl,0x4(%rdi)
jne    1110 <test_75_0+0x10>
ret

LLVM IR (-O0):
define signext i8 @test_75_0(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i8
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 4
store i8 -1, i8* %3
%7 = load i8, i8* %3
%8 = atomicrmw nand i8* %6, i8 %7 acq_rel
store i8 %8, i8* %4
%9 = load i8, i8* %4
ret i8 %9
}

LLVM IR (-O2):
define signext i8 @test_75_0(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 4
%3 = atomicrmw nand i8* %2, i8 -1 acq_rel
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int nr = 11;
  printf("Witaj świecie!\n");
  printf("to juz %d (0x0%x) wyklad z j.C\n", nr, nr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xb,-0x8(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
mov    $0xb,%esi
mov    $0xb,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Witaj \C5\9Bwiecie!\0A\00"
@.str.1 = [32 x i8] c"to juz %d (0x0%x) wyklad z j.C\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 11, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [32 x i8] c"to juz %d (0x0%x) wyklad z j.C\0A\00"
@str = [16 x i8] c"Witaj \C5\9Bwiecie!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 11, i32 11)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void pasc_exit(char *name) { printf("ok %s\n", name); }


x86 assembly (clang, -O0):
<pasc_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pasc_exit>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"ok %s\0A\00"
define void @pasc_exit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"ok %s\0A\00"
define void @pasc_exit(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strncpy(char *, char const *, size_t);
char *strncpy0(char *dest, const char *src, size_t size) {
  strncpy(dest, src, size - 1);
  dest[size - 1] = '\0';
  return dest;
}


x86 assembly (clang, -O0):
<strncpy0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
sub    $0x1,%rdx
call   1030 <strncpy@plt>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncpy0>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rdx
call   1030 <strncpy@plt>
movb   $0x0,-0x1(%rbx,%r14,1)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strncpy0(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = sub i64 %9, 1
%11 = call i32 @strncpy(i8* %7, i8* %8, i64 %10)
%12 = load i8*, i8** %4
%13 = load i64, i64* %6
%14 = sub i64 %13, 1
%15 = getelementptr inbounds i8, i8* %12, i64 %14
store i8 0, i8* %15
%16 = load i8*, i8** %4
ret i8* %16
}

LLVM IR (-O2):
define i8* @strncpy0(i8* returned %0, i8* %1, i64 %2) {
%4 = add i64 %2, -1
%5 = tail call i32 @strncpy(i8* %0, i8* %1, i64 %4)
%6 = getelementptr inbounds i8, i8* %0, i64 %4
store i8 0, i8* %6
ret i8* %0
}
int test(char *C) {
  return C != ((void *)0);
  return C != (void *)0;
  return C != 0;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
xor    %eax,%eax
test   %rdi,%rdi
setne  %al
ret

LLVM IR (-O0):
define i32 @test(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @test(i8* readnone %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
struct node {
  int dummy;
};

/* Variables and functions */
int height(struct node *);
int /*<<< orphan*/ printGivenLevel(struct node *, int);
void levelorder(struct node *root) {
  int h = height(root);
  for (int i = 0; i < h; i++) {
    printGivenLevel(root, i + 1);
  }
}


x86 assembly (clang, -O0):
<levelorder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <height@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1168 <levelorder+0x48>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
add    $0x1,%esi
call   1030 <printGivenLevel@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113f <levelorder+0x1f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<levelorder>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1040 <height@plt>
test   %eax,%eax
jle    115d <levelorder+0x3d>
mov    %eax,%r15d
neg    %r15d
mov    $0x1,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printGivenLevel@plt>
lea    (%r15,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1140 <levelorder+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.node = type { i32 }
define void @levelorder(%struct.node* %0) {
%2 = alloca %struct.node*
%3 = alloca i32
%4 = alloca i32
store %struct.node* %0, %struct.node** %2
%5 = load %struct.node*, %struct.node** %2
%6 = call i32 @height(%struct.node* %5)
store i32 %6, i32* %3
store i32 0, i32* %4
br label %7
7: ; preds = %16, %1
%8 = load i32, i32* %4
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %19
11: ; preds = %7
%12 = load %struct.node*, %struct.node** %2
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 1
%15 = call i32 @printGivenLevel(%struct.node* %12, i32 %14)
br label %16
16: ; preds = %11
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %7
19: ; preds = %7
ret void
}

LLVM IR (-O2):
%struct.node = type { i32 }
define void @levelorder(%struct.node* %0) {
%2 = tail call i32 @height(%struct.node* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %5, label %4
4: ; preds = %5, %1
ret void
5: ; preds = %1, %5
%6 = phi i32 [ %7, %5 ], [ 0, %1 ]
%7 = add nuw nsw i32 %6, 1
%8 = tail call i32 @printGivenLevel(%struct.node* %0, i32 %7)
%9 = icmp eq i32 %7, %2
br i1 %9, label %4, label %5
}
/* Variables and functions */
int /*<<< orphan*/ console_tx_nibble(unsigned short);
void console_tx_hex16(unsigned short value) {
  console_tx_nibble((value >> 12U) & 0x0FU);
  console_tx_nibble((value >> 8U) & 0x0FU);
  console_tx_nibble((value >> 4U) & 0x0FU);
  console_tx_nibble(value & 0x0FU);
}


x86 assembly (clang, -O0):
<console_tx_hex16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0xc,%eax
and    $0xf,%eax
movzwl %ax,%edi
call   1030 <console_tx_nibble@plt>
movzwl -0x2(%rbp),%eax
sar    $0x8,%eax
and    $0xf,%eax
movzwl %ax,%edi
call   1030 <console_tx_nibble@plt>
movzwl -0x2(%rbp),%eax
sar    $0x4,%eax
and    $0xf,%eax
movzwl %ax,%edi
call   1030 <console_tx_nibble@plt>
movzwl -0x2(%rbp),%eax
and    $0xf,%eax
movzwl %ax,%edi
call   1030 <console_tx_nibble@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<console_tx_hex16>:
push   %rbx
mov    %edi,%ebx
shr    $0xc,%edi
call   1030 <console_tx_nibble@plt>
mov    %ebx,%edi
shr    $0x8,%edi
and    $0xf,%edi
call   1030 <console_tx_nibble@plt>
mov    %ebx,%edi
shr    $0x4,%edi
and    $0xf,%edi
call   1030 <console_tx_nibble@plt>
and    $0xf,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <console_tx_nibble@plt>

LLVM IR (-O0):
define void @console_tx_hex16(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = ashr i32 %4, 12
%6 = and i32 %5, 15
%7 = trunc i32 %6 to i16
%8 = call i32 @console_tx_nibble(i16 zeroext %7)
%9 = load i16, i16* %2
%10 = zext i16 %9 to i32
%11 = ashr i32 %10, 8
%12 = and i32 %11, 15
%13 = trunc i32 %12 to i16
%14 = call i32 @console_tx_nibble(i16 zeroext %13)
%15 = load i16, i16* %2
%16 = zext i16 %15 to i32
%17 = ashr i32 %16, 4
%18 = and i32 %17, 15
%19 = trunc i32 %18 to i16
%20 = call i32 @console_tx_nibble(i16 zeroext %19)
%21 = load i16, i16* %2
%22 = zext i16 %21 to i32
%23 = and i32 %22, 15
%24 = trunc i32 %23 to i16
%25 = call i32 @console_tx_nibble(i16 zeroext %24)
ret void
}

LLVM IR (-O2):
define void @console_tx_hex16(i16 zeroext %0) {
%2 = lshr i16 %0, 12
%3 = tail call i32 @console_tx_nibble(i16 zeroext %2)
%4 = lshr i16 %0, 8
%5 = and i16 %4, 15
%6 = tail call i32 @console_tx_nibble(i16 zeroext %5)
%7 = lshr i16 %0, 4
%8 = and i16 %7, 15
%9 = tail call i32 @console_tx_nibble(i16 zeroext %8)
%10 = and i16 %0, 15
%11 = tail call i32 @console_tx_nibble(i16 zeroext %10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bar();
void xxx(void) { bar(); }


x86 assembly (clang, -O0):
<xxx>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <bar@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<xxx>:
xor    %eax,%eax
jmp    1030 <bar@plt>

LLVM IR (-O0):
define void @xxx() {
%1 = call i32 (...) @bar()
ret void
}

LLVM IR (-O2):
define void @xxx() {
%1 = tail call i32 (...) @bar()
ret void
}
unsigned mydiv(unsigned x, unsigned y) {
  return (unsigned)((signed)x / (signed)y);
}


x86 assembly (clang, -O0):
<mydiv>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mydiv>:
mov    %edi,%eax
cltd
idiv   %esi
ret

LLVM IR (-O0):
define i32 @mydiv(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = sdiv i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @mydiv(i32 %0, i32 %1) {
%3 = sdiv i32 %0, %1
ret i32 %3
}