xunge/DecIR huggingface dataset:
/* Variables and functions */
int partition(int *, int, int);
int rand();
int /*<<< orphan*/ swap(int *, int, int);
int randomized_partition(int nums[], int begin, int end) {
  int r = rand() % (end - begin) + begin;
  swap(nums, end - 1, r);
  return partition(nums, begin, end);
}


x86 assembly (clang, -O0):
<randomized_partition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    -0x10(%rbp),%ecx
sub    -0xc(%rbp),%ecx
cltd
idiv   %ecx
add    -0xc(%rbp),%edx
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
sub    $0x1,%esi
mov    -0x14(%rbp),%edx
call   1040 <swap@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomized_partition>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
xor    %eax,%eax
call   1050 <rand@plt>
mov    %ebx,%ecx
sub    %ebp,%ecx
cltd
idiv   %ecx
add    %ebp,%edx
lea    -0x1(%rbx),%esi
mov    %r14,%rdi
call   1040 <swap@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <partition@plt>

LLVM IR (-O0):
define i32 @randomized_partition(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = call i32 (...) @rand()
%9 = load i32, i32* %6
%10 = load i32, i32* %5
%11 = sub nsw i32 %9, %10
%12 = srem i32 %8, %11
%13 = load i32, i32* %5
%14 = add nsw i32 %12, %13
store i32 %14, i32* %7
%15 = load i32*, i32** %4
%16 = load i32, i32* %6
%17 = sub nsw i32 %16, 1
%18 = load i32, i32* %7
%19 = call i32 @swap(i32* %15, i32 %17, i32 %18)
%20 = load i32*, i32** %4
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = call i32 @partition(i32* %20, i32 %21, i32 %22)
ret i32 %23
}

