xunge/DecIR huggingface dataset:
int mymod(int a, int b) {
  int c;
  if (a >= 0)
    return a % b;
  c = a;
  while (c < 0)
    c += b;
  return c;
}


x86 assembly (clang, -O0):
<mymod>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1123 <mymod+0x23>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x4(%rbp)
jmp    1147 <mymod+0x47>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    1141 <mymod+0x41>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1129 <mymod+0x29>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mymod>:
mov    %edi,%eax
test   %edi,%edi
js     110c <mymod+0xc>
cltd
idiv   %esi
mov    %edx,%eax
ret
sub    %esi,%eax
xchg   %ax,%ax
add    %esi,%eax
js     1110 <mymod+0x10>
ret

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

LLVM IR (-O2):
define i32 @mymod(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, -1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = srem i32 %0, %1
br label %10
6: ; preds = %2, %6
%7 = phi i32 [ %9, %6 ], [ %0, %2 ]
%8 = icmp slt i32 %7, 0
%9 = add nsw i32 %7, %1
br i1 %8, label %6, label %10
10: ; preds = %6, %4
%11 = phi i32 [ %5, %4 ], [ %7, %6 ]
ret i32 %11
}
int ToHexZeroCheck(unsigned z[]) {
  int i, j = 0;
  for (i = 601 - 1; i >= 0; i--) {
    if (z[i] != 0) {
      j = -1;
      break;
    }
  }
  return j;
}


x86 assembly (clang, -O0):
<ToHexZeroCheck>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x258,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1151 <ToHexZeroCheck+0x51>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     113e <ToHexZeroCheck+0x3e>
movl   $0xffffffff,-0x10(%rbp)
jmp    1151 <ToHexZeroCheck+0x51>
jmp    1143 <ToHexZeroCheck+0x43>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <ToHexZeroCheck+0x16>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ToHexZeroCheck>:
mov    $0x258,%ecx
mov    $0xffffffff,%eax
nopw   0x0(%rax,%rax,1)
mov    %ecx,%edx
cmpl   $0x0,(%rdi,%rdx,4)
jne    113c <ToHexZeroCheck+0x3c>
test   %ecx,%ecx
je     113d <ToHexZeroCheck+0x3d>
lea    -0x1(%rcx),%edx
cmpl   $0x0,(%rdi,%rdx,4)
jne    113c <ToHexZeroCheck+0x3c>
lea    -0x2(%rcx),%edx
cmpl   $0x0,(%rdi,%rdx,4)
jne    113c <ToHexZeroCheck+0x3c>
lea    -0x3(%rcx),%edx
cmpl   $0x0,(%rdi,%rdx,4)
jne    113c <ToHexZeroCheck+0x3c>
add    $0xfffffffc,%ecx
jmp    1110 <ToHexZeroCheck+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ToHexZeroCheck(i32* nocapture %0) {
br label %24
2: ; preds = %24
%3 = icmp eq i32 %25, 0
br i1 %3, label %30, label %4
4: ; preds = %2
%5 = add nsw i32 %25, -1
%6 = zext i32 %5 to i64
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %30
10: ; preds = %4
%11 = add nsw i32 %25, -2
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %0, i64 %12
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %30
16: ; preds = %10
%17 = add nsw i32 %25, -3
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %0, i64 %18
%20 = load i32, i32* %19
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %16
%23 = add nsw i32 %25, -4
br label %24
24: ; preds = %22, %1
%25 = phi i32 [ 600, %1 ], [ %23, %22 ]
%26 = zext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %0, i64 %26
%28 = load i32, i32* %27
%29 = icmp eq i32 %28, 0
br i1 %29, label %2, label %30
30: ; preds = %16, %10, %4, %24, %2
%31 = phi i32 [ 0, %2 ], [ -1, %24 ], [ -1, %4 ], [ -1, %10 ], [ -1, %16 ]
ret i32 %31
}
void ExttGroupTypeAuxTable(void) {}


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

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

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

LLVM IR (-O2):
define void @ExttGroupTypeAuxTable() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void VbExSleepMs(uint32_t msec) {}


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

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

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

