xunge/DecIR huggingface dataset:
float raw_reg_to_temp(float reg, int slope, int counter) {
  float temp;
  if (slope != 0) {
    temp = (reg - 0.25) + ((slope - counter) / slope);
  }
  return (temp);
}


x86 assembly (clang, -O0):
<raw_reg_to_temp>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1149 <raw_reg_to_temp+0x49>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xed6(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cvtsi2sd %eax,%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<raw_reg_to_temp>:
test   %edi,%edi
je     1127 <raw_reg_to_temp+0x27>
cvtss2sd %xmm0,%xmm0
addsd  0xef0(%rip),%xmm0
mov    %edi,%eax
sub    %esi,%eax
cltd
idiv   %edi
cvtsi2sd %eax,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
ret
ret

LLVM IR (-O0):
define float @raw_reg_to_temp(float %0, i32 %1, i32 %2) {
%4 = alloca float
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
store float %0, float* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %22
10: ; preds = %3
%11 = load float, float* %4
%12 = fpext float %11 to double
%13 = fsub double %12, 2.500000e-01
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = sub nsw i32 %14, %15
%17 = load i32, i32* %5
%18 = sdiv i32 %16, %17
%19 = sitofp i32 %18 to double
%20 = fadd double %13, %19
%21 = fptrunc double %20 to float
store float %21, float* %7
br label %22
22: ; preds = %10, %3
%23 = load float, float* %7
ret float %23
}

LLVM IR (-O2):
define float @raw_reg_to_temp(float %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %13, label %5
5: ; preds = %3
%6 = fpext float %0 to double
%7 = fadd double %6, -2.500000e-01
%8 = sub nsw i32 %1, %2
%9 = sdiv i32 %8, %1
%10 = sitofp i32 %9 to double
%11 = fadd double %7, %10
%12 = fptrunc double %11 to float
br label %13
13: ; preds = %5, %3
%14 = phi float [ %12, %5 ], [ undef, %3 ]
ret float %14
}
/* Variables and functions */
int /*<<< orphan*/ errno;
uintptr_t GetErrno() { return (uintptr_t)errno; }


x86 assembly (clang, -O0):
<GetErrno>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ed5(%rip),%rax
movslq (%rax),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetErrno>:
mov    0x2ed9(%rip),%rax
movslq (%rax),%rax
ret

LLVM IR (-O0):
@errno = global i32 0
define i64 @GetErrno() {
%1 = load i32, i32* @errno
%2 = sext i32 %1 to i64
ret i64 %2
}

LLVM IR (-O2):
@errno = global i32 0
define i64 @GetErrno() {
%1 = load i32, i32* @errno
%2 = sext i32 %1 to i64
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isxdigit(int);
void t_isxdigit_0x8e() {
  Assert_real((isxdigit(142) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isxdigit.c",
              715, ("isxdigit should be 0 for 0x8e"));
}


x86 assembly (clang, -O0):
<t_isxdigit_0x8e>:
push   %rbp
mov    %rsp,%rbp
mov    $0x8e,%edi
call   1030 <isxdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x2cb,%edx
lea    0xf5c(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isxdigit_0x8e>:
push   %rax
mov    $0x8e,%edi
call   1030 <isxdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x2cb,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isxdigit.c\00"
@.str.1 = [30 x i8] c"isxdigit should be 0 for 0x8e\00"
define void @t_isxdigit_0x8e() {
%1 = call i64 @isxdigit(i32 142)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 715, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isxdigit.c\00"
@.str.1 = [30 x i8] c"isxdigit should be 0 for 0x8e\00"
define void @t_isxdigit_0x8e() {
%1 = tail call i64 @isxdigit(i32 142)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 715, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int get_count(uint32_t cs) { return cs >> (19); }


x86 assembly (clang, -O0):
<get_count>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x13,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_count>:
mov    %edi,%eax
sar    $0x13,%eax
ret

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

LLVM IR (-O2):
define i32 @get_count(i32 %0) {
%2 = ashr i32 %0, 19
ret i32 %2
}
int test_imm_93int32_reg(int val) { return ((val) & (0x93 << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_93int32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x93,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_93int32_reg(i32 %0) {
%2 = and i32 %0, 147
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void f(int i) {
  i = i > 0 ? i : -i;
  if (i < 0)
    return;
  abort();
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1130 <f+0x20>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1138 <f+0x28>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    114e <f+0x3e>
add    $0x10,%rsp
pop    %rbp
ret
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<f>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @f(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load i32, i32* %2
br label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = sub nsw i32 0, %8
br label %10
10: ; preds = %7, %5
%11 = phi i32 [ %6, %5 ], [ %9, %7 ]
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
ret void
15: ; preds = %10
%16 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define void @f(i32 %0) {
%2 = tail call i32 (...) @abort()
unreachable
}
int gcd(int n, int d) {
  int t;
  while (d > 0) {
    if (n > d) {
      t = n;
      n = d;
      d = t;
    }
    d = d - n;
  }
  return n;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1140 <gcd+0x40>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1132 <gcd+0x32>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    110a <gcd+0xa>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %edi,%eax
test   %esi,%esi
jle    111e <gcd+0x1e>
mov    %esi,%ecx
nopl   0x0(%rax,%rax,1)
cmp    %esi,%eax
cmovg  %eax,%ecx
cmovg  %esi,%eax
sub    %eax,%ecx
mov    %ecx,%esi
jg     1110 <gcd+0x10>
ret

LLVM IR (-O0):
define i32 @gcd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %21
9: ; preds = %6
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = icmp sgt i32 %10, %11
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i32, i32* %3
store i32 %14, i32* %5
%15 = load i32, i32* %4
store i32 %15, i32* %3
%16 = load i32, i32* %5
store i32 %16, i32* %4
br label %17
17: ; preds = %13, %9
%18 = load i32, i32* %4
%19 = load i32, i32* %3
%20 = sub nsw i32 %18, %19
store i32 %20, i32* %4
br label %6
21: ; preds = %6
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %12
4: ; preds = %2, %4
%5 = phi i32 [ %9, %4 ], [ %0, %2 ]
%6 = phi i32 [ %10, %4 ], [ %1, %2 ]
%7 = icmp sgt i32 %5, %6
%8 = select i1 %7, i32 %5, i32 %6
%9 = select i1 %7, i32 %6, i32 %5
%10 = sub nsw i32 %8, %9
%11 = icmp sgt i32 %10, 0
br i1 %11, label %4, label %12
12: ; preds = %4, %2
%13 = phi i32 [ %0, %2 ], [ %9, %4 ]
ret i32 %13
}
/* Variables and functions */
int shash_rot13_update(int /*<<< orphan*/, char const *);
unsigned shash_rot13(const char *buf) { return shash_rot13_update(0, buf); }


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

x86 assembly (clang, -O2):
<shash_rot13>:
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <shash_rot13_update@plt>

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

LLVM IR (-O2):
define i32 @shash_rot13(i8* %0) {
%2 = tail call i32 @shash_rot13_update(i32 0, i8* %0)
ret i32 %2
}
void test_dquoted_escaping_escapes_double_quote(void) {
  char *const escaped = escape_for_dquotes("0a\"b\"c\"d1", 0);
  do {
    seatest_assert_string_equal("0a\\\"b\\\"c\\\"d1", escaped, __FUNCTION__,
                                27);
  } while (0);
  free(escaped);
}


x86 assembly (clang, -O0):
<test_dquoted_escaping_escapes_double_quote>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
xor    %esi,%esi
mov    $0x0,%al
call   1040 <escape_for_dquotes@plt>
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb1(%rip),%rdi
lea    0xeb7(%rip),%rdx
mov    $0x1b,%ecx
mov    $0x0,%al
call   1050 <seatest_assert_string_equal@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_dquoted_escaping_escapes_double_quote>:
push   %rbx
lea    0xec8(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <escape_for_dquotes@plt>
movslq %eax,%rbx
lea    0xebf(%rip),%rdi
lea    0xec5(%rip),%rdx
mov    %rbx,%rsi
mov    $0x1b,%ecx
xor    %eax,%eax
call   1050 <seatest_assert_string_equal@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"0a\22b\22c\22d1\00"
@.str.1 = [13 x i8] c"0a\\\22b\\\22c\\\22d1\00"
@__FUNCTION__.test_dquoted_escaping_escapes_double_quote = [43 x i8] c"test_dquoted_escaping_escapes_double_quote\00"
define void @test_dquoted_escaping_escapes_double_quote() {
%1 = alloca i8*
%2 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @escape_for_dquotes to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 0)
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %1
br label %5
5: ; preds = %0
%6 = load i8*, i8** %1
%7 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @__FUNCTION__.test_dquoted_escaping_escapes_double_quote, i64 0, i64 0), i32 27)
br label %8
8: ; preds = %5
%9 = load i8*, i8** %1
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"0a\22b\22c\22d1\00"
@.str.1 = [13 x i8] c"0a\\\22b\\\22c\\\22d1\00"
@__FUNCTION__.test_dquoted_escaping_escapes_double_quote = [43 x i8] c"test_dquoted_escaping_escapes_double_quote\00"
define void @test_dquoted_escaping_escapes_double_quote() {
%1 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @escape_for_dquotes to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 0)
%2 = sext i32 %1 to i64
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @__FUNCTION__.test_dquoted_escaping_escapes_double_quote, i64 0, i64 0), i32 27)
tail call void @free(i8* %3)
ret void
}
/* Variables and functions */
bool gen_is_chv(int devid) {
  return (devid == 0x22b0 || devid == 0x22b1 || devid == 0x22b2 ||
          devid == 0x22b3);
}


x86 assembly (clang, -O0):
<gen_is_chv>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x22b0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     114a <gen_is_chv+0x4a>
mov    $0x1,%al
cmpl   $0x22b1,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     114a <gen_is_chv+0x4a>
mov    $0x1,%al
cmpl   $0x22b2,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     114a <gen_is_chv+0x4a>
cmpl   $0x22b3,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_is_chv>:
and    $0xfffffffc,%edi
xor    %eax,%eax
cmp    $0x22b0,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @gen_is_chv(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 8880
br i1 %4, label %14, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 8881
br i1 %7, label %14, label %8
8: ; preds = %5
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 8882
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 8883
br label %14
14: ; preds = %11, %8, %5, %1
%15 = phi i1 [ true, %8 ], [ true, %5 ], [ true, %1 ], [ %13, %11 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @gen_is_chv(i32 %0) {
%2 = and i32 %0, -4
%3 = icmp eq i32 %2, 8880
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ uint16_t;
struct sockaddr_in {
  int dummy;
};
struct sockaddr {
  int dummy;
};

/* Variables and functions */
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ sockaddrnumfill(struct sockaddr_in *, int /*<<< orphan*/,
                                   int /*<<< orphan*/);
int tcpnumbind(int sock, uint32_t ip, uint16_t port) {
  struct sockaddr_in sa;
  sockaddrnumfill(&sa, ip, port);
  if (bind(sock, (struct sockaddr *)&sa, sizeof(struct sockaddr_in)) < 0) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<tcpnumbind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    -0x18(%rbp),%rdi
call   1030 <sockaddrnumfill@plt>
mov    -0x8(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0x4,%edx
call   1040 <bind@plt>
cmp    $0x0,%rax
jge    1167 <tcpnumbind+0x47>
movl   $0xffffffff,-0x4(%rbp)
jmp    116e <tcpnumbind+0x4e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcpnumbind>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <sockaddrnumfill@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <bind@plt>
sar    $0x3f,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
define i32 @tcpnumbind(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.sockaddr_in
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = load i32, i32* %6
%10 = load i32, i32* %7
%11 = call i32 @sockaddrnumfill(%struct.sockaddr_in* %8, i32 %9, i32 %10)
%12 = load i32, i32* %5
%13 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%14 = call i64 @bind(i32 %12, %struct.sockaddr* %13, i32 4)
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %3
store i32 -1, i32* %4
br label %18
17: ; preds = %3
store i32 0, i32* %4
br label %18
18: ; preds = %17, %16
%19 = load i32, i32* %4
ret i32 %19
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
define i32 @tcpnumbind(i32 %0, i32 %1, i32 %2) {
%4 = alloca %struct.sockaddr_in
%5 = bitcast %struct.sockaddr_in* %4 to i8*
%6 = call i32 @sockaddrnumfill(%struct.sockaddr_in* %4, i32 %1, i32 %2)
%7 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%8 = call i64 @bind(i32 %0, %struct.sockaddr* %7, i32 4)
%9 = ashr i64 %8, 63
%10 = trunc i64 %9 to i32
ret i32 %10
}
/* Variables and functions */
unsigned long strtoul(char const *, char **, int);
unsigned long str_const_to_ul(char const *str, char const **ppz, int base) {
  return strtoul(str, (char **)ppz, base);
}


x86 assembly (clang, -O0):
<str_const_to_ul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <strtoul@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_const_to_ul>:
jmp    1030 <strtoul@plt>

LLVM IR (-O0):
define i64 @str_const_to_ul(i8* %0, i8** %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8**, i8*** %5
%9 = load i32, i32* %6
%10 = call i64 @strtoul(i8* %7, i8** %8, i32 %9)
ret i64 %10
}

LLVM IR (-O2):
define i64 @str_const_to_ul(i8* %0, i8** nocapture %1, i32 %2) {
%4 = tail call i64 @strtoul(i8* %0, i8** %1, i32 %2)
ret i64 %4
}
long long int f2sll(float f) { return (long long int)f; }


x86 assembly (clang, -O0):
<f2sll>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
cvttss2si -0x4(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2sll>:
cvttss2si %xmm0,%rax
ret

LLVM IR (-O0):
define i64 @f2sll(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fptosi float %3 to i64
ret i64 %4
}

LLVM IR (-O2):
define i64 @f2sll(float %0) {
%2 = fptosi float %0 to i64
ret i64 %2
}
void SteamAPI_ISteamGameServer_SetGameDescription(
    void *self, const char *pszGameDescription) {
  xlogf("%s(self = %p, pszGameDescription = %s)\n", __func__, self,
        pszGameDescription);
}


x86 assembly (clang, -O0):
<SteamAPI_ISteamGameServer_SetGameDescription>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xed1(%rip),%rdi
lea    0xef2(%rip),%rsi
mov    $0x0,%al
call   1030 <xlogf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SteamAPI_ISteamGameServer_SetGameDescription>:
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xee3(%rip),%rdi
lea    0xf04(%rip),%rsi
xor    %eax,%eax
jmp    1030 <xlogf@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"%s(self = %p, pszGameDescription = %s)\0A\00"
@__func__.SteamAPI_ISteamGameServer_SetGameDescription = [45 x i8] c"SteamAPI_ISteamGameServer_SetGameDescription\00"
define void @SteamAPI_ISteamGameServer_SetGameDescription(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 (i8*, i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([45 x i8], [45 x i8]* @__func__.SteamAPI_ISteamGameServer_SetGameDescription, i64 0, i64 0), i8* %5, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"%s(self = %p, pszGameDescription = %s)\0A\00"
@__func__.SteamAPI_ISteamGameServer_SetGameDescription = [45 x i8] c"SteamAPI_ISteamGameServer_SetGameDescription\00"
define void @SteamAPI_ISteamGameServer_SetGameDescription(i8* %0, i8* %1) {
%3 = tail call i32 (i8*, i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([45 x i8], [45 x i8]* @__func__.SteamAPI_ISteamGameServer_SetGameDescription, i64 0, i64 0), i8* %0, i8* %1)
ret void
}
/* Variables and functions */
int strcmp(void const *, void const *);
int strcmp_wrapper(const void *v1, const void *v2) { return strcmp(v1, v2); }


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

x86 assembly (clang, -O2):
<strcmp_wrapper>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @strcmp_wrapper(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
void init_mm_mutex() {}


x86 assembly (clang, -O0):
<init_mm_mutex>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_mm_mutex>:
ret

LLVM IR (-O0):
define void @init_mm_mutex() {
ret void
}

LLVM IR (-O2):
define void @init_mm_mutex() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void text_color(int attr, int fg) { printf("\x1b[%d;%dm", attr, fg + 30); }


x86 assembly (clang, -O0):
<text_color>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
add    $0x1e,%edx
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<text_color>:
mov    %edi,%eax
lea    0x1e(%rsi),%edx
lea    0xee4(%rip),%rdi
mov    %eax,%esi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"\1B[%d;%dm\00"
define void @text_color(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 = add nsw i32 %6, 30
%8 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"\1B[%d;%dm\00"
define void @text_color(i32 %0, i32 %1) {
%3 = add nsw i32 %1, 30
%4 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_memtrap_add() {
  printf("NOT IMPLEMENTED:"
         "pa_memtrap_add"
         "\n");
}


x86 assembly (clang, -O0):
<pa_memtrap_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [32 x i8] c"NOT IMPLEMENTED:pa_memtrap_add\0A\00"
define i32 @pa_memtrap_add() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [31 x i8] c"NOT IMPLEMENTED:pa_memtrap_add\00"
define i32 @pa_memtrap_add() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
int do_379() { return 379; }


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

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

LLVM IR (-O0):
define i32 @do_379() {
ret i32 379
}

LLVM IR (-O2):
define i32 @do_379() {
ret i32 379
}
/* Variables and functions */
int /*<<< orphan*/ test_explicit_printf_format();
int /*<<< orphan*/ test_explicit_sprintf_format();
int /*<<< orphan*/ test_printf_still_honours_null_termination();
int /*<<< orphan*/ test_printf_width_as_argument();
int /*<<< orphan*/ test_sprintf_with_width_as_argument();
int main(void) {
  test_explicit_printf_format();
  test_printf_width_as_argument();
  test_printf_still_honours_null_termination();
  test_explicit_sprintf_format();
  test_sprintf_with_width_as_argument();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1070 <test_explicit_printf_format@plt>
mov    $0x0,%al
call   1060 <test_printf_width_as_argument@plt>
mov    $0x0,%al
call   1030 <test_printf_still_honours_null_termination@plt>
mov    $0x0,%al
call   1040 <test_explicit_sprintf_format@plt>
mov    $0x0,%al
call   1050 <test_sprintf_with_width_as_argument@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1070 <test_explicit_printf_format@plt>
xor    %eax,%eax
call   1060 <test_printf_width_as_argument@plt>
xor    %eax,%eax
call   1030 <test_printf_still_honours_null_termination@plt>
xor    %eax,%eax
call   1040 <test_explicit_sprintf_format@plt>
xor    %eax,%eax
call   1050 <test_sprintf_with_width_as_argument@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @test_explicit_printf_format()
%2 = call i32 (...) @test_printf_width_as_argument()
%3 = call i32 (...) @test_printf_still_honours_null_termination()
%4 = call i32 (...) @test_explicit_sprintf_format()
%5 = call i32 (...) @test_sprintf_with_width_as_argument()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_explicit_printf_format()
%2 = tail call i32 (...) @test_printf_width_as_argument()
%3 = tail call i32 (...) @test_printf_still_honours_null_termination()
%4 = tail call i32 (...) @test_explicit_sprintf_format()
%5 = tail call i32 (...) @test_sprintf_with_width_as_argument()
ret i32 0
}
float Kit_Int2Float(int Num) { return *((float *)&Num); }


x86 assembly (clang, -O0):
<Kit_Int2Float>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Kit_Int2Float>:
movd   %edi,%xmm0
ret

LLVM IR (-O0):
define float @Kit_Int2Float(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = bitcast i32* %2 to float*
%4 = load float, float* %3
ret float %4
}

LLVM IR (-O2):
define float @Kit_Int2Float(i32 %0) {
%2 = bitcast i32 %0 to float
ret float %2
}
int set_sign(int word, int nbytes) {
  static mask_bit[4] = {0x00000080, 0x00008000, 0x00800000, 0x80000000};
  static mask_val[4] = {0x0000007f, 0x00007fff, 0x007fffff, 0x7fffffff};
  int newval;
  newval = word & mask_val[nbytes - 1];
  if ((word & mask_bit[nbytes - 1]) > 0)
    newval = -newval;
  return newval;
}


x86 assembly (clang, -O0):
<set_sign>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rdx
lea    0x2f23(%rip),%rcx
and    (%rcx,%rdx,4),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rdx
lea    0x2efa(%rip),%rcx
and    (%rcx,%rdx,4),%eax
cmp    $0x0,%eax
jle    114a <set_sign+0x4a>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_sign>:
movslq %esi,%rcx
lea    0xf06(%rip),%rax
mov    -0x4(%rax,%rcx,4),%edx
and    %edi,%edx
lea    0xee9(%rip),%rsi
mov    %edx,%eax
neg    %eax
test   %edi,-0x4(%rsi,%rcx,4)
cmovle %edx,%eax
ret

LLVM IR (-O0):
@set_sign.mask_bit = internal global [4 x i32] [i32 128, i32 32768, i32 8388608, i32 -2147483648]
@set_sign.mask_val = internal global [4 x i32] [i32 127, i32 32767, i32 8388607, i32 2147483647]
define i32 @set_sign(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = sub nsw i32 %7, 1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [4 x i32], [4 x i32]* @set_sign.mask_val, i64 0, i64 %9
%11 = load i32, i32* %10
%12 = and i32 %6, %11
store i32 %12, i32* %5
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = sub nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [4 x i32], [4 x i32]* @set_sign.mask_bit, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = and i32 %13, %18
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %2
%22 = load i32, i32* %5
%23 = sub nsw i32 0, %22
store i32 %23, i32* %5
br label %24
24: ; preds = %21, %2
%25 = load i32, i32* %5
ret i32 %25
}

LLVM IR (-O2):
@set_sign.mask_bit = internal unnamed_addr constant [4 x i32] [i32 128, i32 32768, i32 8388608, i32 -2147483648]
@set_sign.mask_val = internal unnamed_addr constant [4 x i32] [i32 127, i32 32767, i32 8388607, i32 2147483647]
define i32 @set_sign(i32 %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds [4 x i32], [4 x i32]* @set_sign.mask_val, i64 0, i64 %4
%6 = load i32, i32* %5
%7 = and i32 %6, %0
%8 = getelementptr inbounds [4 x i32], [4 x i32]* @set_sign.mask_bit, i64 0, i64 %4
%9 = load i32, i32* %8
%10 = and i32 %9, %0
%11 = icmp sgt i32 %10, 0
%12 = sub nsw i32 0, %7
%13 = select i1 %11, i32 %12, i32 %7
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int, int, int, int);
void logPktRecv(int t, int currNote, int srcNode, int srcAddr, int destAddr,
                int msgId, int pktId) {
  printf("%3d: node %d recvs from %d pkt %d of msg %d (src=%d,dst=%d)\n", t,
         currNote, srcNode, pktId, msgId, srcAddr, destAddr);
}


x86 assembly (clang, -O0):
<logPktRecv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    0x10(%rbp),%r8d
mov    -0x18(%rbp),%r9d
mov    -0x10(%rbp),%r10d
mov    -0x14(%rbp),%eax
lea    0xeb2(%rip),%rdi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logPktRecv>:
push   %rax
mov    %r8d,%eax
mov    %ecx,%r10d
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
mov    0x10(%rsp),%r8d
lea    0xed7(%rip),%rdi
push   %rax
push   %r10
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rax
ret

LLVM IR (-O0):
@.str = [61 x i8] c"%3d: node %d recvs from %d pkt %d of msg %d (src=%d,dst=%d)\0A\00"
define void @logPktRecv(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%15 = load i32, i32* %8
%16 = load i32, i32* %9
%17 = load i32, i32* %10
%18 = load i32, i32* %14
%19 = load i32, i32* %13
%20 = load i32, i32* %11
%21 = load i32, i32* %12
%22 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %16, i32 %17, i32 %18, i32 %19, i32 %20, i32 %21)
ret void
}

LLVM IR (-O2):
@.str = [61 x i8] c"%3d: node %d recvs from %d pkt %d of msg %d (src=%d,dst=%d)\0A\00"
define void @logPktRecv(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = tail call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2, i32 %6, i32 %5, i32 %3, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gmove_bca_4a4t_b();
int /*<<< orphan*/ gmove_bca_4a4t_b2();
int main() {
  gmove_bca_4a4t_b();
  gmove_bca_4a4t_b2();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <gmove_bca_4a4t_b@plt>
mov    $0x0,%al
call   1030 <gmove_bca_4a4t_b2@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <gmove_bca_4a4t_b@plt>
xor    %eax,%eax
call   1030 <gmove_bca_4a4t_b2@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @gmove_bca_4a4t_b()
%3 = call i32 (...) @gmove_bca_4a4t_b2()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @gmove_bca_4a4t_b()
%2 = tail call i32 (...) @gmove_bca_4a4t_b2()
ret i32 0
}
/* Type definitions */
typedef double uint8_t;

/* Variables and functions */
int pow(double, double);
int /*<<< orphan*/ round(int);
uint8_t correct_gamma(double g, uint8_t val) {
  return (uint8_t)(round(255 * pow((val / 255.0), g) * 1));
}


x86 assembly (clang, -O0):
<correct_gamma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xec1(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm1
call   1030 <pow@plt>
imul   $0xff,%eax,%edi
shl    $0x0,%edi
call   1040 <round@plt>
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<correct_gamma>:
push   %rax
movaps %xmm0,%xmm2
divsd  0xed4(%rip),%xmm1
movapd %xmm1,%xmm0
movaps %xmm2,%xmm1
call   1030 <pow@plt>
mov    %eax,%edi
shl    $0x8,%edi
sub    %eax,%edi
call   1040 <round@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @correct_gamma(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fdiv double %5, 2.550000e+02
%7 = load double, double* %3
%8 = call i32 @pow(double %6, double %7)
%9 = mul nsw i32 255, %8
%10 = mul nsw i32 %9, 1
%11 = call i32 @round(i32 %10)
%12 = sitofp i32 %11 to double
ret double %12
}

LLVM IR (-O2):
define double @correct_gamma(double %0, double %1) {
%3 = fdiv double %1, 2.550000e+02
%4 = tail call i32 @pow(double %3, double %0)
%5 = mul nsw i32 %4, 255
%6 = tail call i32 @round(i32 %5)
%7 = sitofp i32 %6 to double
ret double %7
}
void led_gpio_rgb_unregister(struct gpio_led *led) {}


x86 assembly (clang, -O0):
<led_gpio_rgb_unregister>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<led_gpio_rgb_unregister>:
ret

LLVM IR (-O0):
%struct.gpio_led = type opaque
define void @led_gpio_rgb_unregister(%struct.gpio_led* %0) {
%2 = alloca %struct.gpio_led*
store %struct.gpio_led* %0, %struct.gpio_led** %2
ret void
}

LLVM IR (-O2):
%struct.gpio_led = type opaque
define void @led_gpio_rgb_unregister(%struct.gpio_led* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ pthread_self();
int /*<<< orphan*/ sleep(int);
void *print_message(void *ptr) {
  sleep(1);
  printf("Thread #:%ld \n", pthread_self());
}


x86 assembly (clang, -O0):
<print_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    %eax,%esi
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_message>:
push   %rax
mov    $0x1,%edi
call   1050 <sleep@plt>
xor    %eax,%eax
call   1040 <pthread_self@plt>
lea    0xeb7(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"Thread #:%ld \0A\00"
define i8* @print_message(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i32 @sleep(i32 1)
%5 = call i32 (...) @pthread_self()
%6 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i8*, i8** %2
ret i8* %7
}

LLVM IR (-O2):
@.str = [15 x i8] c"Thread #:%ld \0A\00"
define noalias i8* @print_message(i8* nocapture readnone %0) {
%2 = tail call i32 @sleep(i32 1)
%3 = tail call i32 (...) @pthread_self()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i8* undef
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
char *redhttp_strndup(const char *str1, size_t str1_len) {
  char *str2 = NULL;
  if (str1) {
    str2 = malloc(str1_len + 1);
    if (str2) {
      memcpy(str2, str1, str1_len);
      str2[str1_len] = '\0';
    }
  }
  return str2;
}


x86 assembly (clang, -O0):
<redhttp_strndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1181 <redhttp_strndup+0x61>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     117c <redhttp_strndup+0x5c>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1181 <redhttp_strndup+0x61>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<redhttp_strndup>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1156 <redhttp_strndup+0x36>
mov    %rsi,%r14
mov    %rdi,%r15
lea    0x1(%rsi),%rdi
call   1040 <malloc@plt>
test   %rax,%rax
je     1156 <redhttp_strndup+0x36>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <memcpy@plt>
movb   $0x0,(%rbx,%r14,1)
jmp    1158 <redhttp_strndup+0x38>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @redhttp_strndup(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
store i8* null, i8** %5
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %23
8: ; preds = %2
%9 = load i64, i64* %4
%10 = add i64 %9, 1
%11 = call i8* @malloc(i64 %10)
store i8* %11, i8** %5
%12 = load i8*, i8** %5
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %22
14: ; preds = %8
%15 = load i8*, i8** %5
%16 = load i8*, i8** %3
%17 = load i64, i64* %4
%18 = call i32 @memcpy(i8* %15, i8* %16, i64 %17)
%19 = load i8*, i8** %5
%20 = load i64, i64* %4
%21 = getelementptr inbounds i8, i8* %19, i64 %20
store i8 0, i8* %21
br label %22
22: ; preds = %14, %8
br label %23
23: ; preds = %22, %2
%24 = load i8*, i8** %5
ret i8* %24
}

LLVM IR (-O2):
define i8* @redhttp_strndup(i8* %0, i64 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = add i64 %1, 1
%6 = tail call i8* @malloc(i64 %5)
%7 = icmp eq i8* %6, null
br i1 %7, label %11, label %8
8: ; preds = %4
%9 = tail call i32 @memcpy(i8* %6, i8* %0, i64 %1)
%10 = getelementptr inbounds i8, i8* %6, i64 %1
store i8 0, i8* %10
br label %11
11: ; preds = %4, %8, %2
%12 = phi i8* [ %6, %8 ], [ null, %4 ], [ null, %2 ]
ret i8* %12
}
void av_strerror() {}


x86 assembly (clang, -O0):
<av_strerror>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<av_strerror>:
ret

LLVM IR (-O0):
define void @av_strerror() {
ret void
}

LLVM IR (-O2):
define void @av_strerror() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ShowMessage(char *);
void ClearScreen(void) { ShowMessage("\033[2J"); }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[2J\00"
define void @ClearScreen() {
%1 = tail call i32 @ShowMessage(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_cubes();
int /*<<< orphan*/ print_pythagorean_triples(int, int);
int main(void) {
  print_cubes();
  print_pythagorean_triples(1, 100);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <print_cubes@plt>
mov    $0x1,%edi
mov    $0x64,%esi
call   1030 <print_pythagorean_triples@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <print_cubes@plt>
mov    $0x1,%edi
mov    $0x64,%esi
call   1030 <print_pythagorean_triples@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @print_cubes()
%3 = call i32 @print_pythagorean_triples(i32 1, i32 100)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @print_cubes()
%2 = tail call i32 @print_pythagorean_triples(i32 1, i32 100)
ret i32 0
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int stat(char const *, struct stat *);
int test_file(const char *path) {
  struct stat test;
  if (stat(path, &test) == -1)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<test_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0xffffffff,%eax
jne    113e <test_file+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    1145 <test_file+0x35>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_file>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @test_file(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @stat(i8* %5, %struct.stat* %4)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %10
9: ; preds = %1
store i32 1, i32* %2
br label %10
10: ; preds = %9, %8
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @test_file(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @stat(i8* %0, %struct.stat* %2)
%5 = icmp ne i32 %4, -1
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void ShareFreeM1c(char *s) {
  if (s)
    free((void *)s);
  return;
}


x86 assembly (clang, -O0):
<ShareFreeM1c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <ShareFreeM1c+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ShareFreeM1c>:
test   %rdi,%rdi
je     111a <ShareFreeM1c+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @ShareFreeM1c(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @ShareFreeM1c(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
int foo(int x) { return x + 3; }


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

x86 assembly (clang, -O2):
<foo>:
lea    0x3(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = add nsw i32 %0, 3
ret i32 %2
}
int le(int x) { return x <= 0; }


x86 assembly (clang, -O0):
<le>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<le>:
xor    %eax,%eax
test   %edi,%edi
setle  %al
ret

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

LLVM IR (-O2):
define i32 @le(i32 %0) {
%2 = icmp slt i32 %0, 1
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int sd_peer_get_session(int fd,
                                                               char **session) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<sd_peer_get_session>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    0x2ecc(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_peer_get_session>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_peer_get_session(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* @EINVAL
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_peer_get_session(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @EINVAL
%4 = sub nsw i32 0, %3
ret i32 %4
}
int udev_queue_export_device_finished(struct udev_queue *udev_queue,
                                      struct udev_device *udev_device) {
  return -1;
}


x86 assembly (clang, -O0):
<udev_queue_export_device_finished>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.udev_queue = type opaque
%struct.udev_device = type opaque
define i32 @udev_queue_export_device_finished(%struct.udev_queue* %0, %struct.udev_device* %1) {
%3 = alloca %struct.udev_queue*
%4 = alloca %struct.udev_device*
store %struct.udev_queue* %0, %struct.udev_queue** %3
store %struct.udev_device* %1, %struct.udev_device** %4
ret i32 -1
}

LLVM IR (-O2):
%struct.udev_queue = type opaque
%struct.udev_device = type opaque
define i32 @udev_queue_export_device_finished(%struct.udev_queue* nocapture readnone %0, %struct.udev_device* nocapture readnone %1) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, unsigned int, unsigned int, char *);
void progress_indicator(char *subject, unsigned current, unsigned total,
                        char *comment) {
  printf("%s %u of %u -- Downloading: '%s'\n", subject, current, total,
         comment);
}


x86 assembly (clang, -O0):
<progress_indicator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%r8
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<progress_indicator>:
mov    %rcx,%r8
mov    %edx,%ecx
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xedf(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"%s %u of %u -- Downloading: '%s'\0A\00"
define void @progress_indicator(i8* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i8*, i8** %8
%13 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %9, i32 %10, i32 %11, i8* %12)
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"%s %u of %u -- Downloading: '%s'\0A\00"
define void @progress_indicator(i8* %0, i32 %1, i32 %2, i8* %3) {
%5 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i32 %2, i8* %3)
ret void
}