LLVM IR (-O2):
define i32 @randomized_partition(i32* %0, i32 %1, i32 %2) {
%4 = tail call i32 (...) @rand()
%5 = sub nsw i32 %2, %1
%6 = srem i32 %4, %5
%7 = add nsw i32 %6, %1
%8 = add nsw i32 %2, -1
%9 = tail call i32 @swap(i32* %0, i32 %8, i32 %7)
%10 = tail call i32 @partition(i32* %0, i32 %1, i32 %2)
ret i32 %10
}
int test_imm_3Duint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x3D << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_3Duint64_highword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $0x20,%rdx
and    $0x3d,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_3Duint64_highword_reg>:
movabs $0x3d00000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_3Duint64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 32
%5 = and i64 %4, 61
%6 = icmp ne i64 %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_3Duint64_highword_reg(i64 %0) {
%2 = and i64 %0, 261993005056
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int strtol(char const *, char **, int);
int log_level_from_str(const char *str) {
  char *end;
  int level = strtol(str, &end, 10);
  if (*end != '\0' || !((level) >= 0 && (level) <= 3)) {
    return -1;
  } else {
    return level;
  }
}


x86 assembly (clang, -O0):
<log_level_from_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1155 <log_level_from_str+0x45>
cmpl   $0x0,-0x1c(%rbp)
jl     1155 <log_level_from_str+0x45>
cmpl   $0x3,-0x1c(%rbp)
jle    1161 <log_level_from_str+0x51>
movl   $0xffffffff,-0x4(%rbp)
jmp    1167 <log_level_from_str+0x57>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_level_from_str>:
push   %rax
mov    %rsp,%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
cmp    $0x4,%eax
mov    $0xffffffff,%ecx
cmovl  %eax,%ecx
mov    $0xffffffff,%edx
test   %eax,%eax
cmovs  %edx,%ecx
mov    (%rsp),%rax
xor    %edx,%edx
cmp    (%rax),%dl
sbb    %eax,%eax
or     %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @log_level_from_str(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = call i32 @strtol(i8* %0, i8** %2, i32 10)
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = icmp sgt i32 %4, -1
%9 = select i1 %7, i1 %8, i1 false
%10 = icmp slt i32 %4, 4
%11 = select i1 %9, i1 %10, i1 false
%12 = select i1 %11, i32 %4, i32 -1
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ asm_gotoxy(char, char, char);
void gotoxy(char row, char col, char page) { asm_gotoxy(row, col, page); }


x86 assembly (clang, -O0):
<gotoxy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    -0x1(%rbp),%cl
mov    -0x2(%rbp),%al
movsbl %cl,%edi
movsbl %al,%esi
movsbl -0x3(%rbp),%edx
call   1030 <asm_gotoxy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gotoxy>:
jmp    1030 <asm_gotoxy@plt>

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

LLVM IR (-O2):
define void @gotoxy(i8 signext %0, i8 signext %1, i8 signext %2) {
%4 = tail call i32 @asm_gotoxy(i8 signext %0, i8 signext %1, i8 signext %2)
ret void
}
int hashStr(const char *key, int capacity) {
  unsigned int v = 0;
  while (*key != 0) {
    v = (v << 5) + *key++;
  }
  return v % capacity;
}


x86 assembly (clang, -O0):
<hashStr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1144 <hashStr+0x44>
mov    -0x10(%rbp),%eax
shl    $0x5,%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <hashStr+0x12>
mov    -0x10(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashStr>:
mov    (%rdi),%cl
test   %cl,%cl
je     1125 <hashStr+0x25>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
shl    $0x5,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hashStr+0x10>
jmp    1127 <hashStr+0x27>
xor    %eax,%eax
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @hashStr(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i32 [ %12, %5 ], [ 0, %2 ]
%8 = phi i8* [ %11, %5 ], [ %0, %2 ]
%9 = sext i8 %6 to i32
%10 = shl i32 %7, 5
%11 = getelementptr inbounds i8, i8* %8, i64 1
%12 = add i32 %10, %9
%13 = load i8, i8* %11
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i32 [ 0, %2 ], [ %12, %5 ]
%17 = urem i32 %16, %1
ret i32 %17
}
int main(void) {
  int foo, a;
  foo = a + 2;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ SoftDlgProc();
long GPUconfigure(void) {
  SoftDlgProc();
  return 0;
}


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

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

LLVM IR (-O0):
define i64 @GPUconfigure() {
%1 = call i32 (...) @SoftDlgProc()
ret i64 0
}

LLVM IR (-O2):
define i64 @GPUconfigure() {
%1 = tail call i32 (...) @SoftDlgProc()
ret i64 0
}
/* Variables and functions */
int /*<<< orphan*/ db(int);
void cpuid() {
  db(0x0F);
  db(0xA2);
}


x86 assembly (clang, -O0):
<cpuid>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf,%edi
call   1030 <db@plt>
mov    $0xa2,%edi
call   1030 <db@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid>:
push   %rax
mov    $0xf,%edi
call   1030 <db@plt>
mov    $0xa2,%edi
pop    %rax
jmp    1030 <db@plt>

LLVM IR (-O0):
define void @cpuid() {
%1 = call i32 @db(i32 15)
%2 = call i32 @db(i32 162)
ret void
}

LLVM IR (-O2):
define void @cpuid() {
%1 = tail call i32 @db(i32 15)
%2 = tail call i32 @db(i32 162)
ret void
}
int retournerLaTaille(int int_taille) {
  int int_i;
  int_i = 1;
  while (int_i * int_i < int_taille) {
    int_i++;
  }
  if ((int_i != 1) && (int_i * int_i == int_taille) && (int_i % 2 == 1)) {
    return (int_i);
  } else {
    return (1);
  }
}


x86 assembly (clang, -O0):
<retournerLaTaille>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    112c <retournerLaTaille+0x2c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <retournerLaTaille+0xe>
cmpl   $0x1,-0xc(%rbp)
je     1165 <retournerLaTaille+0x65>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1165 <retournerLaTaille+0x65>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    1165 <retournerLaTaille+0x65>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116c <retournerLaTaille+0x6c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<retournerLaTaille>:
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ecx
mov    %ecx,%eax
imul   %ecx,%eax
cmp    %edi,%eax
jl     1110 <retournerLaTaille+0x10>
mov    $0x1,%edx
mov    %ecx,%eax
cmovne %edx,%eax
cmp    $0x1,%ecx
cmove  %ecx,%eax
test   $0x1,%cl
cmove  %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @retournerLaTaille(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 1, %1 ], [ %6, %2 ]
%4 = mul nsw i32 %3, %3
%5 = icmp slt i32 %4, %0
%6 = add nuw nsw i32 %3, 1
br i1 %5, label %2, label %7
7: ; preds = %2
%8 = icmp eq i32 %3, 1
%9 = icmp ne i32 %4, %0
%10 = select i1 %8, i1 true, i1 %9
%11 = and i32 %3, 1
%12 = icmp eq i32 %11, 0
%13 = or i1 %12, %10
%14 = select i1 %13, i32 1, i32 %3
ret i32 %14
}
/* Variables and functions */
scalar_t__ RAND_MAX;
scalar_t__ rand();
float randomFloat() { return ((float)rand()) / ((float)RAND_MAX); }


x86 assembly (clang, -O0):
<randomFloat>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2ss %rax,%xmm0
mov    0x2ec1(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomFloat>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2ss %rax,%xmm0
mov    0x2ec4(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define float @randomFloat() {
%1 = call i64 (...) @rand()
%2 = sitofp i64 %1 to float
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to float
%5 = fdiv float %2, %4
ret float %5
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define float @randomFloat() {
%1 = tail call i64 (...) @rand()
%2 = sitofp i64 %1 to float
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to float
%5 = fdiv float %2, %4
ret float %5
}
void test_29_1(short *mem) { __atomic_fetch_and(mem, 1, 4); }


x86 assembly (clang, -O0):
<test_29_1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movw   $0x1,-0xa(%rbp)
mov    -0xa(%rbp),%cx
mov    %cx,-0x10(%rbp)
mov    (%rax),%ax
mov    %ax,-0xe(%rbp)
mov    -0xe(%rbp),%ax
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%dx
mov    %dx,%si
mov    %ax,%dx
mov    %edx,-0x24(%rbp)
and    %esi,%edx
mov    %edx,-0x20(%rbp)
lock cmpxchg %dx,(%rcx)
sete   %cl
mov    %ax,-0x1a(%rbp)
test   $0x1,%cl
mov    %ax,-0xe(%rbp)
jne    115d <test_29_1+0x5d>
jmp    1125 <test_29_1+0x25>
mov    -0x1a(%rbp),%ax
mov    %ax,-0xc(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_29_1>:
lock andw $0x1,(%rdi)
ret

LLVM IR (-O0):
define void @test_29_1(i16* %0) {
%2 = alloca i16*
%3 = alloca i16
%4 = alloca i16
store i16* %0, i16** %2
%5 = load i16*, i16** %2
store i16 1, i16* %3
%6 = load i16, i16* %3
%7 = atomicrmw and i16* %5, i16 %6 acq_rel
store i16 %7, i16* %4
%8 = load i16, i16* %4
ret void
}

LLVM IR (-O2):
define void @test_29_1(i16* nocapture %0) {
%2 = atomicrmw and i16* %0, i16 1 acq_rel
ret void
}
/* Variables and functions */
int xsalsa20poly1305_secretbox_open(unsigned char *, unsigned char const *,
                                    unsigned long long, unsigned char const *,
                                    unsigned char const *);
int curve25519xsalsa20poly1305_box_open_afternm(unsigned char *m,
                                                const unsigned char *c,
                                                unsigned long long clen,
                                                const unsigned char *n,
                                                const unsigned char *k) {
  return xsalsa20poly1305_secretbox_open(m, c, clen, n, k);
}


x86 assembly (clang, -O0):
<curve25519xsalsa20poly1305_box_open_afternm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1030 <xsalsa20poly1305_secretbox_open@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<curve25519xsalsa20poly1305_box_open_afternm>:
jmp    1030 <xsalsa20poly1305_secretbox_open@plt>

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

LLVM IR (-O2):
define i32 @curve25519xsalsa20poly1305_box_open_afternm(i8* %0, i8* %1, i64 %2, i8* %3, i8* %4) {
%6 = tail call i32 @xsalsa20poly1305_secretbox_open(i8* %0, i8* %1, i64 %2, i8* %3, i8* %4)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int pthread_self();
void message1() { printf("[%X] Hello World! \n", pthread_self()); }


x86 assembly (clang, -O0):
<message1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    %eax,%esi
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<message1>:
push   %rax
xor    %eax,%eax
call   1040 <pthread_self@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"[%X] Hello World! \0A\00"
define void @message1() {
%1 = call i32 (...) @pthread_self()
%2 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"[%X] Hello World! \0A\00"
define void @message1() {
%1 = tail call i32 (...) @pthread_self()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
void error(char *msg) {
  printf("%s\n", msg);
  exit(0);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @error(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 0)
unreachable
}
int chk_quit() {
  return 1;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @chk_quit() {
ret i32 1
}
void stopreceive(int signo __attribute__((unused))) { return; }


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

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

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

LLVM IR (-O2):
define void @stopreceive(i32 %0) {
ret void
}
int test2(int a, int b) { return a + b == a; }


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

x86 assembly (clang, -O2):
<test2>:
xor    %eax,%eax
test   %esi,%esi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @test2(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ chdir(char *);
void c_chdir_(char *path, int pathlen) { chdir(path); }


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

x86 assembly (clang, -O2):
<c_chdir_>:
jmp    1030 <chdir@plt>

LLVM IR (-O0):
define void @c_chdir_(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 = call i32 @chdir(i8* %5)
ret void
}

LLVM IR (-O2):
define void @c_chdir_(i8* %0, i32 %1) {
%3 = tail call i32 @chdir(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dump_error(char *);
scalar_t__ malloc(unsigned int);
int *ivector(int nl, int nh) {
  int *v;
  v = (int *)malloc((unsigned)(nh - nl + 1) * sizeof(int));
  if (!v)
    dump_error("allocation failure in ivector()");
  return v - nl;
}


x86 assembly (clang, -O0):
<ivector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115f <ivector+0x3f>
lea    0xea6(%rip),%rdi
call   1030 <dump_error@plt>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ivector>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
sub    %edi,%esi
lea    0x4(,%rsi,4),%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1147 <ivector+0x27>
lea    0xebe(%rip),%rdi
call   1030 <dump_error@plt>
movslq %ebp,%rax
shl    $0x2,%rax
sub    %rax,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"allocation failure in ivector()\00"
define i32* @ivector(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = sub nsw i32 %6, %7
%9 = add nsw i32 %8, 1
%10 = zext i32 %9 to i64
%11 = mul i64 %10, 4
%12 = trunc i64 %11 to i32
%13 = call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to i32*
store i32* %14, i32** %5
%15 = load i32*, i32** %5
%16 = icmp ne i32* %15, null
br i1 %16, label %19, label %17
17: ; preds = %2
%18 = call i32 @dump_error(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %17, %2
%20 = load i32*, i32** %5
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = sub i64 0, %22
%24 = getelementptr inbounds i32, i32* %20, i64 %23
ret i32* %24
}

LLVM IR (-O2):
@.str = [32 x i8] c"allocation failure in ivector()\00"
define i32* @ivector(i32 %0, i32 %1) {
%3 = sub nsw i32 %1, %0
%4 = shl i32 %3, 2
%5 = add i32 %4, 4
%6 = tail call i64 @malloc(i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @dump_error(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = inttoptr i64 %6 to i32*
%12 = sext i32 %0 to i64
%13 = sub nsw i64 0, %12
%14 = getelementptr inbounds i32, i32* %11, i64 %13
ret i32* %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_socket_client_new_ipv4() {
  printf("NOT IMPLEMENTED:"
         "pa_socket_client_new_ipv4"
         "\n");
}


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

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

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

LLVM IR (-O2):
@str = [42 x i8] c"NOT IMPLEMENTED:pa_socket_client_new_ipv4\00"
define i32 @pa_socket_client_new_ipv4() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int *malloc(int);
int main(void) {
  int y;
  int *x = malloc(sizeof(int) * 100);
  y = x[95];
  y = x[100];
  y = x[-1];
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x190,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x17c(%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x190(%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rax),%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x190,%edi
call   1030 <malloc@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
%4 = call i32* @malloc(i32 400)
store i32* %4, i32** %3
%5 = load i32*, i32** %3
%6 = getelementptr inbounds i32, i32* %5, i64 95
%7 = load i32, i32* %6
store i32 %7, i32* %2
%8 = load i32*, i32** %3
%9 = getelementptr inbounds i32, i32* %8, i64 100
%10 = load i32, i32* %9
store i32 %10, i32* %2
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i64 -1
%13 = load i32, i32* %12
store i32 %13, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @malloc(i32 400)
ret i32 0
}
/* Variables and functions */
int w5100_readSn_byte(unsigned int, int);
unsigned w5100_readSnSR(unsigned sock) {
  return w5100_readSn_byte(sock, 0x0003);
}


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

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

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

LLVM IR (-O2):
define i32 @w5100_readSnSR(i32 %0) {
%2 = tail call i32 @w5100_readSn_byte(i32 %0, i32 3)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ __mriPlatform_CommSendChar(char);
void sendACKToGDB(void) { __mriPlatform_CommSendChar('+'); }


x86 assembly (clang, -O0):
<sendACKToGDB>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2b,%edi
call   1030 <__mriPlatform_CommSendChar@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendACKToGDB>:
mov    $0x2b,%edi
jmp    1030 <__mriPlatform_CommSendChar@plt>

LLVM IR (-O0):
define void @sendACKToGDB() {
%1 = call i32 @__mriPlatform_CommSendChar(i8 signext 43)
ret void
}

LLVM IR (-O2):
define void @sendACKToGDB() {
%1 = tail call i32 @__mriPlatform_CommSendChar(i8 signext 43)
ret void
}
/* Type definitions */
typedef scalar_t__ int32_t;

/* Variables and functions */
scalar_t__ floorf(float const);
void floor_w_s(const float *source, int32_t *dest) {
  *dest = (int32_t)floorf(*source);
}


x86 assembly (clang, -O0):
<floor_w_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
call   1030 <floorf@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<floor_w_s>:
push   %rbx
mov    %rsi,%rbx
movss  (%rdi),%xmm0
call   1030 <floorf@plt>
mov    %rax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @floor_w_s(float* %0, i64* %1) {
%3 = alloca float*
%4 = alloca i64*
store float* %0, float** %3
store i64* %1, i64** %4
%5 = load float*, float** %3
%6 = load float, float* %5
%7 = call i64 @floorf(float %6)
%8 = load i64*, i64** %4
store i64 %7, i64* %8
ret void
}

LLVM IR (-O2):
define void @floor_w_s(float* nocapture %0, i64* nocapture writeonly %1) {
%3 = load float, float* %0
%4 = tail call i64 @floorf(float %3)
store i64 %4, i64* %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_rwlockattr_t;

/* Variables and functions */
int pthread_rwlockattr_getpshared(int /*<<< orphan*/ *, int *);
int my_pthread_rwlockattr_getpshared(pthread_rwlockattr_t *__attr,
                                     int *pshared) {
  pthread_rwlockattr_t *realattr =
      (pthread_rwlockattr_t *)*(unsigned int *)__attr;
  return pthread_rwlockattr_getpshared(realattr, pshared);
}


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

x86 assembly (clang, -O2):
<my_pthread_rwlockattr_getpshared>:
mov    (%rdi),%edi
jmp    1030 <pthread_rwlockattr_getpshared@plt>

LLVM IR (-O0):
define i32 @my_pthread_rwlockattr_getpshared(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
%8 = zext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
store i32* %9, i32** %5
%10 = load i32*, i32** %5
%11 = load i32*, i32** %4
%12 = call i32 @pthread_rwlockattr_getpshared(i32* %10, i32* %11)
ret i32 %12
}

LLVM IR (-O2):
define i32 @my_pthread_rwlockattr_getpshared(i32* nocapture %0, i32* %1) {
%3 = load i32, i32* %0
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = tail call i32 @pthread_rwlockattr_getpshared(i32* %5, i32* %1)
ret i32 %6
}
void demo_regressor(char *datacfg, char *cfgfile, char *weightfile,
                    int cam_index, const char *filename) {}


x86 assembly (clang, -O0):
<demo_regressor>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @demo_regressor(i8* %0, i8* %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
ret void
}

LLVM IR (-O2):
define void @demo_regressor(i8* nocapture %0, i8* nocapture %1, i8* nocapture %2, i32 %3, i8* nocapture %4) {
ret void
}
/* Variables and functions */
void mic_alloc(double *data, size_t nelem, int device, int offload) {
#pragma offload_transfer target(mic                                            \
                                : device)                                      \
    nocopy(data                                                                \
           : length(nelem) alloc_if(1) free_if(0)) if (offload)
}


x86 assembly (clang, -O0):
<mic_alloc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @mic_alloc(double* %0, i64 %1, i32 %2, i32 %3) {
%5 = alloca double*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
store double* %0, double** %5
store i64 %1, i64* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
ret void
}

LLVM IR (-O2):
define void @mic_alloc(double* nocapture %0, i64 %1, i32 %2, i32 %3) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ postMessage(int /*<<< orphan*/, int, unsigned int);
void installExceptionHandler(void *handler) {
  postMessage(0, 35, (unsigned int)handler);
}


x86 assembly (clang, -O0):
<installExceptionHandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%edx
xor    %edi,%edi
mov    $0x23,%esi
call   1030 <postMessage@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<installExceptionHandler>:
mov    %rdi,%rdx
xor    %edi,%edi
mov    $0x23,%esi
jmp    1030 <postMessage@plt>

LLVM IR (-O0):
define void @installExceptionHandler(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i32
%5 = call i32 @postMessage(i32 0, i32 35, i32 %4)
ret void
}

LLVM IR (-O2):
define void @installExceptionHandler(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = tail call i32 @postMessage(i32 0, i32 35, i32 %3)
ret void
}
_Bool anyBitSet(const int flags, const int mask) {
  if (flags & mask)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<anyBitSet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    -0xc(%rbp),%eax
cmp    $0x0,%eax
je     1122 <anyBitSet+0x22>
movb   $0x1,-0x1(%rbp)
jmp    1126 <anyBitSet+0x26>
movb   $0x0,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<anyBitSet>:
test   %edi,%esi
setne  %al
ret

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

LLVM IR (-O2):
define zeroext i1 @anyBitSet(i32 %0, i32 %1) {
%3 = and i32 %1, %0
%4 = icmp ne i32 %3, 0
ret i1 %4
}
/* Variables and functions */
int /*<<< orphan*/ platform_led_toggle(int);
int /*<<< orphan*/ platform_systick_wait();
void loop() {
  platform_led_toggle(1);
  platform_systick_wait();
  platform_led_toggle(0);
  platform_systick_wait();
}


x86 assembly (clang, -O0):
<loop>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <platform_led_toggle@plt>
mov    $0x0,%al
call   1040 <platform_systick_wait@plt>
xor    %edi,%edi
call   1030 <platform_led_toggle@plt>
mov    $0x0,%al
call   1040 <platform_systick_wait@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<loop>:
push   %rax
mov    $0x1,%edi
call   1030 <platform_led_toggle@plt>
xor    %eax,%eax
call   1040 <platform_systick_wait@plt>
xor    %edi,%edi
call   1030 <platform_led_toggle@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <platform_systick_wait@plt>

LLVM IR (-O0):
define void @loop() {
%1 = call i32 @platform_led_toggle(i32 1)
%2 = call i32 (...) @platform_systick_wait()
%3 = call i32 @platform_led_toggle(i32 0)
%4 = call i32 (...) @platform_systick_wait()
ret void
}

LLVM IR (-O2):
define void @loop() {
%1 = tail call i32 @platform_led_toggle(i32 1)
%2 = tail call i32 (...) @platform_systick_wait()
%3 = tail call i32 @platform_led_toggle(i32 0)
%4 = tail call i32 (...) @platform_systick_wait()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SHUT_RD;
int /*<<< orphan*/ shutdown(int, int /*<<< orphan*/);
void socket_endread(int fd) {
  if (fd < 0)
    return;
  shutdown(fd, SHUT_RD);
}


x86 assembly (clang, -O0):
<socket_endread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    112a <socket_endread+0x1a>
jmp    113b <socket_endread+0x2b>
mov    -0x4(%rbp),%edi
mov    0x2eb4(%rip),%rax
mov    (%rax),%esi
call   1030 <shutdown@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<socket_endread>:
test   %edi,%edi
js     1122 <socket_endread+0x12>
mov    0x2ecd(%rip),%rax
mov    (%rax),%esi
jmp    1030 <shutdown@plt>
ret

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

LLVM IR (-O2):
@SHUT_RD = global i32 0
define void @socket_endread(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = load i32, i32* @SHUT_RD
%5 = tail call i32 @shutdown(i32 %0, i32 %4)
br label %6
6: ; preds = %1, %3
ret void
}
double sub2(double f, double g, double h) { return -((f * g) + h); }


x86 assembly (clang, -O0):
<sub2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub2>:
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
xorpd  0xef0(%rip),%xmm0
ret

LLVM IR (-O0):
define double @sub2(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = load double, double* %6
%10 = call double @llvm.fmuladd.f64(double %7, double %8, double %9)
%11 = fneg double %10
ret double %11
}

LLVM IR (-O2):
define double @sub2(double %0, double %1, double %2) {
%4 = tail call double @llvm.fmuladd.f64(double %0, double %1, double %2)
%5 = fneg double %4
ret double %5
}
/* Type definitions */
typedef int uint32_t;
typedef scalar_t__ time_t;
typedef int /*<<< orphan*/ out_msg;

/* Variables and functions */
int /*<<< orphan*/ _xmit(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int, long);
scalar_t__ time(int /*<<< orphan*/ *);
void _cancel_job(long my_job_id) {
  time_t now = time(NULL);
  char out_msg[128];
  snprintf(out_msg, sizeof(out_msg),
           "TS=%u AUTH=root DT=CMD=CANCELJOB ARG=%ld TYPE=ADMIN", (uint32_t)now,
           my_job_id);
  _xmit(out_msg);
}


x86 assembly (clang, -O0):
<_cancel_job>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %rax,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%r8
mov    $0x80,%esi
lea    0xe97(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x90(%rbp),%rdi
call   1040 <_xmit@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cancel_job>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rdi,%rbx
xor    %edi,%edi
call   1050 <time@plt>
lea    0xeb5(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x80,%esi
mov    %eax,%ecx
mov    %rbx,%r8
call   1030 <snprintf@plt>
mov    %r14,%rdi
call   1040 <_xmit@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [52 x i8] c"TS=%u AUTH=root DT=CMD=CANCELJOB ARG=%ld TYPE=ADMIN\00"
define void @_cancel_job(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca [128 x i8]
store i64 %0, i64* %2
%5 = call i64 @time(i32* null)
store i64 %5, i64* %3
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%7 = load i64, i64* %3
%8 = trunc i64 %7 to i32
%9 = load i64, i64* %2
%10 = call i32 @snprintf(i8* %6, i32 128, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 %8, i64 %9)
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%12 = call i32 @_xmit(i8* %11)
ret void
}

LLVM IR (-O2):
@.str = [52 x i8] c"TS=%u AUTH=root DT=CMD=CANCELJOB ARG=%ld TYPE=ADMIN\00"
define void @_cancel_job(i64 %0) {
%2 = alloca [128 x i8]
%3 = tail call i64 @time(i32* null)
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%5 = trunc i64 %3 to i32
%6 = call i32 @snprintf(i8* %4, i32 128, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 %5, i64 %0)
%7 = call i32 @_xmit(i8* %4)
ret void
}
linewi_(n) int *n;
{ linewidth(*n); }


x86 assembly (clang, -O0):
<linewi_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    $0x0,%al
call   1030 <linewidth@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linewi_>:
mov    (%rdi),%edi
xor    %eax,%eax
jmp    1030 <linewidth@plt>

LLVM IR (-O0):
define i32 @linewi_(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = load i32, i32* %4
%6 = call i32 (i32, ...) bitcast (i32 (...)* @linewidth to i32 (i32, ...)*)(i32 %5)
%7 = load i32, i32* %2
ret i32 %7
}

LLVM IR (-O2):
define i32 @linewi_(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @linewidth to i32 (i32, ...)*)(i32 %2)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ close_rx_socket(int *);
int /*<<< orphan*/ close_tx_socket(int *);
void close_sockets(int *tx_sockfd, int *rx_sockfd) {
  close_tx_socket(tx_sockfd);
  close_rx_socket(rx_sockfd);
}


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

x86 assembly (clang, -O2):
<close_sockets>:
push   %rbx
mov    %rsi,%rbx
call   1030 <close_tx_socket@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <close_rx_socket@plt>

LLVM IR (-O0):
define void @close_sockets(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 = call i32 @close_tx_socket(i32* %5)
%7 = load i32*, i32** %4
%8 = call i32 @close_rx_socket(i32* %7)
ret void
}

LLVM IR (-O2):
define void @close_sockets(i32* %0, i32* %1) {
%3 = tail call i32 @close_tx_socket(i32* %0)
%4 = tail call i32 @close_rx_socket(i32* %1)
ret void
}
int cast_short_int_fast(short int x) { return (int)x; }


x86 assembly (clang, -O0):
<cast_short_int_fast>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @cast_short_int_fast(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @cast_short_int_fast(i16 signext %0) {
%2 = sext i16 %0 to i32
ret i32 %2
}
/* Variables and functions */
scalar_t__ read_and_exec(int);
void *read_and_exec_thread(void *arg) {
  return (void *)read_and_exec((int)arg);
}


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

x86 assembly (clang, -O2):
<read_and_exec_thread>:
jmp    1030 <read_and_exec@plt>

LLVM IR (-O0):
define i8* @read_and_exec_thread(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i32
%5 = call i64 @read_and_exec(i32 %4)
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}

LLVM IR (-O2):
define i8* @read_and_exec_thread(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = tail call i64 @read_and_exec(i32 %3)
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ system(char *);
int main() {
  printf("%1038674944x");
  system("          /bin/sh");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"%1038674944x\00"
@.str.1 = [18 x i8] c" /bin/sh\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @system(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"%1038674944x\00"
@.str.1 = [18 x i8] c" /bin/sh\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int fread(char *, int, int, int /*<<< orphan*/ *);
int fgetc(FILE *stream) {
  char out = '\0';
  return fread(&out, sizeof(char), 1, stream) == 1 ? out : EOF;
}


x86 assembly (clang, -O0):
<fgetc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0x9(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
cmp    $0x1,%eax
jne    1149 <fgetc+0x39>
movsbl -0x9(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1155 <fgetc+0x45>
mov    0x2e98(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgetc>:
push   %rax
mov    %rdi,%rcx
movb   $0x0,0x7(%rsp)
lea    0x7(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x1,%eax
je     113d <fgetc+0x2d>
mov    0x2eaf(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret
movsbl 0x7(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @fgetc(i32* %0) {
%2 = alloca i32*
%3 = alloca i8
store i32* %0, i32** %2
store i8 0, i8* %3
%4 = load i32*, i32** %2
%5 = call i32 @fread(i8* %3, i32 1, i32 1, i32* %4)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
br label %12
10: ; preds = %1
%11 = load i32, i32* @EOF
br label %12
12: ; preds = %10, %7
%13 = phi i32 [ %9, %7 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @fgetc(i32* nocapture %0) {
%2 = alloca i8
store i8 0, i8* %2
%3 = call i32 @fread(i8* %2, i32 1, i32 1, i32* %0)
%4 = icmp eq i32 %3, 1
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = load i32, i32* @EOF
%8 = select i1 %4, i32 %6, i32 %7
ret i32 %8
}