LLVM IR (-O2):
define void @VbExSleepMs(i32 %0) {
ret void
}
double rssi_to_dBm(double rssi) { return -91 + 3 * (rssi - 1); }


x86 assembly (clang, -O0):
<rssi_to_dBm>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xefa(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xede(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeda(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rssi_to_dBm>:
addsd  0xef8(%rip),%xmm0
mulsd  0xef8(%rip),%xmm0
addsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @rssi_to_dBm(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fsub double %3, 1.000000e+00
%5 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %4, double -9.100000e+01)
ret double %5
}

LLVM IR (-O2):
define double @rssi_to_dBm(double %0) {
%2 = fadd double %0, -1.000000e+00
%3 = tail call double @llvm.fmuladd.f64(double %2, double 3.000000e+00, double -9.100000e+01)
ret double %3
}
void sendlogon(void) {}


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

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

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

LLVM IR (-O2):
define void @sendlogon() {
ret void
}
int main() {
  int i = 3;
  switch (i) {
  case 0:
    return 1;
  case 1:
    return 2;
  case 2:
    return 3;
  case 3:
    return 0;
  }
  return 5;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x3,%rax
ja     1167 <main+0x67>
mov    -0x10(%rbp),%rax
lea    0xed2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    116e <main+0x6e>
movl   $0x2,-0x4(%rbp)
jmp    116e <main+0x6e>
movl   $0x3,-0x4(%rbp)
jmp    116e <main+0x6e>
movl   $0x0,-0x4(%rbp)
jmp    116e <main+0x6e>
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%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
store i32 0, i32* %1
store i32 3, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %8 [
i32 0, label %4
i32 1, label %5
i32 2, label %6
i32 3, label %7
]
4: ; preds = %0
store i32 1, i32* %1
br label %9
5: ; preds = %0
store i32 2, i32* %1
br label %9
6: ; preds = %0
store i32 3, i32* %1
br label %9
7: ; preds = %0
store i32 0, i32* %1
br label %9
8: ; preds = %0
store i32 5, i32* %1
br label %9
9: ; preds = %8, %7, %6, %5, %4
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
double load_df(double *p) {
  double d = *p;
  __asm__("# reg %x0" : "+v"(d));
  return d;
}


x86 assembly (clang, -O0):
<load_df>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_df>:
movsd  (%rdi),%xmm0
ret

LLVM IR (-O0):
define double @load_df(double* %0) {
%2 = alloca double*
%3 = alloca double
store double* %0, double** %2
%4 = load double*, double** %2
%5 = load double, double* %4
store double %5, double* %3
%6 = load double, double* %3
%7 = call double asm "# reg ${0:x}", "=v,0,~{dirflag},~{fpsr},~{flags}"(double %6)
store double %7, double* %3
%8 = load double, double* %3
ret double %8
}

LLVM IR (-O2):
define double @load_df(double* nocapture %0) {
%2 = load double, double* %0
%3 = tail call double asm "# reg ${0:x}", "=v,0,~{dirflag},~{fpsr},~{flags}"(double %2)
ret double %3
}
/* Variables and functions */
int a();
int b() { return a() + 1; }


x86 assembly (clang, -O0):
<b>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <a@plt>
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<b>:
push   %rax
xor    %eax,%eax
call   1030 <a@plt>
add    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @b() {
%1 = call i32 (...) @a()
%2 = add nsw i32 %1, 1
ret i32 %2
}

LLVM IR (-O2):
define i32 @b() {
%1 = tail call i32 (...) @a()
%2 = add nsw i32 %1, 1
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ entered_string;

/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ print_reverse(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdin;
int main(int argc, char **argv) {
  char entered_string[80];
  puts("Enter a string: ");
  fgets(entered_string, sizeof(entered_string), stdin);
  printf("\n");
  print_reverse(entered_string);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
call   1030 <puts@plt>
lea    -0x60(%rbp),%rdi
mov    0x2e7b(%rip),%rax
mov    (%rax),%edx
mov    $0x50,%esi
call   1050 <fgets@plt>
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1060 <print_reverse@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
lea    0xeb4(%rip),%rdi
call   1040 <puts@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1050 <fgets@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1060 <print_reverse@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter a string: \00"
@stdin = global i32 0
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [80 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%9 = load i32, i32* @stdin
%10 = call i32 @fgets(i8* %8, i32 80, i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%13 = call i32 @print_reverse(i8* %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter a string: \00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [80 x i8]
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %4, i32 80, i32 %6)
%8 = call i32 @putchar(i32 10)
%9 = call i32 @print_reverse(i8* %4)
ret i32 0
}
void symbol_reap(unsigned long int sym) { return; }


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

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

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

LLVM IR (-O2):
define void @symbol_reap(i64 %0) {
ret void
}
void XStringToKeysym() {}


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

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

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

LLVM IR (-O2):
define void @XStringToKeysym() {
ret void
}
void prefetch(const void *ptr) { __builtin_prefetch(ptr, 0, 3); }


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

x86 assembly (clang, -O2):
<prefetch>:
prefetcht0 (%rdi)
ret

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

LLVM IR (-O2):
define void @prefetch(i8* nocapture %0) {
tail call void @llvm.prefetch.p0i8(i8* %0, i32 0, i32 3, i32 1)
ret void
}
int array_push(int v, int *array, int count) {
  for (int i = 0; i < count; ++i) {
    if (array[i] == 0) {
      array[i] = v;
      return v;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<array_push>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    115f <array_push+0x5f>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    114c <array_push+0x4c>
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1166 <array_push+0x66>
jmp    1151 <array_push+0x51>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1115 <array_push+0x15>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_push>:
test   %edx,%edx
jle    111f <array_push+0x1f>
mov    %edi,%eax
mov    %edx,%ecx
xor    %edx,%edx
nopw   0x0(%rax,%rax,1)
cmpl   $0x0,(%rsi,%rdx,4)
je     1122 <array_push+0x22>
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1110 <array_push+0x10>
xor    %eax,%eax
ret
mov    %eax,(%rsi,%rdx,4)
ret

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

LLVM IR (-O2):
define i32 @array_push(i32 %0, i32* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %18
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %15
%8 = phi i64 [ 0, %5 ], [ %16, %15 ]
%9 = getelementptr inbounds i32, i32* %1, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = and i64 %8, 4294967295
%14 = getelementptr inbounds i32, i32* %1, i64 %13
store i32 %0, i32* %14
br label %18
15: ; preds = %7
%16 = add nuw nsw i64 %8, 1
%17 = icmp eq i64 %16, %6
br i1 %17, label %18, label %7
18: ; preds = %15, %3, %12
%19 = phi i32 [ %0, %12 ], [ 0, %3 ], [ 0, %15 ]
ret i32 %19
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void mg_free(char *data) { free(data); }


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

x86 assembly (clang, -O2):
<mg_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @mg_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
void *malloc(size_t);
void *salloc(size_t size, void (*error_handle)()) {
  void *ref = malloc(size);
  if (ref == NULL) {
    error_handle();
  }
  return ref;
}


x86 assembly (clang, -O0):
<salloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    113d <salloc+0x2d>
mov    $0x0,%al
call   *-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<salloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1129 <salloc+0x19>
xor    %eax,%eax
call   *%r14
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @salloc(i64 %0, void (...)* %1) {
%3 = alloca i64
%4 = alloca void (...)*
%5 = alloca i8*
store i64 %0, i64* %3
store void (...)* %1, void (...)** %4
%6 = load i64, i64* %3
%7 = call i8* @malloc(i64 %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load void (...)*, void (...)** %4
br label %12
12: ; preds = %10, %2
%13 = load i8*, i8** %5
ret i8* %13
}

LLVM IR (-O2):
define i8* @salloc(i64 %0, void (...)* nocapture %1) {
%3 = tail call i8* @malloc(i64 %0)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %6
5: ; preds = %2
tail call void (...) %1()
br label %6
6: ; preds = %5, %2
ret i8* %3
}
/* Type definitions */
struct dirent {
  int /*<<< orphan*/ d_type;
};

/* Variables and functions */
int /*<<< orphan*/ DTTOIF(int /*<<< orphan*/);
int S_ISREG(int /*<<< orphan*/);
int reg_filter(const struct dirent *p) { return S_ISREG(DTTOIF(p->d_type)); }


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

x86 assembly (clang, -O2):
<reg_filter>:
push   %rax
mov    (%rdi),%edi
call   1040 <DTTOIF@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <S_ISREG@plt>

LLVM IR (-O0):
%struct.dirent = type { i32 }
define i32 @reg_filter(%struct.dirent* %0) {
%2 = alloca %struct.dirent*
store %struct.dirent* %0, %struct.dirent** %2
%3 = load %struct.dirent*, %struct.dirent** %2
%4 = getelementptr inbounds %struct.dirent, %struct.dirent* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = call i32 @DTTOIF(i32 %5)
%7 = call i32 @S_ISREG(i32 %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.dirent = type { i32 }
define i32 @reg_filter(%struct.dirent* nocapture %0) {
%2 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = tail call i32 @DTTOIF(i32 %3)
%5 = tail call i32 @S_ISREG(i32 %4)
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ StubBug(char *);
int sigpending(sigset_t *set) {
  (void)set;
  StubBug("STUB:"
          "sigpending");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"STUB:sigpending\00"
define i32 @sigpending(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @StubBug(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"STUB:sigpending\00"
define i32 @sigpending(i32* nocapture readnone %0) {
%2 = tail call i32 @StubBug(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void f14(void) {}


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

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

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

LLVM IR (-O2):
define void @f14() {
ret void
}
int intlen(unsigned i) { return i < 10 ? 1 : 1 + intlen(i / 10); }


x86 assembly (clang, -O0):
<intlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jae    1132 <intlen+0x22>
mov    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114b <intlen+0x3b>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,%edi
call   1030 <intlen@plt>
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intlen>:
mov    $0x1,%eax
cmp    $0xa,%edi
jb     1134 <intlen+0x34>
mov    $0x1,%eax
mov    $0xcccccccd,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %edi,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
add    $0x1,%eax
cmp    $0x63,%edi
mov    %edx,%edi
ja     1120 <intlen+0x20>
ret

LLVM IR (-O0):
define i32 @intlen(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ult i32 %3, 10
br i1 %4, label %5, label %6
5: ; preds = %1
br label %11
6: ; preds = %1
%7 = load i32, i32* %2
%8 = udiv i32 %7, 10
%9 = call i32 @intlen(i32 %8)
%10 = add nsw i32 1, %9
br label %11
11: ; preds = %6, %5
%12 = phi i32 [ 1, %5 ], [ %10, %6 ]
ret i32 %12
}

LLVM IR (-O2):
define i32 @intlen(i32 %0) {
%2 = icmp ult i32 %0, 10
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ %0, %1 ]
%5 = phi i32 [ %7, %3 ], [ 0, %1 ]
%6 = udiv i32 %4, 10
%7 = add nuw nsw i32 %5, 1
%8 = icmp ult i32 %4, 100
br i1 %8, label %9, label %3
9: ; preds = %3
%10 = add nuw i32 %5, 2
br label %11
11: ; preds = %9, %1
%12 = phi i32 [ 1, %1 ], [ %10, %9 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ foo3(int *);
void bar3(int *y) { foo3(y); }


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

x86 assembly (clang, -O2):
<bar3>:
jmp    1030 <foo3@plt>

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

LLVM IR (-O2):
define void @bar3(i32* %0) {
%2 = tail call i32 @foo3(i32* %0)
ret void
}
void XShapeSelectInput() {}


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

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

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

LLVM IR (-O2):
define void @XShapeSelectInput() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ stderr;
int _ls_error(char const *message, int ret) {
  fputs("ls"
        ": ",
        stderr);
  perror(message);
  return ret;
}


x86 assembly (clang, -O0):
<_ls_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%esi
lea    0xec1(%rip),%rdi
call   1030 <fputs@plt>
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ls_error>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
lea    0xec8(%rip),%rdi
call   1030 <fputs@plt>
mov    %rbx,%rdi
call   1040 <perror@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"ls: \00"
@stderr = global i32 0
define i32 @_ls_error(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i8*, i8** %3
%8 = call i32 @perror(i8* %7)
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
@.str = [5 x i8] c"ls: \00"
@stderr = global i32 0
define i32 @_ls_error(i8* nocapture %0, i32 returned %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @perror(i8* %0)
ret i32 %1
}
void call_usermodehelper_keys(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<call_usermodehelper_keys>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_usermodehelper_keys>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.call_usermodehelper_keys = [25 x i8] c"call_usermodehelper_keys\00"
define void @call_usermodehelper_keys() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @__func__.call_usermodehelper_keys, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.call_usermodehelper_keys = [25 x i8] c"call_usermodehelper_keys\00"
define void @call_usermodehelper_keys() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @__func__.call_usermodehelper_keys, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ StudentModel_addStudent(char *, char *, int, char *, char *,
                                           char *);
void Controller_addStudent(char name[], char course[], int year,
                           char studentNumber[], char subjects[],
                           char grades[]) {
  StudentModel_addStudent(name, course, year, studentNumber, subjects, grades);
  return;
}


x86 assembly (clang, -O0):
<Controller_addStudent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
call   1030 <StudentModel_addStudent@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Controller_addStudent>:
jmp    1030 <StudentModel_addStudent@plt>

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

LLVM IR (-O2):
define void @Controller_addStudent(i8* %0, i8* %1, i32 %2, i8* %3, i8* %4, i8* %5) {
%7 = tail call i32 @StudentModel_addStudent(i8* %0, i8* %1, i32 %2, i8* %3, i8* %4, i8* %5)
ret void
}
long call(long (*f)(long), long arg) { return f(arg); }


x86 assembly (clang, -O0):
<call>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call>:
mov    %rdi,%rax
mov    %rsi,%rdi
jmp    *%rax

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

LLVM IR (-O2):
define i64 @call(i64 (i64)* nocapture %0, i64 %1) {
%3 = tail call i64 %0(i64 %1)
ret i64 %3
}
void foo(void *p, void *q, unsigned s) { __builtin_memcpy(p, q, s); }


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

x86 assembly (clang, -O2):
<foo>:
mov    %edx,%edx
jmp    1030 <memcpy@plt>

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

LLVM IR (-O2):
define void @foo(i8* nocapture writeonly %0, i8* nocapture %1, i32 %2) {
%4 = zext i32 %2 to i64
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 %1, i64 %4, i1 false)
ret void
}
int chdir(const char *pathname) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @chdir(i8* nocapture readnone %0) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ test_assert_double_eq_add_test();
void test_assert_double_eq_add_test_constructor(void) {
  test_assert_double_eq_add_test();
}


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

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

LLVM IR (-O0):
define void @test_assert_double_eq_add_test_constructor() {
%1 = call i32 (...) @test_assert_double_eq_add_test()
ret void
}

LLVM IR (-O2):
define void @test_assert_double_eq_add_test_constructor() {
%1 = tail call i32 (...) @test_assert_double_eq_add_test()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void safeExitErr(char *str) {
  fprintf(stderr, "Error occurred: %s\n", str);
  exit(1);
}


x86 assembly (clang, -O0):
<safeExitErr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<safeExitErr>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"Error occurred: %s\0A\00"
define void @safeExitErr(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 ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"Error occurred: %s\0A\00"
define void @safeExitErr(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
size_t read(int, void *, size_t);
int ReadFile(int fd, void *address, size_t length) {
  assert(fd != -1);
  if (read(fd, address, length) != length)
    return (-1);
  return (0);
}


x86 assembly (clang, -O0):
<ReadFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <read@plt>
cmp    -0x18(%rbp),%rax
je     116a <ReadFile+0x4a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1171 <ReadFile+0x51>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadFile>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0xffffffff,%ebp
setne  %dil
call   1040 <assert@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <read@plt>
xor    %ecx,%ecx
cmp    %rbx,%rax
setne  %cl
neg    %ecx
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @ReadFile(i32 %0, i8* nocapture %1, i64 %2) {
%4 = icmp ne i32 %0, -1
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i64 @read(i32 %0, i8* %1, i64 %2)
%8 = icmp ne i64 %7, %2
%9 = sext i1 %8 to i32
ret i32 %9
}
/* Type definitions */
struct UPnPService {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void RNDResponseSink_ContentDirectory_DeleteResource(
    struct UPnPService *Service, int ErrorCode, void *User) {
  printf("RND Invoke Response: "
         "ContentDirectory/DeleteResource[ErrorCode:%d]()\r\n",
         ErrorCode);
}


x86 assembly (clang, -O0):
<RNDResponseSink_ContentDirectory_DeleteResource>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%esi
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.UPnPService = type { i32 }
@.str = [71 x i8] c"RND Invoke Response: ContentDirectory/DeleteResource[ErrorCode:%d]()\0D\0A\00"
define void @RNDResponseSink_ContentDirectory_DeleteResource(%struct.UPnPService* %0, i32 %1, i8* %2) {
%4 = alloca %struct.UPnPService*
%5 = alloca i32
%6 = alloca i8*
store %struct.UPnPService* %0, %struct.UPnPService** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %5
%8 = call i32 @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i32 %7)
ret void
}

LLVM IR (-O2):
%struct.UPnPService = type { i32 }
@.str = [71 x i8] c"RND Invoke Response: ContentDirectory/DeleteResource[ErrorCode:%d]()\0D\0A\00"
define void @RNDResponseSink_ContentDirectory_DeleteResource(%struct.UPnPService* nocapture readnone %0, i32 %1, i8* nocapture readnone %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int test_bit_reverse8(int);
int main() { assert(test_bit_reverse8(127) == 254); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7f,%edi
call   1040 <test_bit_reverse8@plt>
cmp    $0xfe,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x7f,%edi
call   1040 <test_bit_reverse8@plt>
xor    %edi,%edi
cmp    $0xfe,%eax
sete   %dil
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @test_bit_reverse8(i32 127)
%2 = icmp eq i32 %1, 254
%3 = zext i1 %2 to i32
%4 = call i32 @assert(i32 %3)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @test_bit_reverse8(i32 127)
%2 = icmp eq i32 %1, 254
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ sem_t;

/* Variables and functions */
int sem_unlink(char *);
int main(int argc, char **argv) {
  sem_t *sem;
  int ret;
  int sval;
  ret = sem_unlink("/sem_test");
  return ret;
}


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

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

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

LLVM IR (-O2):
@.str = [10 x i8] c"/sem_test\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @sem_unlink(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 %3
}
unsigned int unsignedint_ignoring_signedshort(unsigned int x, signed short y) {
  return x;
}


x86 assembly (clang, -O0):
<unsignedint_ignoring_signedshort>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %edi,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @unsignedint_ignoring_signedshort(i32 returned %0, i16 signext %1) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Welcome ");
  printf("to C!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
call   1030 <printf@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    0xed5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Welcome \00"
@.str.1 = [7 x i8] c"to C!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"Welcome \00"
@str = [6 x i8] c"to C!\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ child_ps_unix();
void child_ps(void) { child_ps_unix(); }


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

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

LLVM IR (-O0):
define void @child_ps() {
%1 = call i32 (...) @child_ps_unix()
ret void
}

LLVM IR (-O2):
define void @child_ps() {
%1 = tail call i32 (...) @child_ps_unix()
ret void
}
/* Variables and functions */
char *eembed_sprintf_to_str(char *, size_t, char *, long double);
char *eembed_float_to_str(char *buf, size_t len, long double f) {
  return eembed_sprintf_to_str(buf, len, "%Lg", f);
}


x86 assembly (clang, -O0):
<eembed_float_to_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
fldt   0x10(%rbp)
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
fstpt  -0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xec3(%rip),%rdx
call   1030 <eembed_sprintf_to_str@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eembed_float_to_str>:
lea    0xee9(%rip),%rdx
jmp    1030 <eembed_sprintf_to_str@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%Lg\00"
define i8* @eembed_float_to_str(i8* %0, i64 %1, x86_fp80 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca x86_fp80
store i8* %0, i8** %4
store i64 %1, i64* %5
store x86_fp80 %2, x86_fp80* %6
%7 = load i8*, i8** %4
%8 = load i64, i64* %5
%9 = load x86_fp80, x86_fp80* %6
%10 = call i8* @eembed_sprintf_to_str(i8* %7, i64 %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), x86_fp80 %9)
ret i8* %10
}

LLVM IR (-O2):
@.str = [4 x i8] c"%Lg\00"
define i8* @eembed_float_to_str(i8* %0, i64 %1, x86_fp80 %2) {
%4 = tail call i8* @eembed_sprintf_to_str(i8* %0, i64 %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), x86_fp80 %2)
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int /*<<< orphan*/,
                           char const *);
int /*<<< orphan*/ send_status(int /*<<< orphan*/ *, int, char const *);
int /*<<< orphan*/ strlen(char const *);
void send_response(FILE *client, int code, const char *reason_phrase,
                   const char *message_body) {
  send_status(client, code, reason_phrase);
  fprintf(client, "Connection: close\r\nContent-length: %zu\r\n\r\n%s",
          strlen(message_body), message_body);
}


x86 assembly (clang, -O0):
<send_response>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <send_status@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%edx
mov    -0x20(%rbp),%rcx
lea    0xe87(%rip),%rsi
call   1050 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_response>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdi,%rbx
call   1030 <send_status@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    0xeb2(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <fprintf@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"Connection: close\0D\0AContent-length: %zu\0D\0A\0D\0A%s\00"
define void @send_response(i32* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i32* %0, i32** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i32*, i32** %5
%10 = load i32, i32* %6
%11 = load i8*, i8** %7
%12 = call i32 @send_status(i32* %9, i32 %10, i8* %11)
%13 = load i32*, i32** %5
%14 = load i8*, i8** %8
%15 = call i32 @strlen(i8* %14)
%16 = load i8*, i8** %8
%17 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %15, i8* %16)
ret void
}

LLVM IR (-O2):
@.str = [45 x i8] c"Connection: close\0D\0AContent-length: %zu\0D\0A\0D\0A%s\00"
define void @send_response(i32* %0, i32 %1, i8* %2, i8* %3) {
%5 = tail call i32 @send_status(i32* %0, i32 %1, i8* %2)
%6 = tail call i32 @strlen(i8* %3)
%7 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %6, i8* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(int);
int main() {
  int *p = (int *)malloc(sizeof(int));
  free(p);
  free(p);
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32*
%2 = call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = call i32 @free(i32* %4)
%6 = load i32*, i32** %1
%7 = call i32 @free(i32* %6)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @malloc(i32 4)
%2 = inttoptr i64 %1 to i32*
%3 = tail call i32 @free(i32* %2)
%4 = tail call i32 @free(i32* %2)
ret i32 0
}
void f(void) {
  int a[10];
  a[1] = 3;
  a[1] = 3.4;
  a[1] = 3.4f;
  a[1] = '\0';
  *a = 3;
  *a = 3.4;
  *a = 3.4f;
  *a = '\0';
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movl   $0x3,-0x2c(%rbp)
movl   $0x3,-0x2c(%rbp)
movl   $0x3,-0x2c(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x3,-0x30(%rbp)
movl   $0x3,-0x30(%rbp)
movl   $0x3,-0x30(%rbp)
movl   $0x0,-0x30(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f() {
%1 = alloca [10 x i32]
%2 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
store i32 3, i32* %2
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
store i32 3, i32* %3
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
store i32 3, i32* %4
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
store i32 0, i32* %5
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
store i32 3, i32* %6
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
store i32 3, i32* %7
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
store i32 3, i32* %8
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
store i32 0, i32* %9
ret void
}

LLVM IR (-O2):
define void @f() {
ret void
}