xunge/DecIR huggingface dataset:
/* Type definitions */
struct bi_tree {
  int dummy;
};

/* Variables and functions */
int bi_tree_size_api(struct bi_tree *);
unsigned bi_tree_size(struct bi_tree *bi) { return bi_tree_size_api(bi); }


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

x86 assembly (clang, -O2):
<bi_tree_size>:
jmp    1030 <bi_tree_size_api@plt>

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

LLVM IR (-O2):
%struct.bi_tree = type { i32 }
define i32 @bi_tree_size(%struct.bi_tree* %0) {
%2 = tail call i32 @bi_tree_size_api(%struct.bi_tree* %0)
ret i32 %2
}
/* Variables and functions */
float UnitRandFloat(unsigned int *);
float RandFloat(float min, float max, unsigned int *state) {
  return (UnitRandFloat(state) * (max - min) + min);
}


x86 assembly (clang, -O0):
<RandFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <UnitRandFloat@plt>
movss  -0x8(%rbp),%xmm2
subss  -0x4(%rbp),%xmm2
movss  -0x4(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandFloat>:
push   %rax
movss  %xmm1,0x4(%rsp)
movss  %xmm0,(%rsp)
call   1030 <UnitRandFloat@plt>
movss  (%rsp),%xmm1
movss  0x4(%rsp),%xmm2
subss  %xmm1,%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @RandFloat(float %0, float %1, i32* %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca i32*
store float %0, float* %4
store float %1, float* %5
store i32* %2, i32** %6
%7 = load i32*, i32** %6
%8 = call float @UnitRandFloat(i32* %7)
%9 = load float, float* %5
%10 = load float, float* %4
%11 = fsub float %9, %10
%12 = load float, float* %4
%13 = call float @llvm.fmuladd.f32(float %8, float %11, float %12)
ret float %13
}

LLVM IR (-O2):
define float @RandFloat(float %0, float %1, i32* %2) {
%4 = tail call float @UnitRandFloat(i32* %2)
%5 = fsub float %1, %0
%6 = tail call float @llvm.fmuladd.f32(float %4, float %5, float %0)
ret float %6
}
/* Variables and functions */
int do_tests(int);
int main(void) { return do_tests(23); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x17,%edi
call   1030 <do_tests@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x17,%edi
jmp    1030 <do_tests@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @do_tests(i32 23)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
void initlog(char *s) {
  print("\rINIT: ");
  print(s);
  print("\r\n");
}


x86 assembly (clang, -O0):
<initlog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
call   1030 <print@plt>
mov    -0x8(%rbp),%rdi
call   1030 <print@plt>
lea    0xed0(%rip),%rdi
call   1030 <print@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initlog>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
call   1030 <print@plt>
mov    %rbx,%rdi
call   1030 <print@plt>
lea    0xed9(%rip),%rdi
pop    %rbx
jmp    1030 <print@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"\0DINIT: \00"
@.str.1 = [3 x i8] c"\0D\0A\00"
define void @initlog(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @print(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @print(i8* %4)
%6 = call i32 @print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"\0DINIT: \00"
@.str.1 = [3 x i8] c"\0D\0A\00"
define void @initlog(i8* %0) {
%2 = tail call i32 @print(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @print(i8* %0)
%4 = tail call i32 @print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int _set_init_program(int /*<<< orphan*/, char *);
int libamg_process_stop_init_program(char *prog) {
  return _set_init_program(0, prog);
}


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

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

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

LLVM IR (-O2):
define i32 @libamg_process_stop_init_program(i8* %0) {
%2 = tail call i32 @_set_init_program(i32 0, i8* %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
struct passwd {
  int /*<<< orphan*/ pw_uid;
};

/* Variables and functions */
struct passwd *getpwnam(char const *);
int uid_from_user(uid_t *uid, const char *user) {
  struct passwd *pwd;
  pwd = getpwnam(user);
  if (pwd == NULL)
    return -1;
  *uid = pwd->pw_uid;
  return 0;
}


x86 assembly (clang, -O0):
<uid_from_user>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <getpwnam@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1144 <uid_from_user+0x34>
movl   $0xffffffff,-0x4(%rbp)
jmp    1157 <uid_from_user+0x47>
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uid_from_user>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <getpwnam@plt>
test   %rax,%rax
je     1129 <uid_from_user+0x19>
mov    (%rax),%eax
mov    %eax,(%rbx)
xor    %eax,%eax
pop    %rbx
ret
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.passwd = type { i32 }
define i32 @uid_from_user(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca %struct.passwd*
store i32* %0, i32** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %5
%8 = call %struct.passwd* @getpwnam(i8* %7)
store %struct.passwd* %8, %struct.passwd** %6
%9 = load %struct.passwd*, %struct.passwd** %6
%10 = icmp eq %struct.passwd* %9, null
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 -1, i32* %3
br label %17
12: ; preds = %2
%13 = load %struct.passwd*, %struct.passwd** %6
%14 = getelementptr inbounds %struct.passwd, %struct.passwd* %13, i32 0, i32 0
%15 = load i32, i32* %14
%16 = load i32*, i32** %4
store i32 %15, i32* %16
store i32 0, i32* %3
br label %17
17: ; preds = %12, %11
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
%struct.passwd = type { i32 }
define i32 @uid_from_user(i32* nocapture writeonly %0, i8* nocapture %1) {
%3 = tail call %struct.passwd* @getpwnam(i8* %1)
%4 = icmp eq %struct.passwd* %3, null
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = getelementptr inbounds %struct.passwd, %struct.passwd* %3, i64 0, i32 0
%7 = load i32, i32* %6
store i32 %7, i32* %0
br label %8
8: ; preds = %2, %5
%9 = phi i32 [ 0, %5 ], [ -1, %2 ]
ret i32 %9
}
/* Variables and functions */
int bits;
int random();
int x;
int get_bit() {
  int bit;
  static bits = 0;
  static x;
  if (bits == 0) {
    x = random();
    bits = 31;
  }
  bit = x & 1;
  x = x >> 1;
  bits--;
  return bit;
}


x86 assembly (clang, -O0):
<get_bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
cmpl   $0x0,0x2f0d(%rip)
jne    113c <get_bit+0x2c>
mov    $0x0,%al
call   1030 <random@plt>
mov    %eax,0x2efe(%rip)
movl   $0x1f,0x2ef0(%rip)
mov    0x2eee(%rip),%eax
and    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    0x2ee2(%rip),%eax
sar    $0x1,%eax
mov    %eax,0x2ed9(%rip)
mov    0x2ecf(%rip),%eax
add    $0xffffffff,%eax
mov    %eax,0x2ec6(%rip)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_bit>:
push   %rax
mov    0x2f15(%rip),%edx
test   %edx,%edx
je     1126 <get_bit+0x16>
mov    0x2f0f(%rip),%eax
add    $0xffffffff,%edx
jmp    1132 <get_bit+0x22>
xor    %eax,%eax
call   1030 <random@plt>
mov    $0x1e,%edx
mov    %eax,%ecx
and    $0x1,%ecx
sar    %eax
mov    %eax,0x2ef1(%rip)
mov    %edx,0x2ee7(%rip)
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@get_bit.bits = internal global i32 0
@get_bit.x = internal global i32 0
@bits = global i32 0
@x = global i32 0
define i32 @get_bit() {
%1 = alloca i32
%2 = load i32, i32* @get_bit.bits
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @random()
store i32 %5, i32* @get_bit.x
store i32 31, i32* @get_bit.bits
br label %6
6: ; preds = %4, %0
%7 = load i32, i32* @get_bit.x
%8 = and i32 %7, 1
store i32 %8, i32* %1
%9 = load i32, i32* @get_bit.x
%10 = ashr i32 %9, 1
store i32 %10, i32* @get_bit.x
%11 = load i32, i32* @get_bit.bits
%12 = add nsw i32 %11, -1
store i32 %12, i32* @get_bit.bits
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@get_bit.bits = internal unnamed_addr global i32 0
@get_bit.x = internal unnamed_addr global i32 0
@bits = global i32 0
@x = global i32 0
define i32 @get_bit() {
%1 = load i32, i32* @get_bit.bits
%2 = icmp eq i32 %1, 0
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = load i32, i32* @get_bit.x
%5 = add i32 %1, -1
br label %8
6: ; preds = %0
%7 = tail call i32 (...) @random()
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ %5, %3 ], [ 30, %6 ]
%10 = phi i32 [ %4, %3 ], [ %7, %6 ]
%11 = and i32 %10, 1
%12 = ashr i32 %10, 1
store i32 %12, i32* @get_bit.x
store i32 %9, i32* @get_bit.bits
ret i32 %11
}
/* Variables and functions */
int strcmp(void const *, void const *);
int str_cmp(const void *a, const void *b) {
  return strcmp((const void *)a, (const void *)b);
}


x86 assembly (clang, -O0):
<str_cmp>:
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):
<str_cmp>:
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @str_cmp(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 @str_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
unsigned char b_input_key(void) {
  unsigned char chr;
  asm volatile("call *0x00100028" : "=a"(chr));
  return chr;
}


x86 assembly (clang, -O0):
<b_input_key>:
push   %rbp
mov    %rsp,%rbp
call   *0x100028
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<b_input_key>:
call   *0x100028
ret

LLVM IR (-O0):
define zeroext i8 @b_input_key() {
%1 = alloca i8
%2 = call i8 asm sideeffect "call *0x00100028", "={ax},~{dirflag},~{fpsr},~{flags}"()
store i8 %2, i8* %1
%3 = load i8, i8* %1
ret i8 %3
}

LLVM IR (-O2):
define zeroext i8 @b_input_key() {
%1 = tail call i8 asm sideeffect "call *0x00100028", "={ax},~{dirflag},~{fpsr},~{flags}"()
ret i8 %1
}
int quantity_tri(int times) {
  if (times < 2) {
    return 0;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<quantity_tri>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    111d <quantity_tri+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1124 <quantity_tri+0x24>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<quantity_tri>:
xor    %eax,%eax
cmp    $0x2,%edi
setge  %al
ret

LLVM IR (-O0):
define i32 @quantity_tri(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 2
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %8
7: ; preds = %1
store i32 1, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @quantity_tri(i32 %0) {
%2 = icmp sgt i32 %0, 1
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ strcmp(char const *, char const *);
int bas_match(const void *str1, const void *str2) {
  return !strcmp((const char *)str1, (const char *)str2);
}


x86 assembly (clang, -O0):
<bas_match>:
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>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @bas_match(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)
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @bas_match(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ main();
void _start() { exit(main()); }


x86 assembly (clang, -O0):
<_start>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <main@plt>
mov    %eax,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<_start>:
push   %rax
xor    %eax,%eax
call   1030 <main@plt>
mov    %eax,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @_start() {
%1 = call i32 (...) @main()
%2 = call i32 @exit(i32 %1)
unreachable
}

LLVM IR (-O2):
define void @_start() {
%1 = tail call i32 (...) @main()
%2 = tail call i32 @exit(i32 %1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ str;

/* Variables and functions */
size_t lfind(const char *str, const char accept) {
  size_t i = 0;
  while (str[i] != accept) {
    i++;
  }
  return (size_t)(str) + i;
}


x86 assembly (clang, -O0):
<lfind>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
je     113f <lfind+0x3f>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1116 <lfind+0x16>
mov    -0x8(%rbp),%rax
add    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lfind>:
lea    -0x1(%rdi),%rax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rax
lea    0x1(%rdi),%rcx
cmp    %sil,(%rdi)
mov    %rcx,%rdi
jne    1110 <lfind+0x10>
ret

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

LLVM IR (-O2):
define i64 @lfind(i8* %0, i8 signext %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ 0, %2 ], [ %8, %3 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, %1
%8 = add i64 %4, 1
br i1 %7, label %9, label %3
9: ; preds = %3
%10 = ptrtoint i8* %0 to i64
%11 = add i64 %4, %10
ret i64 %11
}
/* Variables and functions */
int strlen(char *a) {
  int i = 0;
  while (a[i] != '\0') {
    i++;
  }
  return i;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1132 <strlen+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <strlen+0x10>
ret

LLVM IR (-O0):
define i32 @strlen(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %1
%5 = load i8*, i8** %2
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %4
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ dlfree(void *);
void cfree(void *mem) { dlfree(mem); }


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

x86 assembly (clang, -O2):
<cfree>:
jmp    1030 <dlfree@plt>

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

LLVM IR (-O2):
define void @cfree(i8* %0) {
%2 = tail call i32 @dlfree(i8* %0)
ret void
}
void SysCtlEnableAERRNMI(void) {
  unsigned long ulMWRAllow;
  ulMWRAllow = (*((volatile unsigned long *)(0x400FB980)));
  (*((volatile unsigned long *)(0x400FB980))) = 0xA5A5A5A5;
  (*((volatile unsigned long *)(0x400FBA00 + 0x00000000))) = (0x00000200);
  (*((volatile unsigned long *)(0x400FB980))) = ulMWRAllow;
}


x86 assembly (clang, -O0):
<SysCtlEnableAERRNMI>:
push   %rbp
mov    %rsp,%rbp
mov    $0x400fb980,%eax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
mov    $0x400fb980,%eax
mov    $0xa5a5a5a5,%ecx
mov    %rcx,(%rax)
mov    $0x400fba00,%eax
movq   $0x200,(%rax)
mov    -0x8(%rbp),%rcx
mov    $0x400fb980,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlEnableAERRNMI>:
mov    0x400fb980,%rax
40
mov    $0xa5a5a5a5,%ecx
mov    %rcx,0x400fb980
40
movq   $0x200,0x400fba00
mov    %rax,0x400fb980
40
ret

LLVM IR (-O0):
define void @SysCtlEnableAERRNMI() {
%1 = alloca i64
%2 = load volatile i64, i64* inttoptr (i64 1074772352 to i64*)
store i64 %2, i64* %1
store volatile i64 2779096485, i64* inttoptr (i64 1074772352 to i64*)
store volatile i64 512, i64* inttoptr (i64 1074772480 to i64*)
%3 = load i64, i64* %1
store volatile i64 %3, i64* inttoptr (i64 1074772352 to i64*)
ret void
}

LLVM IR (-O2):
define void @SysCtlEnableAERRNMI() {
%1 = load volatile i64, i64* inttoptr (i64 1074772352 to i64*)
store volatile i64 2779096485, i64* inttoptr (i64 1074772352 to i64*)
store volatile i64 512, i64* inttoptr (i64 1074772480 to i64*)
store volatile i64 %1, i64* inttoptr (i64 1074772352 to i64*)
ret void
}
void main_foo() {}


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

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

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

LLVM IR (-O2):
define void @main_foo() {
ret void
}
int mod(k, m)
int k, m;
{ return (k % m); }


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

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

LLVM IR (-O0):
define i32 @mod(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 = srem i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @mod(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
ret i32 %3
}
unsigned char f24(unsigned char x, long int y) {
  return (x >> ((-y) & (8 - 1))) ^ (x << y);
}


x86 assembly (clang, -O0):
<f24>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movzbl -0x1(%rbp),%eax
xor    %ecx,%ecx
sub    -0x10(%rbp),%rcx
and    $0x7,%rcx
sar    %cl,%eax
movzbl -0x1(%rbp),%edx
mov    -0x10(%rbp),%rcx
shl    %cl,%edx
mov    %edx,%ecx
xor    %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f24>:
mov    %esi,%ecx
neg    %cl
and    $0x7,%cl
mov    %edi,%eax
shr    %cl,%eax
mov    %esi,%ecx
shl    %cl,%edi
xor    %edi,%eax
ret

LLVM IR (-O0):
define zeroext i8 @f24(i8 zeroext %0, i64 %1) {
%3 = alloca i8
%4 = alloca i64
store i8 %0, i8* %3
store i64 %1, i64* %4
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = load i64, i64* %4
%8 = sub nsw i64 0, %7
%9 = and i64 %8, 7
%10 = trunc i64 %9 to i32
%11 = ashr i32 %6, %10
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = load i64, i64* %4
%15 = trunc i64 %14 to i32
%16 = shl i32 %13, %15
%17 = xor i32 %11, %16
%18 = trunc i32 %17 to i8
ret i8 %18
}

LLVM IR (-O2):
define zeroext i8 @f24(i8 zeroext %0, i64 %1) {
%3 = zext i8 %0 to i32
%4 = trunc i64 %1 to i32
%5 = sub i32 0, %4
%6 = and i32 %5, 7
%7 = lshr i32 %3, %6
%8 = shl i32 %3, %4
%9 = xor i32 %7, %8
%10 = trunc i32 %9 to i8
ret i8 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ ret;

/* Variables and functions */
int /*<<< orphan*/ readn(int, unsigned long long *, int);
unsigned long long read_ull(int fd) {
  unsigned long long ret;
  readn(fd, &ret, sizeof(ret));
  return ret;
}


x86 assembly (clang, -O0):
<read_ull>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1030 <readn@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_ull>:
push   %rax
mov    %rsp,%rsi
mov    $0x8,%edx
call   1030 <readn@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @read_ull(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @readn(i32 %4, i64* %3, i32 8)
%6 = load i64, i64* %3
ret i64 %6
}

LLVM IR (-O2):
define i64 @read_ull(i32 %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
%4 = call i32 @readn(i32 %0, i64* %2, i32 8)
%5 = load i64, i64* %2
ret i64 %5
}
void DeviceClose() {}


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

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

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

LLVM IR (-O2):
define void @DeviceClose() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() { fprintf(stderr, "Usage: pretty file ...\n"); }


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"Usage: pretty file ...\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"Usage: pretty file ...\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main() {
  int i = 0;
  while (1) {
    for (i = 0; i < 25000000; i++)
      ;
    puts("Hello World !\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x17d7840,-0x8(%rbp)
jge    114d <main+0x3d>
jmp    113f <main+0x2f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
jmp    1126 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <puts@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
@.str = [15 x i8] c"Hello World !\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %0, %11
store i32 0, i32* %2
br label %4
4: ; preds = %8, %3
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 25000000
br i1 %6, label %7, label %11
7: ; preds = %4
br label %8
8: ; preds = %7
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
store i32 %10, i32* %2
br label %4
11: ; preds = %4
%12 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %3
}

LLVM IR (-O2):
@.str = [15 x i8] c"Hello World !\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %1
}
void RTSemXRoadsDestroy(void) {}


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

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

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

LLVM IR (-O2):
define void @RTSemXRoadsDestroy() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exitWrapper();
void checker2(int *toCheck2) {
  if (!toCheck2) {
    exitWrapper();
  }
  return;
}


x86 assembly (clang, -O0):
<checker2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112e <checker2+0x1e>
mov    $0x0,%al
call   1030 <exitWrapper@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checker2>:
test   %rdi,%rdi
je     1116 <checker2+0x6>
ret
xor    %eax,%eax
jmp    1030 <exitWrapper@plt>

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

LLVM IR (-O2):
define void @checker2(i32* readnone %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @exitWrapper()
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_pfx(char const *);
int /*<<< orphan*/ printf(char *);
void print_dir(const char *path) {
  printf("  ");
  print_pfx(path);
  printf("\n");
}


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

x86 assembly (clang, -O2):
<print_dir>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <print_pfx@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c" \00"
define void @print_dir(i8* %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @print_pfx(i8* %0)
%4 = tail call i32 @putchar(i32 10)
ret void
}
void fild_DisableModemPowerControl(void) {}


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

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

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

LLVM IR (-O2):
define void @fild_DisableModemPowerControl() {
ret void
}
int rpi_car_dev_open() {
  int dev = -1;
  dev = 0;
  return dev;
}


x86 assembly (clang, -O0):
<rpi_car_dev_open>:
push   %rbp
mov    %rsp,%rbp
movl   $0xffffffff,-0x4(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rpi_car_dev_open>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @rpi_car_dev_open() {
%1 = alloca i32
store i32 -1, i32* %1
store i32 0, i32* %1
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @rpi_car_dev_open() {
ret i32 0
}
/* Variables and functions */
scalar_t__ unknown(int);
void unknown_with_different_values_bad() {
  int *p = NULL;
  if (unknown(32) != unknown(52)) {
    *p = 42;
  }
}


x86 assembly (clang, -O0):
<unknown_with_different_values_bad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    $0x20,%edi
call   1030 <unknown@plt>
mov    %rax,-0x10(%rbp)
mov    $0x34,%edi
call   1030 <unknown@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
je     1152 <unknown_with_different_values_bad+0x42>
mov    -0x8(%rbp),%rax
movl   $0x2a,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unknown_with_different_values_bad>:
push   %rax
mov    $0x20,%edi
call   1030 <unknown@plt>
mov    $0x34,%edi
pop    %rax
jmp    1030 <unknown@plt>

LLVM IR (-O0):
define void @unknown_with_different_values_bad() {
%1 = alloca i32*
store i32* null, i32** %1
%2 = call i64 @unknown(i32 32)
%3 = call i64 @unknown(i32 52)
%4 = icmp ne i64 %2, %3
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = load i32*, i32** %1
store i32 42, i32* %6
br label %7
7: ; preds = %5, %0
ret void
}

LLVM IR (-O2):
define void @unknown_with_different_values_bad() {
%1 = tail call i64 @unknown(i32 32)
%2 = tail call i64 @unknown(i32 52)
%3 = icmp eq i64 %1, %2
tail call void @llvm.assume(i1 %3)
ret void
}
/* Variables and functions */
float log(float);
float spb_log2f(float a) { return log(a) / log(2.f); }


x86 assembly (clang, -O0):
<spb_log2f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <log@plt>
movss  %xmm0,-0x8(%rbp)
movss  0xecc(%rip),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
divss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spb_log2f>:
push   %rax
call   1030 <log@plt>
divss  0xee2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @spb_log2f(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @log(float %3)
%5 = call float @log(float 2.000000e+00)
%6 = fdiv float %4, %5
ret float %6
}

LLVM IR (-O2):
define float @spb_log2f(float %0) {
%2 = tail call float @log(float %0)
%3 = fdiv float %2, 0x3FE62E4300000000
ret float %3
}
int main(void) {
  int A[] = {1, 2, 3, 4, 5, 6, 7};
  printf("%d\n", A[5]);
  printf("%d\n", 5 [A]);
  printf("%d\n", *(5 + A));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed2(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.A = [7 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i32]
store i32 0, i32* %1
%3 = bitcast [7 x i32]* %2 to i8*
%4 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 5
%5 = load i32, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 5
%8 = load i32, i32* %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%11 = getelementptr inbounds i32, i32* %10, i64 5
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 6)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 6)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ M_Menu_LoadGame_f();
void LoadGameFunc(void *unused) { M_Menu_LoadGame_f(); }


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

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

LLVM IR (-O0):
define void @LoadGameFunc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @M_Menu_LoadGame_f()
ret void
}

LLVM IR (-O2):
define void @LoadGameFunc(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @M_Menu_LoadGame_f()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr,
          "Atheros driver control\n"
          "Copyright (c) 2002-2004 Gunter Burchardt, Local-Web AG\n"
          "\n"
          "usage: athctrl [-i interface] [-d distance]\n"
          "\n"
          "options:\n"
          "   -h   show this usage\n"
          "   -i   interface (default interface is wifi0)\n"
          "   -d   specify the maximum distance of a sta or the distance\n"
          "        of the master\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [289 x i8] c"Atheros driver control\0ACopyright (c) 2002-2004 Gunter Burchardt, Local-Web AG\0A\0Ausage: athctrl [-i interface] [-d distance]\0A\0Aoptions:\0A -h show this usage\0A -i interface (default interface is wifi0)\0A -d specify the maximum distance of a sta or the distance\0A of the master\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([289 x i8], [289 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [289 x i8] c"Atheros driver control\0ACopyright (c) 2002-2004 Gunter Burchardt, Local-Web AG\0A\0Ausage: athctrl [-i interface] [-d distance]\0A\0Aoptions:\0A -h show this usage\0A -i interface (default interface is wifi0)\0A -d specify the maximum distance of a sta or the distance\0A of the master\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([289 x i8], [289 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ set_cpu_speed();
int /*<<< orphan*/ test_enc_deblock_speed();
int /*<<< orphan*/ test_enc_interpolate_speed();
int /*<<< orphan*/ test_enc_me_speed();
int /*<<< orphan*/ unlimit_stack();
int main() {
  set_cpu_speed();
  unlimit_stack();
  test_enc_me_speed();
  test_enc_deblock_speed();
  test_enc_interpolate_speed();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <set_cpu_speed@plt>
mov    $0x0,%al
call   1030 <unlimit_stack@plt>
mov    $0x0,%al
call   1040 <test_enc_me_speed@plt>
mov    $0x0,%al
call   1060 <test_enc_deblock_speed@plt>
mov    $0x0,%al
call   1070 <test_enc_interpolate_speed@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <set_cpu_speed@plt>
xor    %eax,%eax
call   1030 <unlimit_stack@plt>
xor    %eax,%eax
call   1040 <test_enc_me_speed@plt>
xor    %eax,%eax
call   1060 <test_enc_deblock_speed@plt>
xor    %eax,%eax
call   1070 <test_enc_interpolate_speed@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @set_cpu_speed()
%3 = call i32 (...) @unlimit_stack()
%4 = call i32 (...) @test_enc_me_speed()
%5 = call i32 (...) @test_enc_deblock_speed()
%6 = call i32 (...) @test_enc_interpolate_speed()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @set_cpu_speed()
%2 = tail call i32 (...) @unlimit_stack()
%3 = tail call i32 (...) @test_enc_me_speed()
%4 = tail call i32 (...) @test_enc_deblock_speed()
%5 = tail call i32 (...) @test_enc_interpolate_speed()
ret i32 0
}
/* Variables and functions */
bool is_oct_digit(char c) { return (c >= '0' && c <= '7'); }


x86 assembly (clang, -O0):
<is_oct_digit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <is_oct_digit+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x37,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_oct_digit>:
and    $0xf8,%dil
xor    %eax,%eax
cmp    $0x30,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @is_oct_digit(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 55
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @is_oct_digit(i8 signext %0) {
%2 = and i8 %0, -8
%3 = icmp eq i8 %2, 48
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int int32_t;
typedef int int16_t;

/* Variables and functions */
int PQCLEAN_KYBER512_CLEAN_montgomery_reduce(int);
int16_t fqmul(int16_t a, int16_t b) {
  return PQCLEAN_KYBER512_CLEAN_montgomery_reduce((int32_t)a * b);
}


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

x86 assembly (clang, -O2):
<fqmul>:
imul   %esi,%edi
jmp    1030 <PQCLEAN_KYBER512_CLEAN_montgomery_reduce@plt>

LLVM IR (-O0):
define i32 @fqmul(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 = mul nsw i32 %5, %6
%8 = call i32 @PQCLEAN_KYBER512_CLEAN_montgomery_reduce(i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @fqmul(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = tail call i32 @PQCLEAN_KYBER512_CLEAN_montgomery_reduce(i32 %3)
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int /*<<< orphan*/ umask(int /*<<< orphan*/);
mode_t read_umask(void) {
  mode_t mask = umask(0);
  umask(mask);
  return mask;
}


x86 assembly (clang, -O0):
<read_umask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1030 <umask@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <umask@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_umask>:
push   %rbx
xor    %edi,%edi
call   1030 <umask@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1030 <umask@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @read_umask() {
%1 = tail call i32 @umask(i32 0)
%2 = tail call i32 @umask(i32 %1)
ret i32 %1
}
/* Variables and functions */
int syscall_cp(int, int);
int close(int fd) { return syscall_cp(3, fd); }


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

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

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

LLVM IR (-O2):
define i32 @close(i32 %0) {
%2 = tail call i32 @syscall_cp(i32 3, i32 %0)
ret i32 %2
}
/* Type definitions */
struct strarray {
  int dummy;
};
struct const_strarray {
  int dummy;
};

/* Variables and functions */
char const *strarray_get(struct strarray const *, size_t);
__attribute__((always_)) const char *
strarray_get_c(const struct const_strarray *array, size_t idx) {
  return strarray_get((const struct strarray *)array, idx);
}


x86 assembly (clang, -O0):
<strarray_get_c>:
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 <strarray_get@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strarray_get_c>:
jmp    1030 <strarray_get@plt>

LLVM IR (-O0):
%struct.const_strarray = type { i32 }
%struct.strarray = type { i32 }
define i8* @strarray_get_c(%struct.const_strarray* %0, i64 %1) {
%3 = alloca %struct.const_strarray*
%4 = alloca i64
store %struct.const_strarray* %0, %struct.const_strarray** %3
store i64 %1, i64* %4
%5 = load %struct.const_strarray*, %struct.const_strarray** %3
%6 = bitcast %struct.const_strarray* %5 to %struct.strarray*
%7 = load i64, i64* %4
%8 = call i8* @strarray_get(%struct.strarray* %6, i64 %7)
ret i8* %8
}

LLVM IR (-O2):
%struct.const_strarray = type { i32 }
%struct.strarray = type { i32 }
define i8* @strarray_get_c(%struct.const_strarray* %0, i64 %1) {
%3 = bitcast %struct.const_strarray* %0 to %struct.strarray*
%4 = tail call i8* @strarray_get(%struct.strarray* %3, i64 %1)
ret i8* %4
}
void mapped_count(struct page *page, int to_map) {}


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

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

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

LLVM IR (-O2):
%struct.page = type opaque
define void @mapped_count(%struct.page* nocapture %0, i32 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
scalar_t__ difftime(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
long GetSleepTime(time_t sleep) {
  while (1) {
    long sleepTime = (long)difftime(sleep, time(NULL));
    if (sleepTime > 10800 || sleepTime < -10800) {
      return -1;
    }
    return (sleepTime > 0 ? sleepTime : 0);
  }
}


x86 assembly (clang, -O0):
<GetSleepTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%esi
call   1030 <difftime@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x2a30,-0x18(%rbp)
jg     1164 <GetSleepTime+0x44>
cmpq   $0xffffffffffffd5d0,-0x18(%rbp)
ff
jge    1171 <GetSleepTime+0x51>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    119c <GetSleepTime+0x7c>
cmpq   $0x0,-0x18(%rbp)
jle    1189 <GetSleepTime+0x69>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    1194 <GetSleepTime+0x74>
xor    %eax,%eax
mov    %rax,-0x28(%rbp)
jmp    1194 <GetSleepTime+0x74>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetSleepTime>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %r14d,%r14d
xor    %edi,%edi
call   1040 <time@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <difftime@plt>
lea    -0x2a31(%rax),%rcx
test   %rax,%rax
cmovs  %r14,%rax
cmp    $0xffffffffffffab9f,%rcx
mov    $0xffffffffffffffff,%rcx
cmovb  %rcx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @GetSleepTime(i32 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
br label %5
5: ; preds = %1
%6 = load i32, i32* %3
%7 = call i32 @time(i32* null)
%8 = call i64 @difftime(i32 %6, i32 %7)
store i64 %8, i64* %4
%9 = load i64, i64* %4
%10 = icmp sgt i64 %9, 10800
br i1 %10, label %14, label %11
11: ; preds = %5
%12 = load i64, i64* %4
%13 = icmp slt i64 %12, -10800
br i1 %13, label %14, label %15
14: ; preds = %11, %5
store i64 -1, i64* %2
br label %23
15: ; preds = %11
%16 = load i64, i64* %4
%17 = icmp sgt i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = load i64, i64* %4
br label %21
20: ; preds = %15
br label %21
21: ; preds = %20, %18
%22 = phi i64 [ %19, %18 ], [ 0, %20 ]
store i64 %22, i64* %2
br label %23
23: ; preds = %21, %14
%24 = load i64, i64* %2
ret i64 %24
}

LLVM IR (-O2):
define i64 @GetSleepTime(i32 %0) {
%2 = tail call i32 @time(i32* null)
%3 = tail call i64 @difftime(i32 %0, i32 %2)
%4 = add i64 %3, -10801
%5 = icmp ult i64 %4, -21601
%6 = icmp sgt i64 %3, 0
%7 = select i1 %6, i64 %3, i64 0
%8 = select i1 %5, i64 -1, i64 %7
ret i64 %8
}
int test_imm_DBuint16_reg(unsigned short val) {
  return ((val) & (0xDB << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_DBuint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xdb,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_DBuint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, 219
%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_DBuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 219
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}