xunge/DecIR huggingface dataset:
void secondexit(void) {
  printf("%s, %d, %s\n",
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/sczzq/symmetrical-spoon/refs/heads/master/"
         "base-usage/cplusplus/client-server/test_atexit.c",
         18, __func__);
}


x86 assembly (clang, -O0):
<secondexit>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xeea(%rip),%rsi
mov    $0x12,%edx
lea    0xf93(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<secondexit>:
lea    0xee9(%rip),%rdi
lea    0xeee(%rip),%rsi
lea    0xf9c(%rip),%rcx
mov    $0x12,%edx
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"%s, %d, %s\0A\00"
@.str.1 = [181 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/sczzq/symmetrical-spoon/refs/heads/master/base-usage/cplusplus/client-server/test_atexit.c\00"
@__func__.secondexit = [11 x i8] c"secondexit\00"
define void @secondexit() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([181 x i8], [181 x i8]* @.str.1, i64 0, i64 0), i32 18, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.secondexit, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"%s, %d, %s\0A\00"
@.str.1 = [181 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/sczzq/symmetrical-spoon/refs/heads/master/base-usage/cplusplus/client-server/test_atexit.c\00"
@__func__.secondexit = [11 x i8] c"secondexit\00"
define void @secondexit() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([181 x i8], [181 x i8]* @.str.1, i64 0, i64 0), i32 18, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.secondexit, i64 0, i64 0))
ret void
}
int test_imm_0Auint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x0A << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_0Auint64_midword_mem>:
testb  $0xa,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_0Auint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 655360
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ remove_me();
int main(void) {
  int a = -100;
  int b = 2;
  int d = -1;
  int e = -100;
  while (a) {
    a = a + b;
    b = b + 3;
    d = d + 3;
    e = e + d;
    if (a != e)
      remove_me();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffff9c,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
movl   $0xffffffff,-0x10(%rbp)
movl   $0xffffff9c,-0x14(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1181 <main+0x71>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     117c <main+0x6c>
mov    $0x0,%al
call   1030 <remove_me@plt>
jmp    113b <main+0x2b>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
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
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 -100, i32* %2
store i32 2, i32* %3
store i32 -1, i32* %4
store i32 -100, i32* %5
br label %6
6: ; preds = %25, %0
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %26
9: ; preds = %6
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = add nsw i32 %10, %11
store i32 %12, i32* %2
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 3
store i32 %14, i32* %3
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 3
store i32 %16, i32* %4
%17 = load i32, i32* %5
%18 = load i32, i32* %4
%19 = add nsw i32 %17, %18
store i32 %19, i32* %5
%20 = load i32, i32* %2
%21 = load i32, i32* %5
%22 = icmp ne i32 %20, %21
br i1 %22, label %23, label %25
23: ; preds = %9
%24 = call i32 (...) @remove_me()
br label %25
25: ; preds = %23, %9
br label %6
26: ; preds = %6
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void I2CStartSend(unsigned long ulBase) {
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000000))) |= 0x00000100;
}


x86 assembly (clang, -O0):
<I2CStartSend>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
or     $0x100,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2CStartSend>:
orq    $0x100,(%rdi)
ret

LLVM IR (-O0):
define void @I2CStartSend(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 %3, 0
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = or i64 %6, 256
store volatile i64 %7, i64* %5
ret void
}

LLVM IR (-O2):
define void @I2CStartSend(i64 %0) {
%2 = inttoptr i64 %0 to i64*
%3 = load volatile i64, i64* %2
%4 = or i64 %3, 256
store volatile i64 %4, i64* %2
ret void
}
int fn1(int x, int y) { return x | ~(x | y); }


