xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ u_int16_t;
typedef int /*<<< orphan*/ tmp;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ ntohs(int /*<<< orphan*/);
u_int16_t untoh16(void *network) {
  char *unaligned = (char *)network;
  u_int16_t tmp;
  memcpy(&tmp, unaligned, sizeof(tmp));
  return ntohs(tmp);
}


x86 assembly (clang, -O0):
<untoh16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0x14(%rbp),%edi
call   1040 <ntohs@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<untoh16>:
push   %rax
mov    %rdi,%rsi
lea    0x4(%rsp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    0x4(%rsp),%edi
call   1040 <ntohs@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @untoh16(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @memcpy(i32* %4, i8* %6, i32 4)
%8 = load i32, i32* %4
%9 = call i32 @ntohs(i32 %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @untoh16(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @memcpy(i32* %2, i8* %0, i32 4)
%5 = load i32, i32* %2
%6 = call i32 @ntohs(i32 %5)
ret i32 %6
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int solcon_retrieve_next_dobldobl_initialize(void) {
  int a, *b, fail;
  double *c;
  a = 0;
  fail = _ada_use_c2phc(277, &a, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<solcon_retrieve_next_dobldobl_initialize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x115,%edi
lea    -0x4(%rbp),%rsi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solcon_retrieve_next_dobldobl_initialize>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x115,%edi
call   1030 <_ada_use_c2phc@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @solcon_retrieve_next_dobldobl_initialize() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
store i32 0, i32* %1
%5 = load i32*, i32** %2
%6 = load double*, double** %4
%7 = call i32 @_ada_use_c2phc(i32 277, i32* %1, i32* %5, double* %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @solcon_retrieve_next_dobldobl_initialize() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @_ada_use_c2phc(i32 277, i32* %1, i32* undef, double* undef)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int i, j;
  j = 1 + 2;
  printf("hello %d\n", j);
  return 2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x3,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x2,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [10 x i8] c"hello %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 3)
ret i32 2
}
/* Variables and functions */
int strcmp(char const *const, char const *const);
int strcoll(const char *const s1, const char *const s2) {
  return strcmp(s1, s2);
}


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

LLVM IR (-O0):
define i32 @strcoll(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 @strcoll(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ ltr_1();
int /*<<< orphan*/ ltr_2();
int /*<<< orphan*/ ltr_3();
int main() {
  ltr_1();
  ltr_2();
  ltr_3();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @ltr_1()
%2 = tail call i32 (...) @ltr_2()
%3 = tail call i32 (...) @ltr_3()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ BNCIO(int);
long int BNCFunction() {
  long int stat = 99;
  BNCIO(21);
  return (stat);
}


x86 assembly (clang, -O0):
<BNCFunction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x63,-0x8(%rbp)
mov    $0x15,%edi
call   1030 <BNCIO@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BNCFunction>:
push   %rax
mov    $0x15,%edi
call   1030 <BNCIO@plt>
mov    $0x63,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @BNCFunction() {
%1 = alloca i64
store i64 99, i64* %1
%2 = call i32 @BNCIO(i32 21)
%3 = load i64, i64* %1
ret i64 %3
}

LLVM IR (-O2):
define i64 @BNCFunction() {
%1 = tail call i32 @BNCIO(i32 21)
ret i64 99
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int open(char *, int /*<<< orphan*/);
scalar_t__ setns(int, int /*<<< orphan*/);
int main(void) {
  int fd;
  int rc = 0;
  fd = open("/proc/self/ns/uts", O_RDONLY);
  if (fd < 0)
    return 1;
  if (setns(fd, 0) < 0)
    rc = 1;
  (void)close(fd);
  return rc;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%esi
lea    0xeaa(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1174 <main+0x44>
movl   $0x1,-0x4(%rbp)
jmp    119d <main+0x6d>
mov    -0x8(%rbp),%edi
xor    %esi,%esi
call   1030 <setns@plt>
cmp    $0x0,%rax
jge    118f <main+0x5f>
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <close@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    0x2eae(%rip),%rax
mov    (%rax),%esi
lea    0xebd(%rip),%rdi
call   1050 <open@plt>
test   %eax,%eax
js     1167 <main+0x37>
mov    %eax,%ebp
mov    %eax,%edi
xor    %esi,%esi
call   1030 <setns@plt>
mov    %rax,%rbx
shr    $0x3f,%rbx
mov    %ebp,%edi
call   1040 <close@plt>
jmp    116c <main+0x3c>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"/proc/self/ns/uts\00"
@O_RDONLY = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = load i32, i32* @O_RDONLY
%5 = call i32 @open(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %4)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %0
store i32 1, i32* %1
br label %18
9: ; preds = %0
%10 = load i32, i32* %2
%11 = call i64 @setns(i32 %10, i32 0)
%12 = icmp slt i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %9
store i32 1, i32* %3
br label %14
14: ; preds = %13, %9
%15 = load i32, i32* %2
%16 = call i32 @close(i32 %15)
%17 = load i32, i32* %3
store i32 %17, i32* %1
br label %18
18: ; preds = %14, %8
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@.str = [18 x i8] c"/proc/self/ns/uts\00"
@O_RDONLY = global i32 0
define i32 @main() {
%1 = load i32, i32* @O_RDONLY
%2 = tail call i32 @open(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp slt i32 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %0
%5 = tail call i64 @setns(i32 %2, i32 0)
%6 = lshr i64 %5, 63
%7 = trunc i64 %6 to i32
%8 = tail call i32 @close(i32 %2)
br label %9
9: ; preds = %0, %4
%10 = phi i32 [ %7, %4 ], [ 1, %0 ]
ret i32 %10
}
void fpu_init(void) {
  const unsigned default_mxcsr = 0x1f80;
  __asm__ __volatile__("ldmxcsr %0" : : "m"(default_mxcsr));
}


x86 assembly (clang, -O0):
<fpu_init>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1f80,-0x4(%rbp)
ldmxcsr -0x4(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fpu_init>:
movl   $0x1f80,-0x4(%rsp)
ldmxcsr -0x4(%rsp)
ret

LLVM IR (-O0):
define void @fpu_init() {
%1 = alloca i32
store i32 8064, i32* %1
ret void
}

LLVM IR (-O2):
define void @fpu_init() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 8064, i32* %1
ret void
}
int stk_overrun() {
  int stack_array[100];
  stack_array[1] = 0;
  return stack_array[200];
}


x86 assembly (clang, -O0):
<stk_overrun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x18c(%rbp)
mov    0x190(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @stk_overrun() {
%1 = alloca [100 x i32]
%2 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 1
store i32 0, i32* %2
%3 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 200
%4 = load i32, i32* %3
ret i32 %4
}

LLVM IR (-O2):
define i32 @stk_overrun() {
ret i32 poison
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  printf("app %s\n", "12:42:36");
  return (0);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xee9(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"app %s\0A\00"
@.str.1 = [9 x i8] c"12:42:36\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"app %s\0A\00"
@.str.1 = [9 x i8] c"12:42:36\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct nlattr {
  int dummy;
};

/* Variables and functions */
uint32_t nla_read_u32(const struct nlattr *nla) {
  return *(uint32_t *)(nla + 1);
}


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

x86 assembly (clang, -O2):
<nla_read_u32>:
mov    0x4(%rdi),%eax
ret

LLVM IR (-O0):
%struct.nlattr = type { i32 }
define i32 @nla_read_u32(%struct.nlattr* %0) {
%2 = alloca %struct.nlattr*
store %struct.nlattr* %0, %struct.nlattr** %2
%3 = load %struct.nlattr*, %struct.nlattr** %2
%4 = getelementptr inbounds %struct.nlattr, %struct.nlattr* %3, i64 1
%5 = bitcast %struct.nlattr* %4 to i32*
%6 = load i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
%struct.nlattr = type { i32 }
define i32 @nla_read_u32(%struct.nlattr* nocapture %0) {
%2 = getelementptr inbounds %struct.nlattr, %struct.nlattr* %0, i64 1, i32 0
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ test_first_diff();
int /*<<< orphan*/ test_precision();
int main(int argc, char **argv) {
  test_precision();
  test_first_diff();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <test_precision@plt>
mov    $0x0,%al
call   1030 <test_first_diff@plt>
mov    0x2e95(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <test_precision@plt>
xor    %eax,%eax
call   1030 <test_first_diff@plt>
mov    0x2eaa(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @test_precision()
%7 = call i32 (...) @test_first_diff()
%8 = load i32, i32* @EXIT_SUCCESS
ret i32 %8
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test_precision()
%4 = tail call i32 (...) @test_first_diff()
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}
int quit_handler(char **save, int *repeats_left) {
  (void)save;
  (void)repeats_left;
  return 1;
}


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

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

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

LLVM IR (-O2):
define i32 @quit_handler(i8** nocapture readnone %0, i32* nocapture readnone %1) {
ret i32 1
}
char *strchrnul(const char *s, char c) {
  while (*s != '\0') {
    if (*s == c) {
      return (char *)s;
    }
    s++;
  }
  return (char *)s;
}


x86 assembly (clang, -O0):
<strchrnul>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     114f <strchrnul+0x4f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    113e <strchrnul+0x3e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1157 <strchrnul+0x57>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110e <strchrnul+0xe>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchrnul>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
je     1121 <strchrnul+0x21>
cmp    %sil,%cl
jne    1110 <strchrnul+0x10>
ret

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

LLVM IR (-O2):
define i8* @strchrnul(i8* %0, i8 signext %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %9, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = icmp eq i8 %5, %1
%8 = or i1 %6, %7
%9 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %8, label %10, label %3
10: ; preds = %3
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void RespondCallback(void *ctx, const void *buf, size_t size) {
  fprintf(stderr, "TODO: respond\n");
}


x86 assembly (clang, -O0):
<RespondCallback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [15 x i8] c"TODO: respond\0A\00"
define void @RespondCallback(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"TODO: respond\0A\00"
define void @RespondCallback(i8* nocapture readnone %0, i8* nocapture readnone %1, i64 %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int num, media;
  media = 0;
  for (num = 0; num <= 100; num++) {
    media = media + num;
  }
  media = media / 100;
  printf("Media %d ", media);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jg     114e <main+0x3e>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
mov    -0xc(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [10 x i8] c"Media %d \00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 50)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
uint64_t PeResolveImportName(uint64_t base, char *function) { return 0; }


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

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

LLVM IR (-O0):
define i32 @PeResolveImportName(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
ret i32 0
}

LLVM IR (-O2):
define i32 @PeResolveImportName(i32 %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int procfs_enum_id(char *, int **, int *);
int procfs_proc_enum(pid_t **pids, int *num) {
  return (procfs_enum_id("/proc", (int **)pids, num));
}


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

x86 assembly (clang, -O2):
<procfs_proc_enum>:
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdi
jmp    1030 <procfs_enum_id@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"/proc\00"
define i32 @procfs_proc_enum(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 = call i32 @procfs_enum_id(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32** %5, i32* %6)
ret i32 %7
}

LLVM IR (-O2):
@.str = [6 x i8] c"/proc\00"
define i32 @procfs_proc_enum(i32** %0, i32* %1) {
%3 = tail call i32 @procfs_enum_id(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32** %0, i32* %1)
ret i32 %3
}
void glmCopyVector4f(const float source[4], float target[4]) {
  target[0] = source[0];
  target[1] = source[1];
  target[2] = source[2];
  target[3] = source[3];
}


x86 assembly (clang, -O0):
<glmCopyVector4f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movss  0xc(%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmCopyVector4f>:
movss  (%rdi),%xmm0
movss  %xmm0,(%rsi)
movss  0x4(%rdi),%xmm0
movss  %xmm0,0x4(%rsi)
movss  0x8(%rdi),%xmm0
movss  %xmm0,0x8(%rsi)
movss  0xc(%rdi),%xmm0
movss  %xmm0,0xc(%rsi)
ret

LLVM IR (-O0):
define void @glmCopyVector4f(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %3
%6 = getelementptr inbounds float, float* %5, i64 0
%7 = load float, float* %6
%8 = load float*, float** %4
%9 = getelementptr inbounds float, float* %8, i64 0
store float %7, float* %9
%10 = load float*, float** %3
%11 = getelementptr inbounds float, float* %10, i64 1
%12 = load float, float* %11
%13 = load float*, float** %4
%14 = getelementptr inbounds float, float* %13, i64 1
store float %12, float* %14
%15 = load float*, float** %3
%16 = getelementptr inbounds float, float* %15, i64 2
%17 = load float, float* %16
%18 = load float*, float** %4
%19 = getelementptr inbounds float, float* %18, i64 2
store float %17, float* %19
%20 = load float*, float** %3
%21 = getelementptr inbounds float, float* %20, i64 3
%22 = load float, float* %21
%23 = load float*, float** %4
%24 = getelementptr inbounds float, float* %23, i64 3
store float %22, float* %24
ret void
}

LLVM IR (-O2):
define void @glmCopyVector4f(float* nocapture %0, float* nocapture writeonly %1) {
%3 = load float, float* %0
store float %3, float* %1
%4 = getelementptr inbounds float, float* %0, i64 1
%5 = load float, float* %4
%6 = getelementptr inbounds float, float* %1, i64 1
store float %5, float* %6
%7 = getelementptr inbounds float, float* %0, i64 2
%8 = load float, float* %7
%9 = getelementptr inbounds float, float* %1, i64 2
store float %8, float* %9
%10 = getelementptr inbounds float, float* %0, i64 3
%11 = load float, float* %10
%12 = getelementptr inbounds float, float* %1, i64 3
store float %11, float* %12
ret void
}
/* Variables and functions */
int main_ujoin(int, char **);
int main(int argc, char **argv) {
  int istat = main_ujoin(argc, argv);
  return istat;
}


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

x86 assembly (clang, -O2):
<main>:
jmp    1030 <main_ujoin@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @main_ujoin(i32 %0, i8** %1)
ret i32 %3
}
DMtrigger() {
  int i;
  i++;
}


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

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

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

LLVM IR (-O2):
define i32 @DMtrigger() {
ret i32 undef
}
int is_prime(num) {
  int i, res;
  if (num == 1) {
    return -1;
  }
  i = num;
  i--;
  while (i != 1) {
    res = num % i;
    if (res == 0) {
      return 0;
    }
    i--;
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    111d <is_prime+0x1d>
movl   $0xffffffff,-0x4(%rbp)
jmp    116b <is_prime+0x6b>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
je     1164 <is_prime+0x64>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1156 <is_prime+0x56>
movl   $0x0,-0x4(%rbp)
jmp    116b <is_prime+0x6b>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    112c <is_prime+0x2c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
mov    $0xffffffff,%eax
cmp    $0x1,%edi
je     1123 <is_prime+0x23>
lea    -0x1(%rdi),%ecx
nopl   (%rax)
cmp    $0x1,%ecx
je     1124 <is_prime+0x24>
mov    %edi,%eax
cltd
idiv   %ecx
add    $0xffffffff,%ecx
test   %edx,%edx
jne    1110 <is_prime+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @is_prime(i32 %0) {
%2 = icmp eq i32 %0, 1
br i1 %2, label %10, label %3
3: ; preds = %1, %7
%4 = phi i32 [ %5, %7 ], [ %0, %1 ]
%5 = add nsw i32 %4, -1
%6 = icmp eq i32 %5, 1
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = srem i32 %0, %5
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %3
10: ; preds = %3, %7, %1
%11 = phi i32 [ -1, %1 ], [ 1, %3 ], [ 0, %7 ]
ret i32 %11
}
unsigned Time2Redbook(int min, int sec, int frame) {
  return (unsigned)((min << 16) | (sec << 8) | (frame));
}


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

x86 assembly (clang, -O2):
<Time2Redbook>:
mov    %esi,%eax
shl    $0x10,%edi
shl    $0x8,%eax
or     %edi,%eax
or     %edx,%eax
ret

LLVM IR (-O0):
define i32 @Time2Redbook(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = shl i32 %7, 16
%9 = load i32, i32* %5
%10 = shl i32 %9, 8
%11 = or i32 %8, %10
%12 = load i32, i32* %6
%13 = or i32 %11, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @Time2Redbook(i32 %0, i32 %1, i32 %2) {
%4 = shl i32 %0, 16
%5 = shl i32 %1, 8
%6 = or i32 %5, %4
%7 = or i32 %6, %2
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int EXOR_9(int ip1, int ip2) {
  assert(ip1 >= 0 && ip2 >= 0);
  return (ip1 ^ ip2) & 0x01ff;
}


x86 assembly (clang, -O0):
<EXOR_9>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x9(%rbp)
jl     1137 <EXOR_9+0x27>
cmpl   $0x0,-0x8(%rbp)
setge  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
and    $0x1ff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EXOR_9>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    %esi,%edi
or     %ebp,%edi
not    %edi
shr    $0x1f,%edi
call   1030 <assert@plt>
xor    %ebp,%ebx
and    $0x1ff,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @EXOR_9(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 = icmp sge i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp sge i32 %8, 0
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ false, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = xor i32 %14, %15
%17 = and i32 %16, 511
ret i32 %17
}

LLVM IR (-O2):
define i32 @EXOR_9(i32 %0, i32 %1) {
%3 = or i32 %1, %0
%4 = xor i32 %3, -1
%5 = lshr i32 %4, 31
%6 = tail call i32 @assert(i32 %5)
%7 = xor i32 %1, %0
%8 = and i32 %7, 511
ret i32 %8
}
int signExtend(int b) {
  if ((b & 0x80) != 0)
    return b | 0xff00;
  else
    return b & 0x00ff;
}


x86 assembly (clang, -O0):
<signExtend>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     1128 <signExtend+0x28>
mov    -0x8(%rbp),%eax
or     $0xff00,%eax
mov    %eax,-0x4(%rbp)
jmp    1133 <signExtend+0x33>
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<signExtend>:
mov    %edi,%ecx
or     $0xff00,%ecx
test   $0x80,%dil
movzbl %dil,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @signExtend(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, 128
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %3
%9 = or i32 %8, 65280
store i32 %9, i32* %2
br label %13
10: ; preds = %1
%11 = load i32, i32* %3
%12 = and i32 %11, 255
store i32 %12, i32* %2
br label %13
13: ; preds = %10, %7
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @signExtend(i32 %0) {
%2 = and i32 %0, 128
%3 = icmp eq i32 %2, 0
%4 = or i32 %0, 65280
%5 = and i32 %0, 255
%6 = select i1 %3, i32 %5, i32 %4
ret i32 %6
}
unsigned char *gNtohl(unsigned char tbuf[], unsigned char val[]) {
  long inpara, outpara;
  memcpy(&inpara, val, 4);
  outpara = ntohl(inpara);
  memcpy(tbuf, &outpara, 4);
  return tbuf;
}


x86 assembly (clang, -O0):
<gNtohl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1030 <ntohl@plt>
cltq
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gNtohl>:
push   %rbx
mov    %rdi,%rbx
mov    (%rsi),%edi
xor    %eax,%eax
call   1030 <ntohl@plt>
mov    %eax,(%rbx)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @gNtohl(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = bitcast i64* %5 to i8*
%8 = load i8*, i8** %4
%9 = load i64, i64* %5
%10 = call i32 (i64, ...) bitcast (i32 (...)* @ntohl to i32 (i64, ...)*)(i64 %9)
%11 = sext i32 %10 to i64
store i64 %11, i64* %6
%12 = load i8*, i8** %3
%13 = bitcast i64* %6 to i8*
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
define i8* @gNtohl(i8* returned writeonly %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = load i32, i32* %3
%5 = zext i32 %4 to i64
%6 = tail call i32 (i64, ...) bitcast (i32 (...)* @ntohl to i32 (i64, ...)*)(i64 %5)
%7 = bitcast i8* %0 to i32*
store i32 %6, i32* %7
ret i8* %0
}
void g_source_set_callback() {}


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

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

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

LLVM IR (-O2):
define void @g_source_set_callback() {
ret void
}
__attribute__((always_)) int rcu_batch_before(long a, long b) {
  return (a - b) < 0;
}


x86 assembly (clang, -O0):
<rcu_batch_before>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
sub    -0x10(%rbp),%rax
cmp    $0x0,%rax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rcu_batch_before>:
xor    %eax,%eax
cmp    %rsi,%rdi
setl   %al
ret

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

LLVM IR (-O2):
define i32 @rcu_batch_before(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
scalar_t__ strcmp(char const *, char const *);
int same(const char *a, const char *b) {
  if (a == b)
    return 1;
  if (a && b)
    return (strcmp(a, b) == 0);
  return 0;
}


x86 assembly (clang, -O0):
<same>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    113a <same+0x2a>
movl   $0x1,-0x4(%rbp)
jmp    1178 <same+0x68>
cmpq   $0x0,-0x10(%rbp)
je     1171 <same+0x61>
cmpq   $0x0,-0x18(%rbp)
je     1171 <same+0x61>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1178 <same+0x68>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<same>:
cmp    %rsi,%rdi
je     1137 <same+0x27>
xor    %eax,%eax
test   %rdi,%rdi
je     1136 <same+0x26>
test   %rsi,%rsi
je     1136 <same+0x26>
push   %rax
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    $0x8,%rsp
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @same(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, %1
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = icmp ne i8* %0, null
%6 = icmp ne i8* %1, null
%7 = and i1 %5, %6
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = tail call i64 @strcmp(i8* %0, i8* %1)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %4, %2, %8
%13 = phi i32 [ %11, %8 ], [ 1, %2 ], [ 0, %4 ]
ret i32 %13
}
int same_col(int room1, int room2) { return ((room1 % 3) == (room2 % 3)); }


x86 assembly (clang, -O0):
<same_col>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    -0xc(%rbp),%edx
cmp    %eax,%edx
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<same_col>:
movslq %edi,%rcx
imul   $0x55555556,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rax
add    %edx,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%ecx
movslq %esi,%rdx
imul   $0x55555556,%rdx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
shr    $0x20,%rax
add    %esi,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%edx
xor    %eax,%eax
cmp    %edx,%ecx
sete   %al
ret

LLVM IR (-O0):
define i32 @same_col(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 = srem i32 %5, 3
%7 = load i32, i32* %4
%8 = srem i32 %7, 3
%9 = icmp eq i32 %6, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @same_col(i32 %0, i32 %1) {
%3 = srem i32 %0, 3
%4 = srem i32 %1, 3
%5 = icmp eq i32 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int plat_midi_write(uint8_t val) { return 0; }


x86 assembly (clang, -O0):
<plat_midi_write>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @plat_midi_write(i32 %0) {
ret i32 0
}
/* Variables and functions */
int has_more_tokens(char *pC) {
  if (pC == NULL) {
    return false;
  }
  if (*(pC + 1) == '\0') {
    return false;
  } else {
    return true;
  }
}


x86 assembly (clang, -O0):
<has_more_tokens>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    111f <has_more_tokens+0x1f>
movl   $0x0,-0x4(%rbp)
jmp    1143 <has_more_tokens+0x43>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    113c <has_more_tokens+0x3c>
movl   $0x0,-0x4(%rbp)
jmp    1143 <has_more_tokens+0x43>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<has_more_tokens>:
xor    %eax,%eax
test   %rdi,%rdi
je     110e <has_more_tokens+0xe>
cmpb   $0x0,0x1(%rdi)
setne  %al
ret

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

LLVM IR (-O2):
define i32 @has_more_tokens(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %3, %1
%9 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %9
}
/* Variables and functions */
int ft_strlen(char const *);
int /*<<< orphan*/ write(int, char const *, int);
void ft_putstr(char const *s) {
  int len;
  len = ft_strlen(s);
  write(1, s, len);
}


x86 assembly (clang, -O0):
<ft_putstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <ft_strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    $0x1,%edi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putstr>:
push   %rbx
mov    %rdi,%rbx
call   1040 <ft_strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
pop    %rbx
jmp    1030 <write@plt>

LLVM IR (-O0):
define void @ft_putstr(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @ft_strlen(i8* %4)
store i32 %5, i32* %3
%6 = load i8*, i8** %2
%7 = load i32, i32* %3
%8 = call i32 @write(i32 1, i8* %6, i32 %7)
ret void
}

LLVM IR (-O2):
define void @ft_putstr(i8* %0) {
%2 = tail call i32 @ft_strlen(i8* %0)
%3 = tail call i32 @write(i32 1, i8* %0, i32 %2)
ret void
}
char a() {
  char x[] = "supercalifragilisticoespialidoso";
  return x[2];
}


x86 assembly (clang, -O0):
<a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
lea    0xedd(%rip),%rsi
mov    $0x21,%edx
call   1030 <memcpy@plt>
movsbl -0x2e(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a>:
mov    $0x70,%al
ret

LLVM IR (-O0):
@__const.a.x = [33 x i8] c"supercalifragilisticoespialidoso\00"
define signext i8 @a() {
%1 = alloca [33 x i8]
%2 = bitcast [33 x i8]* %1 to i8*
%3 = getelementptr inbounds [33 x i8], [33 x i8]* %1, i64 0, i64 2
%4 = load i8, i8* %3
ret i8 %4
}

LLVM IR (-O2):
define signext i8 @a() {
ret i8 112
}
/* Variables and functions */
int pnstat();
int main(void) { return -pnstat(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @pnstat()
%2 = sub nsw i32 0, %1
ret i32 %2
}
/* Variables and functions */
double dabs(double);
int compare_doubles(double a, double b) {
  if (dabs(a - b) < 0.000001) {
    return 0;
  } else {
    if (a > b) {
      return 1;
    } else {
      return -1;
    }
  }
}


x86 assembly (clang, -O0):
<compare_doubles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
call   1030 <dabs@plt>
movaps %xmm0,%xmm1
movsd  0xec4(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1152 <compare_doubles+0x42>
movl   $0x0,-0x4(%rbp)
jmp    1175 <compare_doubles+0x65>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    116e <compare_doubles+0x5e>
movl   $0x1,-0x4(%rbp)
jmp    1175 <compare_doubles+0x65>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_doubles>:
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
subsd  %xmm1,%xmm0
call   1030 <dabs@plt>
xor    %eax,%eax
movsd  0x10(%rsp),%xmm1
ucomisd 0x8(%rsp),%xmm1
seta   %al
xor    %ecx,%ecx
movsd  0xebc(%rip),%xmm1
ucomisd %xmm0,%xmm1
lea    -0x1(%rax,%rax,1),%eax
cmova  %ecx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @compare_doubles(double %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = load double, double* %5
%8 = fsub double %6, %7
%9 = call double @dabs(double %8)
%10 = fcmp olt double %9, 0x3EB0C6F7A0B5ED8D
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 0, i32* %3
br label %18
12: ; preds = %2
%13 = load double, double* %4
%14 = load double, double* %5
%15 = fcmp ogt double %13, %14
br i1 %15, label %16, label %17
16: ; preds = %12
store i32 1, i32* %3
br label %18
17: ; preds = %12
store i32 -1, i32* %3
br label %18
18: ; preds = %17, %16, %11
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
define i32 @compare_doubles(double %0, double %1) {
%3 = fsub double %0, %1
%4 = tail call double @dabs(double %3)
%5 = fcmp olt double %4, 0x3EB0C6F7A0B5ED8D
%6 = fcmp ogt double %0, %1
%7 = select i1 %6, i32 1, i32 -1
%8 = select i1 %5, i32 0, i32 %7
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ smack_new_label_from_proc(char *, char **);
ssize_t smack_new_label_from_self(char **label) {
  return smack_new_label_from_proc("/proc/self/attr/current", label);
}


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

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

LLVM IR (-O0):
@.str = [24 x i8] c"/proc/self/attr/current\00"
define i32 @smack_new_label_from_self(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = call i32 @smack_new_label_from_proc(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8** %3)
ret i32 %4
}

LLVM IR (-O2):
@.str = [24 x i8] c"/proc/self/attr/current\00"
define i32 @smack_new_label_from_self(i8** %0) {
%2 = tail call i32 @smack_new_label_from_proc(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8** %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ oneDimAccess(int *, int *);
void f(int *arr, int *arr2, int *p) {
  for (;;) {
    oneDimAccess(arr, p);
    arr = arr2;
  }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <oneDimAccess@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1124 <f+0x14>

x86 assembly (clang, -O2):
<f>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rsi
call   1030 <oneDimAccess@plt>
mov    %rbx,%rdi
jmp    1120 <f+0x10>

LLVM IR (-O0):
define void @f(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
br label %7
7: ; preds = %7, %3
%8 = load i32*, i32** %4
%9 = load i32*, i32** %6
%10 = call i32 @oneDimAccess(i32* %8, i32* %9)
%11 = load i32*, i32** %5
store i32* %11, i32** %4
br label %7
}

LLVM IR (-O2):
define void @f(i32* %0, i32* %1, i32* %2) {
br label %4
4: ; preds = %4, %3
%5 = phi i32* [ %0, %3 ], [ %1, %4 ]
%6 = tail call i32 @oneDimAccess(i32* %5, i32* %2)
br label %4
}