x86 assembly (clang, -O0):
<fn1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
or     -0x8(%rbp),%ecx
xor    $0xffffffff,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn1>:
mov    %esi,%eax
not    %eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @fn1(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* %3
%7 = load i32, i32* %4
%8 = or i32 %6, %7
%9 = xor i32 %8, -1
%10 = or i32 %5, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @fn1(i32 %0, i32 %1) {
%3 = xor i32 %1, -1
%4 = or i32 %3, %0
ret i32 %4
}
extern int Min3(int i1, int i2, int i3) {
  if (i1 <= i2 && i1 <= i3)
    return i1;
  return i2 <= i3 ? i2 : i3;
}


x86 assembly (clang, -O0):
<Min3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1130 <Min3+0x30>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1130 <Min3+0x30>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1153 <Min3+0x53>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1147 <Min3+0x47>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    114d <Min3+0x4d>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Min3>:
cmp    %edx,%esi
mov    %esi,%ecx
cmovg  %edx,%ecx
cmp    %edx,%edi
mov    %edi,%eax
cmovg  %ecx,%eax
cmp    %esi,%edi
cmovg  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @Min3(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, %1
%5 = icmp sgt i32 %0, %2
%6 = or i1 %4, %5
%7 = icmp sgt i32 %1, %2
%8 = select i1 %7, i32 %2, i32 %1
%9 = select i1 %6, i32 %8, i32 %0
ret i32 %9
}
/* Type definitions */
struct nfst_StringTable {
  int dummy;
};

/* Variables and functions */
char const *strings(struct nfst_StringTable *);
const char *nfst_to_string(struct nfst_StringTable *st, int symbol) {
  return strings(st) + symbol;
}


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

x86 assembly (clang, -O2):
<nfst_to_string>:
push   %rbx
mov    %esi,%ebx
call   1030 <strings@plt>
movslq %ebx,%rcx
add    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.nfst_StringTable = type { i32 }
define i8* @nfst_to_string(%struct.nfst_StringTable* %0, i32 %1) {
%3 = alloca %struct.nfst_StringTable*
%4 = alloca i32
store %struct.nfst_StringTable* %0, %struct.nfst_StringTable** %3
store i32 %1, i32* %4
%5 = load %struct.nfst_StringTable*, %struct.nfst_StringTable** %3
%6 = call i8* @strings(%struct.nfst_StringTable* %5)
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
ret i8* %9
}

LLVM IR (-O2):
%struct.nfst_StringTable = type { i32 }
define i8* @nfst_to_string(%struct.nfst_StringTable* %0, i32 %1) {
%3 = tail call i8* @strings(%struct.nfst_StringTable* %0)
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i8, i8* %3, i64 %4
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ sendbyte(char const);
void printStr(const char *str) {
  while (*str) {
    sendbyte(*str);
    str++;
  }
}


x86 assembly (clang, -O0):
<printStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1146 <printStr+0x36>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <sendbyte@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <printStr+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printStr>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <printStr+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <sendbyte@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <printStr+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @printStr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %7, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = call i32 @sendbyte(i8 signext %9)
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %2
br label %3
13: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @printStr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 @sendbyte(i8 signext %5)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fmaxf(float const, float const);
float fminf(int /*<<< orphan*/, float const);
float clampf(const float in_X, const float in_MIN, const float in_MAX) {
  return fminf(fmaxf(in_X, in_MIN), in_MAX);
}


x86 assembly (clang, -O0):
<clampf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1040 <fmaxf@plt>
mov    %eax,%edi
movss  -0xc(%rbp),%xmm0
call   1030 <fminf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clampf>:
push   %rax
movss  %xmm2,0x4(%rsp)
call   1040 <fmaxf@plt>
mov    %eax,%edi
movss  0x4(%rsp),%xmm0
pop    %rax
jmp    1030 <fminf@plt>

LLVM IR (-O0):
define float @clampf(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = call i32 @fmaxf(float %7, float %8)
%10 = load float, float* %6
%11 = call float @fminf(i32 %9, float %10)
ret float %11
}

LLVM IR (-O2):
define float @clampf(float %0, float %1, float %2) {
%4 = tail call i32 @fmaxf(float %0, float %1)
%5 = tail call float @fminf(i32 %4, float %2)
ret float %5
}
/* Type definitions */
struct vec3 {
  int dummy;
};
struct quat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ quat_from_vec3(float *, float *, float *);
__attribute__((always_)) struct quat *
psquat_from_vec3(struct quat *result, struct vec3 *a, struct vec3 *b) {
  quat_from_vec3((float *)result, (float *)a, (float *)b);
  return result;
}


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

x86 assembly (clang, -O2):
<psquat_from_vec3>:
push   %rbx
mov    %rdi,%rbx
call   1030 <quat_from_vec3@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.quat = type { i32 }
%struct.vec3 = type { i32 }
define %struct.quat* @psquat_from_vec3(%struct.quat* %0, %struct.vec3* %1, %struct.vec3* %2) {
%4 = alloca %struct.quat*
%5 = alloca %struct.vec3*
%6 = alloca %struct.vec3*
store %struct.quat* %0, %struct.quat** %4
store %struct.vec3* %1, %struct.vec3** %5
store %struct.vec3* %2, %struct.vec3** %6
%7 = load %struct.quat*, %struct.quat** %4
%8 = bitcast %struct.quat* %7 to float*
%9 = load %struct.vec3*, %struct.vec3** %5
%10 = bitcast %struct.vec3* %9 to float*
%11 = load %struct.vec3*, %struct.vec3** %6
%12 = bitcast %struct.vec3* %11 to float*
%13 = call i32 @quat_from_vec3(float* %8, float* %10, float* %12)
%14 = load %struct.quat*, %struct.quat** %4
ret %struct.quat* %14
}

LLVM IR (-O2):
%struct.quat = type { i32 }
%struct.vec3 = type { i32 }
define %struct.quat* @psquat_from_vec3(%struct.quat* returned %0, %struct.vec3* %1, %struct.vec3* %2) {
%4 = bitcast %struct.quat* %0 to float*
%5 = bitcast %struct.vec3* %1 to float*
%6 = bitcast %struct.vec3* %2 to float*
%7 = tail call i32 @quat_from_vec3(float* %4, float* %5, float* %6)
ret %struct.quat* %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int num, size = 2;
  num = (size > 5) ? 3 : 33;
  printf("size = %i, num = %i\n", size, num);
  size = 10;
  num = size > 5 ? 3 : 33;
  printf("size = %i, num = %i\n", size, num);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    $0x21,%eax
mov    $0x3,%ecx
cmp    $0x5,%edx
cmovg  %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
movl   $0xa,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    $0x21,%eax
mov    $0x3,%ecx
cmp    $0x5,%edx
cmovg  %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [21 x i8] c"size = %i, num = %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 2, i32* %3
%4 = load i32, i32* %3
%5 = icmp sgt i32 %4, 5
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 3, i32 33
store i32 %7, i32* %2
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
store i32 10, i32* %3
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 5
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 3, i32 33
store i32 %14, i32* %2
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"size = %i, num = %i\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 2, i32 33)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 10, i32 3)
ret i32 0
}
int derefArgCast(char *p) { return *p; }


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

x86 assembly (clang, -O2):
<derefArgCast>:
movsbl (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @derefArgCast(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_help_serial(void) {
  printf(" -S, --serial=DEV\n");
  printf("      Servial device to use.\n");
  printf(" -s, --speed=SPEED\n");
  printf("      Connection speed. (Default to 9600)\n");
}


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

x86 assembly (clang, -O2):
<print_help_serial>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeee(%rip),%rdi
call   1030 <puts@plt>
lea    0xeff(%rip),%rdi
call   1030 <puts@plt>
lea    0xf06(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [19 x i8] c" -S, --serial=DEV\0A\00"
@.str.1 = [30 x i8] c" Servial device to use.\0A\00"
@.str.2 = [20 x i8] c" -s, --speed=SPEED\0A\00"
@.str.3 = [43 x i8] c" Connection speed. (Default to 9600)\0A\00"
define void @print_help_serial() {
%1 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [18 x i8] c" -S, --serial=DEV\00"
@str.4 = [29 x i8] c" Servial device to use.\00"
@str.5 = [19 x i8] c" -s, --speed=SPEED\00"
@str.6 = [42 x i8] c" Connection speed. (Default to 9600)\00"
define void @print_help_serial() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.6, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ st_in_debug();
int call_to_debug() {
  int x = 0;
  int y = 1;
  int z = x + y;
  do {
    printf("DOWHILE0ONHFILE\n");
  } while (0);
  st_in_debug();
  return 0;
}


x86 assembly (clang, -O0):
<call_to_debug>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <st_in_debug@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [17 x i8] c"DOWHILE0ONHFILE\0A\00"
define i32 @call_to_debug() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = add nsw i32 %4, %5
store i32 %6, i32* %3
br label %7
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7
%10 = call i32 (...) @st_in_debug()
ret i32 0
}

LLVM IR (-O2):
@str = [16 x i8] c"DOWHILE0ONHFILE\00"
define i32 @call_to_debug() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @st_in_debug()
ret i32 0
}
/* Type definitions */
struct event_base {
  int dummy;
};
struct bufferevent {
  int dummy;
};
typedef int /*<<< orphan*/ evutil_socket_t;

/* Variables and functions */
struct bufferevent *bufferevent_socket_new(struct event_base *base,
                                           evutil_socket_t fd, int options) {
  (void)base;
  (void)fd;
  (void)options;
  return NULL;
}


x86 assembly (clang, -O0):
<bufferevent_socket_new>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.bufferevent = type { i32 }
%struct.event_base = type { i32 }
define %struct.bufferevent* @bufferevent_socket_new(%struct.event_base* %0, i32 %1, i32 %2) {
%4 = alloca %struct.event_base*
%5 = alloca i32
%6 = alloca i32
store %struct.event_base* %0, %struct.event_base** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load %struct.event_base*, %struct.event_base** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
ret %struct.bufferevent* null
}

LLVM IR (-O2):
%struct.bufferevent = type { i32 }
%struct.event_base = type { i32 }
define noalias %struct.bufferevent* @bufferevent_socket_new(%struct.event_base* nocapture readnone %0, i32 %1, i32 %2) {
ret %struct.bufferevent* null
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *name) {
  fprintf(stderr,
          "Usage: %s [-a] [-h] [-ic input card] [-id input device] "
          "[-oc output card] [-d output device] [-a] [-h] [-i]\n\n"
          "\t-ic, -id, -oc and -od specify ALSA card and device numbers\n"
          "\t-a : enables AccessoryChat mode\n"
          "\t-i : enables HID pass through (requires running as root\n"
          "\t-h : prints this usage message\n",
          name);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [292 x i8] c"Usage: %s [-a] [-h] [-ic input card] [-id input device] [-oc output card] [-d output device] [-a] [-h] [-i]\0A\0A\09-ic, -id, -oc and -od specify ALSA card and device numbers\0A\09-a : enables AccessoryChat mode\0A\09-i : enables HID pass through (requires running as root\0A\09-h : prints this usage message\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([292 x i8], [292 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [292 x i8] c"Usage: %s [-a] [-h] [-ic input card] [-id input device] [-oc output card] [-d output device] [-a] [-h] [-i]\0A\0A\09-ic, -id, -oc and -od specify ALSA card and device numbers\0A\09-a : enables AccessoryChat mode\0A\09-i : enables HID pass through (requires running as root\0A\09-h : prints this usage message\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([292 x i8], [292 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ htcp_register();
int /*<<< orphan*/ set_linux_file_name(char *);
void module_register(void) {
  htcp_register();
  set_linux_file_name("tcp_htcp.c");
}


x86 assembly (clang, -O0):
<module_register>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <htcp_register@plt>
lea    0xece(%rip),%rdi
call   1040 <set_linux_file_name@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<module_register>:
push   %rax
xor    %eax,%eax
call   1030 <htcp_register@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1040 <set_linux_file_name@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"tcp_htcp.c\00"
define void @module_register() {
%1 = call i32 (...) @htcp_register()
%2 = call i32 @set_linux_file_name(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"tcp_htcp.c\00"
define void @module_register() {
%1 = tail call i32 (...) @htcp_register()
%2 = tail call i32 @set_linux_file_name(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ ece391_fdputs(int, int /*<<< orphan*/ *);
int main() {
  ece391_fdputs(
      1, (uint8_t *)"Hello, if this ran, the program was correct. Yay!\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rsi
mov    $0x1,%edi
call   1030 <ece391_fdputs@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [51 x i8] c"Hello, if this ran, the program was correct. Yay!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @ece391_fdputs(i32 1, i32* bitcast ([51 x i8]* @.str to i32*))
ret i32 0
}

LLVM IR (-O2):
@.str = [51 x i8] c"Hello, if this ran, the program was correct. Yay!\0A\00"
define i32 @main() {
%1 = tail call i32 @ece391_fdputs(i32 1, i32* bitcast ([51 x i8]* @.str to i32*))
ret i32 0
}
int fun1005() { return 1005; }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    $0x3ed,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    $0x3ed,%eax
ret

LLVM IR (-O0):
define i32 @fun1005() {
ret i32 1005
}

LLVM IR (-O2):
define i32 @fun1005() {
ret i32 1005
}
/* Variables and functions */
int /*<<< orphan*/ switchValues(int *, char *, int, int);
void sort(int *freqs, char *sortedStates) {
  switchValues(freqs, sortedStates, 0, 1);
  switchValues(freqs, sortedStates, 2, 3);
  switchValues(freqs, sortedStates, 0, 2);
  switchValues(freqs, sortedStates, 1, 3);
  switchValues(freqs, sortedStates, 1, 2);
}


x86 assembly (clang, -O0):
<sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
mov    $0x1,%ecx
call   1030 <switchValues@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x2,%edx
mov    $0x3,%ecx
call   1030 <switchValues@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
mov    $0x2,%ecx
call   1030 <switchValues@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
mov    $0x3,%ecx
call   1030 <switchValues@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
mov    $0x2,%ecx
call   1030 <switchValues@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sort>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edx,%edx
mov    $0x1,%ecx
call   1030 <switchValues@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x2,%edx
mov    $0x3,%ecx
call   1030 <switchValues@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
mov    $0x2,%ecx
call   1030 <switchValues@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
mov    $0x3,%ecx
call   1030 <switchValues@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
mov    $0x2,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <switchValues@plt>

LLVM IR (-O0):
define void @sort(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i32*, i32** %3
%6 = load i8*, i8** %4
%7 = call i32 @switchValues(i32* %5, i8* %6, i32 0, i32 1)
%8 = load i32*, i32** %3
%9 = load i8*, i8** %4
%10 = call i32 @switchValues(i32* %8, i8* %9, i32 2, i32 3)
%11 = load i32*, i32** %3
%12 = load i8*, i8** %4
%13 = call i32 @switchValues(i32* %11, i8* %12, i32 0, i32 2)
%14 = load i32*, i32** %3
%15 = load i8*, i8** %4
%16 = call i32 @switchValues(i32* %14, i8* %15, i32 1, i32 3)
%17 = load i32*, i32** %3
%18 = load i8*, i8** %4
%19 = call i32 @switchValues(i32* %17, i8* %18, i32 1, i32 2)
ret void
}

LLVM IR (-O2):
define void @sort(i32* %0, i8* %1) {
%3 = tail call i32 @switchValues(i32* %0, i8* %1, i32 0, i32 1)
%4 = tail call i32 @switchValues(i32* %0, i8* %1, i32 2, i32 3)
%5 = tail call i32 @switchValues(i32* %0, i8* %1, i32 0, i32 2)
%6 = tail call i32 @switchValues(i32* %0, i8* %1, i32 1, i32 3)
%7 = tail call i32 @switchValues(i32* %0, i8* %1, i32 1, i32 2)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t present_sbox_inv(uint8_t b) {
  static const uint8_t sb[] = {0x5, 0xE, 0xF, 0x8, 0xC, 0x1, 0x2, 0xD,
                               0xB, 0x4, 0x6, 0x3, 0x0, 0x7, 0x9, 0xA};
  return ((sb[b >> 4]) << 4) | (sb[b & 0xf]);
}


x86 assembly (clang, -O0):
<present_sbox_inv>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
movslq %eax,%rcx
lea    0xee9(%rip),%rax
mov    (%rax,%rcx,4),%eax
shl    $0x4,%eax
mov    -0x4(%rbp),%ecx
and    $0xf,%ecx
movslq %ecx,%rdx
lea    0xed3(%rip),%rcx
or     (%rcx,%rdx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<present_sbox_inv>:
mov    %edi,%eax
sar    $0x4,%eax
cltq
lea    0xef2(%rip),%rcx
mov    (%rcx,%rax,4),%eax
shl    $0x4,%eax
and    $0xf,%edi
or     (%rcx,%rdi,4),%eax
ret

LLVM IR (-O0):
@present_sbox_inv.sb = internal constant [16 x i32] [i32 5, i32 14, i32 15, i32 8, i32 12, i32 1, i32 2, i32 13, i32 11, i32 4, i32 6, i32 3, i32 0, i32 7, i32 9, i32 10]
define i32 @present_sbox_inv(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 4
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds [16 x i32], [16 x i32]* @present_sbox_inv.sb, i64 0, i64 %5
%7 = load i32, i32* %6
%8 = shl i32 %7, 4
%9 = load i32, i32* %2
%10 = and i32 %9, 15
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [16 x i32], [16 x i32]* @present_sbox_inv.sb, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = or i32 %8, %13
ret i32 %14
}

LLVM IR (-O2):
@present_sbox_inv.sb = internal unnamed_addr constant [16 x i32] [i32 5, i32 14, i32 15, i32 8, i32 12, i32 1, i32 2, i32 13, i32 11, i32 4, i32 6, i32 3, i32 0, i32 7, i32 9, i32 10]
define i32 @present_sbox_inv(i32 %0) {
%2 = ashr i32 %0, 4
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds [16 x i32], [16 x i32]* @present_sbox_inv.sb, i64 0, i64 %3
%5 = load i32, i32* %4
%6 = shl i32 %5, 4
%7 = and i32 %0, 15
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds [16 x i32], [16 x i32]* @present_sbox_inv.sb, i64 0, i64 %8
%10 = load i32, i32* %9
%11 = or i32 %6, %10
ret i32 %11
}
int nwd(int a, int b) {
  if (b == 0)
    return a;
  else
    return nwd(b, a % b);
}


x86 assembly (clang, -O0):
<nwd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1133 <nwd+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1147 <nwd+0x37>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%esi
call   1030 <nwd@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nwd>:
mov    %edi,%eax
test   %esi,%esi
je     111d <nwd+0x1d>
mov    %esi,%edx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <nwd+0x10>
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @nwd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %4
store i32 %9, i32* %3
br label %16
10: ; preds = %2
%11 = load i32, i32* %5
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = srem i32 %12, %13
%15 = call i32 @nwd(i32 %11, i32 %14)
store i32 %15, i32* %3
br label %16
16: ; preds = %10, %8
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @nwd(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = phi i32 [ %5, %4 ], [ %0, %2 ]
%7 = srem i32 %6, %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %5, %4 ]
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
scalar_t__ bme_bf_addr(int /*<<< orphan*/ volatile *, int /*<<< orphan*/,
                       int /*<<< orphan*/);
volatile uint32_t *bme_bitfield32(volatile uint32_t *ptr, uint8_t bit,
                                  uint8_t width) {
  return (volatile uint32_t *)(bme_bf_addr(ptr, bit, width));
}


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

x86 assembly (clang, -O2):
<bme_bitfield32>:
jmp    1030 <bme_bf_addr@plt>

LLVM IR (-O0):
define i32* @bme_bitfield32(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 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i64 @bme_bf_addr(i32* %7, i32 %8, i32 %9)
%11 = inttoptr i64 %10 to i32*
ret i32* %11
}

LLVM IR (-O2):
define i32* @bme_bitfield32(i32* %0, i32 %1, i32 %2) {
%4 = tail call i64 @bme_bf_addr(i32* %0, i32 %1, i32 %2)
%5 = inttoptr i64 %4 to i32*
ret i32* %5
}
unsigned long f4(unsigned long x, unsigned int y) {
  return x & ((1L << y) - 1);
}


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%rdx
mov    %rdx,%rcx
sub    $0x1,%rcx
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4>:
mov    %esi,%ecx
mov    $0xffffffffffffffff,%rax
shl    %cl,%rax
not    %rax
and    %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @f4(i64 %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = shl nsw i64 -1, %3
%5 = xor i64 %4, -1
%6 = and i64 %5, %0
ret i64 %6
}
/* Type definitions */
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
int getpeername(int, struct sockaddr *, int /*<<< orphan*/ *);
__attribute__((weak)) int __real_getpeername(int fd, struct sockaddr *name,
                                             socklen_t *namelen) {
  return getpeername(fd, name, namelen);
}


x86 assembly (clang, -O0):
<__real_getpeername>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <getpeername@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__real_getpeername>:
jmp    1030 <getpeername@plt>

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
define weak i32 @__real_getpeername(i32 %0, %struct.sockaddr* %1, i32* %2) {
%4 = alloca i32
%5 = alloca %struct.sockaddr*
%6 = alloca i32*
store i32 %0, i32* %4
store %struct.sockaddr* %1, %struct.sockaddr** %5
store i32* %2, i32** %6
%7 = load i32, i32* %4
%8 = load %struct.sockaddr*, %struct.sockaddr** %5
%9 = load i32*, i32** %6
%10 = call i32 @getpeername(i32 %7, %struct.sockaddr* %8, i32* %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
define weak i32 @__real_getpeername(i32 %0, %struct.sockaddr* %1, i32* %2) {
%4 = tail call i32 @getpeername(i32 %0, %struct.sockaddr* %1, i32* %2)
ret i32 %4
}
int cmp(const void *a, const void *b) { return (*(char *)a) - (*(char *)b); }


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

x86 assembly (clang, -O2):
<cmp>:
movsbl (%rdi),%eax
movsbl (%rsi),%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = sext i8 %3 to i32
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Type definitions */
struct timespec {
  double tv_sec;
  int tv_nsec;
};

/* Variables and functions */
double diff_timespec(struct timespec *ts1, struct timespec *ts2) {
  return ts1->tv_sec - ts2->tv_sec + (ts1->tv_nsec - ts2->tv_nsec) / 1e9;
}


x86 assembly (clang, -O0):
<diff_timespec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    -0x10(%rbp),%rcx
sub    0x8(%rcx),%eax
cvtsi2sd %eax,%xmm1
movsd  0xeca(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<diff_timespec>:
movsd  (%rdi),%xmm1
subsd  (%rsi),%xmm1
mov    0x8(%rdi),%eax
sub    0x8(%rsi),%eax
cvtsi2sd %eax,%xmm0
divsd  0xee6(%rip),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
%struct.timespec = type { double, i32 }
define double @diff_timespec(%struct.timespec* %0, %struct.timespec* %1) {
%3 = alloca %struct.timespec*
%4 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %3
store %struct.timespec* %1, %struct.timespec** %4
%5 = load %struct.timespec*, %struct.timespec** %3
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 0
%7 = load double, double* %6
%8 = load %struct.timespec*, %struct.timespec** %4
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 0
%10 = load double, double* %9
%11 = fsub double %7, %10
%12 = load %struct.timespec*, %struct.timespec** %3
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %12, i32 0, i32 1
%14 = load i32, i32* %13
%15 = load %struct.timespec*, %struct.timespec** %4
%16 = getelementptr inbounds %struct.timespec, %struct.timespec* %15, i32 0, i32 1
%17 = load i32, i32* %16
%18 = sub nsw i32 %14, %17
%19 = sitofp i32 %18 to double
%20 = fdiv double %19, 1.000000e+09
%21 = fadd double %11, %20
ret double %21
}

LLVM IR (-O2):
%struct.timespec = type { double, i32 }
define double @diff_timespec(%struct.timespec* nocapture %0, %struct.timespec* nocapture %1) {
%3 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%6 = load double, double* %5
%7 = fsub double %4, %6
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%9 = load i32, i32* %8
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%11 = load i32, i32* %10
%12 = sub nsw i32 %9, %11
%13 = sitofp i32 %12 to double
%14 = fdiv double %13, 1.000000e+09
%15 = fadd double %7, %14
ret double %15
}
/* Variables and functions */
bool protocolIdMatch(char *buffer) {
  if ((0x9f77 >> 8) == (unsigned char)buffer[12] &&
      (0x9f77 & 0xff) == (unsigned char)buffer[13]) {
    return true;
  } else {
    return false;
  }
}


x86 assembly (clang, -O0):
<protocolIdMatch>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl 0xc(%rax),%ecx
mov    $0x9f,%eax
cmp    %ecx,%eax
jne    113e <protocolIdMatch+0x3e>
mov    -0x10(%rbp),%rax
movzbl 0xd(%rax),%ecx
mov    $0x77,%eax
cmp    %ecx,%eax
jne    113e <protocolIdMatch+0x3e>
movl   $0x1,-0x4(%rbp)
jmp    1145 <protocolIdMatch+0x45>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<protocolIdMatch>:
cmpb   $0x9f,0xc(%rdi)
jne    1111 <protocolIdMatch+0x11>
mov    $0x1,%eax
cmpb   $0x77,0xd(%rdi)
je     1113 <protocolIdMatch+0x13>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @protocolIdMatch(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 12
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, -97
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %0, i64 13
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 119
br i1 %8, label %10, label %9
9: ; preds = %5, %1
br label %10
10: ; preds = %5, %9
%11 = phi i32 [ 0, %9 ], [ 1, %5 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ Lcd_Off();
char lcdOff(void *parameters) {
  Lcd_Off();
  return 0;
}


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

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

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

LLVM IR (-O2):
define signext i8 @lcdOff(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @Lcd_Off()
ret i8 0
}
int ls_cost_nm9_n_out(void) { return 2; }


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

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

LLVM IR (-O0):
define i32 @ls_cost_nm9_n_out() {
ret i32 2
}

LLVM IR (-O2):
define i32 @ls_cost_nm9_n_out() {
ret i32 2
}
/* Variables and functions */
int platformInitByDeviceType();
int platformInit() { return platformInitByDeviceType(); }


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

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

LLVM IR (-O0):
define i32 @platformInit() {
%1 = call i32 (...) @platformInitByDeviceType()
ret i32 %1
}

LLVM IR (-O2):
define i32 @platformInit() {
%1 = tail call i32 (...) @platformInitByDeviceType()
ret i32 %1
}
void write_barrier() { __asm__ __volatile__("" : : : "memory"); }


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

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

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

LLVM IR (-O2):
define void @write_barrier() {
tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
int stringstartwith(const char *s1, const char *s2) {
  while (*s2 && (*s1++ == *s2++)) {
    ;
  }
  return *s2 == '\0';
}


x86 assembly (clang, -O0):
<stringstartwith>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     114d <stringstartwith+0x4d>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    115d <stringstartwith+0x5d>
jmp    1162 <stringstartwith+0x62>
jmp    110c <stringstartwith+0xc>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringstartwith>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rsi,%rax,1),%edx
test   %dl,%dl
je     112e <stringstartwith+0x2e>
lea    0x1(%rax),%rcx
cmp    %dl,(%rdi,%rax,1)
mov    %rcx,%rax
je     1110 <stringstartwith+0x10>
xor    %eax,%eax
cmpb   $0x0,(%rsi,%rcx,1)
sete   %al
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @stringstartwith(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i8* [ %0, %2 ], [ %9, %8 ]
%5 = phi i8* [ %1, %2 ], [ %11, %8 ]
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %17, label %8
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %4, i64 1
%10 = load i8, i8* %4
%11 = getelementptr inbounds i8, i8* %5, i64 1
%12 = icmp eq i8 %10, %6
br i1 %12, label %3, label %13
13: ; preds = %8
%14 = load i8, i8* %11
%15 = icmp eq i8 %14, 0
%16 = zext i1 %15 to i32
br label %17
17: ; preds = %3, %13
%18 = phi i32 [ %16, %13 ], [ 1, %3 ]
ret i32 %18
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ write_wave(int /*<<< orphan*/ *, double, double);
void write_init(FILE *wavfile) { write_wave(wavfile, 10.0, 2272.0); }


x86 assembly (clang, -O0):
<write_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
movsd  0xed8(%rip),%xmm0
movsd  0xed8(%rip),%xmm1
call   1030 <write_wave@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_init>:
movsd  0xee8(%rip),%xmm0
movsd  0xee8(%rip),%xmm1
jmp    1030 <write_wave@plt>

LLVM IR (-O0):
define void @write_init(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @write_wave(i32* %3, double 1.000000e+01, double 2.272000e+03)
ret void
}

LLVM IR (-O2):
define void @write_init(i32* %0) {
%2 = tail call i32 @write_wave(i32* %0, double 1.000000e+01, double 2.272000e+03)
ret void
}