xunge/DecIR huggingface dataset:
int f(int n, int c, int s) {
  int a1, a2, x, x1, x2, x3, x4;
  a1 = 2 * s;
  if (n > 64) {
    x1 = c + a1;
    a2 = 4 * s;
    x2 = c + a2;
    x = x1 + x2;
  } else {
    x3 = c + a1;
    a2 = 4 * s;
    x4 = c + a2;
    x = x4 / x3;
  }
  return x;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x40,-0x4(%rbp)
jle    1149 <f+0x49>
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    116e <f+0x6e>
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cltd
idivl  -0x24(%rbp)
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
cmp    $0x41,%edi
jl     1112 <f+0x12>
lea    0x0(,%rdx,4),%eax
add    %edx,%esi
lea    (%rax,%rsi,2),%eax
ret
lea    (%rsi,%rdx,2),%ecx
lea    (%rsi,%rdx,4),%eax
cltd
idiv   %ecx
ret

LLVM IR (-O0):
define i32 @f(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%14 = load i32, i32* %6
%15 = mul nsw i32 2, %14
store i32 %15, i32* %7
%16 = load i32, i32* %4
%17 = icmp sgt i32 %16, 64
br i1 %17, label %18, label %30
18: ; preds = %3
%19 = load i32, i32* %5
%20 = load i32, i32* %7
%21 = add nsw i32 %19, %20
store i32 %21, i32* %10
%22 = load i32, i32* %6
%23 = mul nsw i32 4, %22
store i32 %23, i32* %8
%24 = load i32, i32* %5
%25 = load i32, i32* %8
%26 = add nsw i32 %24, %25
store i32 %26, i32* %11
%27 = load i32, i32* %10
%28 = load i32, i32* %11
%29 = add nsw i32 %27, %28
store i32 %29, i32* %9
br label %42
30: ; preds = %3
%31 = load i32, i32* %5
%32 = load i32, i32* %7
%33 = add nsw i32 %31, %32
store i32 %33, i32* %12
%34 = load i32, i32* %6
%35 = mul nsw i32 4, %34
store i32 %35, i32* %8
%36 = load i32, i32* %5
%37 = load i32, i32* %8
%38 = add nsw i32 %36, %37
store i32 %38, i32* %13
%39 = load i32, i32* %13
%40 = load i32, i32* %12
%41 = sdiv i32 %39, %40
store i32 %41, i32* %9
br label %42
42: ; preds = %30, %18
%43 = load i32, i32* %9
ret i32 %43
}

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, 64
br i1 %4, label %5, label %10
5: ; preds = %3
%6 = shl nsw i32 %2, 2
%7 = add i32 %2, %1
%8 = shl i32 %7, 1
%9 = add i32 %8, %6
br label %16
10: ; preds = %3
%11 = shl nsw i32 %2, 1
%12 = add nsw i32 %11, %1
%13 = shl nsw i32 %2, 2
%14 = add nsw i32 %13, %1
%15 = sdiv i32 %14, %12
br label %16
16: ; preds = %10, %5
%17 = phi i32 [ %9, %5 ], [ %15, %10 ]
ret i32 %17
}
/* Variables and functions */
int remove(char *);
int remove_file(char *path) { return (remove(path) * -1); }


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

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

LLVM IR (-O0):
define i32 @remove_file(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @remove(i8* %3)
%5 = mul nsw i32 %4, -1
ret i32 %5
}

LLVM IR (-O2):
define i32 @remove_file(i8* nocapture %0) {
%2 = tail call i32 @remove(i8* %0)
%3 = sub nsw i32 0, %2
ret i32 %3
}
int test_imm_54uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x54 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_54uint64_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, 84
%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_54uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 5505024
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void fistp_m32abs(unsigned int *m32) {
  if ((long)m32 & 0xFFFFFFFF80000000LL) {
    printf("Error: destination %lx not in lower 2GB for fistp_m32abs()\n",
           (long)m32);
    asm(" int $3; ");
  }
  put8(0xDB);
  put8(0x1C);
  put8(0x25);
  put32((int)(unsigned long)m32);
}


x86 assembly (clang, -O0):
<fistp_m32abs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xffffffff80000000,%rax
cmp    $0x0,%rax
je     1163 <fistp_m32abs+0x33>
mov    -0x8(%rbp),%rsi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
int3
mov    $0xdb,%edi
mov    $0x0,%al
call   1030 <put8@plt>
mov    $0x1c,%edi
mov    $0x0,%al
call   1030 <put8@plt>
mov    $0x25,%edi
mov    $0x0,%al
call   1030 <put8@plt>
mov    -0x8(%rbp),%rax
mov    %eax,%edi
mov    $0x0,%al
call   1050 <put32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fistp_m32abs>:
push   %rbx
mov    %rdi,%rbx
test   $0xffffffff80000000,%rdi
je     114f <fistp_m32abs+0x1f>
lea    0xebc(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
int3
mov    $0xdb,%edi
xor    %eax,%eax
call   1030 <put8@plt>
mov    $0x1c,%edi
xor    %eax,%eax
call   1030 <put8@plt>
mov    $0x25,%edi
xor    %eax,%eax
call   1030 <put8@plt>
mov    %ebx,%edi
xor    %eax,%eax
pop    %rbx
jmp    1050 <put32@plt>

LLVM IR (-O0):
@.str = [60 x i8] c"Error: destination %lx not in lower 2GB for fistp_m32abs()\0A\00"
define void @fistp_m32abs(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = ptrtoint i32* %3 to i64
%5 = and i64 %4, -2147483648
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32*, i32** %2
%9 = ptrtoint i32* %8 to i64
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i64 %9)
br label %11
11: ; preds = %7, %1
%12 = call i32 (i32, ...) bitcast (i32 (...)* @put8 to i32 (i32, ...)*)(i32 219)
%13 = call i32 (i32, ...) bitcast (i32 (...)* @put8 to i32 (i32, ...)*)(i32 28)
%14 = call i32 (i32, ...) bitcast (i32 (...)* @put8 to i32 (i32, ...)*)(i32 37)
%15 = load i32*, i32** %2
%16 = ptrtoint i32* %15 to i64
%17 = trunc i64 %16 to i32
%18 = call i32 (i32, ...) bitcast (i32 (...)* @put32 to i32 (i32, ...)*)(i32 %17)
ret void
}

LLVM IR (-O2):
@.str = [60 x i8] c"Error: destination %lx not in lower 2GB for fistp_m32abs()\0A\00"
define void @fistp_m32abs(i32* %0) {
%2 = ptrtoint i32* %0 to i64
%3 = icmp ult i32* %0, inttoptr (i64 2147483648 to i32*)
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i64 %2)
tail call void asm sideeffect " int $$3; ", "~{dirflag},~{fpsr},~{flags}"()
br label %6
6: ; preds = %4, %1
%7 = tail call i32 (i32, ...) bitcast (i32 (...)* @put8 to i32 (i32, ...)*)(i32 219)
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @put8 to i32 (i32, ...)*)(i32 28)
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @put8 to i32 (i32, ...)*)(i32 37)
%10 = trunc i64 %2 to i32
%11 = tail call i32 (i32, ...) bitcast (i32 (...)* @put32 to i32 (i32, ...)*)(i32 %10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ a2(int);
void a1(int n) { a2(n); }


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

x86 assembly (clang, -O2):
<a1>:
jmp    1030 <a2@plt>

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

LLVM IR (-O2):
define void @a1(i32 %0) {
%2 = tail call i32 @a2(i32 %0)
ret void
}
void unlinkdClose(void) { return; }


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

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

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

LLVM IR (-O2):
define void @unlinkdClose() {
ret void
}
/* Variables and functions */
scalar_t__ memory_free(void *, char *, int);
void text_free(void **T) {
  ((void)(memory_free((void *)(*T),
                      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                      "outputs/2022-01-22/02-19-57/repos/ASMlover/libc/refs/"
                      "heads/master/src/text.c",
                      116),
          (*T) = 0));
}


x86 assembly (clang, -O0):
<text_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
lea    0xed6(%rip),%rsi
mov    $0x74,%edx
call   1030 <memory_free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<text_free>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
lea    0xee2(%rip),%rsi
mov    $0x74,%edx
call   1030 <memory_free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
@.str = [133 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ASMlover/libc/refs/heads/master/src/text.c\00"
define void @text_free(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = load i8*, i8** %3
%5 = call i64 @memory_free(i8* %4, i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str, i64 0, i64 0), i32 116)
%6 = load i8**, i8*** %2
store i8* null, i8** %6
ret void
}

LLVM IR (-O2):
@.str = [133 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ASMlover/libc/refs/heads/master/src/text.c\00"
define void @text_free(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i64 @memory_free(i8* %2, i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str, i64 0, i64 0), i32 116)
store i8* null, i8** %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void dump(const uint8_t *p, size_t len) {
  while (len--)
    printf("%02X", *p++);
  printf("\n");
}


x86 assembly (clang, -O0):
<dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmp    $0x0,%rax
je     115d <dump+0x4d>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%esi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1120 <dump+0x10>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     1157 <dump+0x37>
mov    %rsi,%r12
mov    %rdi,%r14
lea    0xec6(%rip),%r15
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    (%r14,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <dump+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%02X\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @dump(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
br label %5
5: ; preds = %9, %2
%6 = load i64, i64* %4
%7 = add i64 %6, -1
store i64 %7, i64* %4
%8 = icmp ne i64 %6, 0
br i1 %8, label %9, label %14
9: ; preds = %5
%10 = load i32*, i32** %3
%11 = getelementptr inbounds i32, i32* %10, i32 1
store i32* %11, i32** %3
%12 = load i32, i32* %10
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %5
14: ; preds = %5
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%02X\00"
define void @dump(i32* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %7, %4 ], [ %1, %2 ]
%6 = phi i32* [ %8, %4 ], [ %0, %2 ]
%7 = add i64 %5, -1
%8 = getelementptr inbounds i32, i32* %6, i64 1
%9 = load i32, i32* %6
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = icmp eq i64 %7, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %2
%13 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int acos(int /*<<< orphan*/);
double computeOuterSquareRadius(int, double);
double getOuterCircleArea(int numSide, double regularPolygonArea) {
  double squareRadius = computeOuterSquareRadius(numSide, regularPolygonArea);
  return (2 * acos(0)) * squareRadius;
}


x86 assembly (clang, -O0):
<getOuterCircleArea>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
movsd  -0x10(%rbp),%xmm0
call   1040 <computeOuterSquareRadius@plt>
movsd  %xmm0,-0x18(%rbp)
xor    %edi,%edi
call   1030 <acos@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getOuterCircleArea>:
push   %rax
call   1040 <computeOuterSquareRadius@plt>
movsd  %xmm0,(%rsp)
xor    %edi,%edi
call   1030 <acos@plt>
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @getOuterCircleArea(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double
store i32 %0, i32* %3
store double %1, double* %4
%6 = load i32, i32* %3
%7 = load double, double* %4
%8 = call double @computeOuterSquareRadius(i32 %6, double %7)
store double %8, double* %5
%9 = call i32 @acos(i32 0)
%10 = mul nsw i32 2, %9
%11 = sitofp i32 %10 to double
%12 = load double, double* %5
%13 = fmul double %11, %12
ret double %13
}

LLVM IR (-O2):
define double @getOuterCircleArea(i32 %0, double %1) {
%3 = tail call double @computeOuterSquareRadius(i32 %0, double %1)
%4 = tail call i32 @acos(i32 0)
%5 = shl nsw i32 %4, 1
%6 = sitofp i32 %5 to double
%7 = fmul double %3, %6
ret double %7
}
/* Variables and functions */
int fix_angle(int);
int calc_middle_angle(int dir1, int dir2) {
  if ((dir2 - dir1) > 0) {
    return (fix_angle((dir2 + dir1) / 2));
  } else {
    return (fix_angle((dir2 + 3600 + dir1) / 2));
  }
}


x86 assembly (clang, -O0):
<calc_middle_angle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
cmp    $0x0,%eax
jle    114a <calc_middle_angle+0x3a>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <fix_angle@plt>
mov    %eax,-0x4(%rbp)
jmp    1167 <calc_middle_angle+0x57>
mov    -0xc(%rbp),%eax
add    $0xe10,%eax
add    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <fix_angle@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_middle_angle>:
lea    (%rsi,%rdi,1),%eax
cmp    %edi,%esi
lea    0xe10(%rsi,%rdi,1),%ecx
cmovg  %eax,%ecx
mov    %ecx,%edi
shr    $0x1f,%edi
add    %ecx,%edi
sar    %edi
jmp    1030 <fix_angle@plt>

LLVM IR (-O0):
define i32 @calc_middle_angle(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 = load i32, i32* %4
%8 = sub nsw i32 %6, %7
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i32, i32* %5
%12 = load i32, i32* %4
%13 = add nsw i32 %11, %12
%14 = sdiv i32 %13, 2
%15 = call i32 @fix_angle(i32 %14)
store i32 %15, i32* %3
br label %23
16: ; preds = %2
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 3600
%19 = load i32, i32* %4
%20 = add nsw i32 %18, %19
%21 = sdiv i32 %20, 2
%22 = call i32 @fix_angle(i32 %21)
store i32 %22, i32* %3
br label %23
23: ; preds = %16, %10
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @calc_middle_angle(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, %0
%4 = add i32 %1, %0
%5 = add i32 %4, 3600
%6 = select i1 %3, i32 %4, i32 %5
%7 = sdiv i32 %6, 2
%8 = tail call i32 @fix_angle(i32 %7)
ret i32 %8
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int __udivdi3(int, int);
uint64_t __gnu_uldivmod_helper(uint64_t a, uint64_t b, uint64_t *remainder) {
  uint64_t quotient;
  quotient = __udivdi3(a, b);
  *remainder = a - b * quotient;
  return quotient;
}


x86 assembly (clang, -O0):
<__gnu_uldivmod_helper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <__udivdi3@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%eax
imul   -0x14(%rbp),%eax
sub    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__gnu_uldivmod_helper>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %edi,%ebx
call   1030 <__udivdi3@plt>
imul   %eax,%ebp
sub    %ebp,%ebx
mov    %ebx,(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @__gnu_uldivmod_helper(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = call i32 @__udivdi3(i32 %8, i32 %9)
store i32 %10, i32* %7
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = load i32, i32* %7
%14 = mul nsw i32 %12, %13
%15 = sub nsw i32 %11, %14
%16 = load i32*, i32** %6
store i32 %15, i32* %16
%17 = load i32, i32* %7
ret i32 %17
}

LLVM IR (-O2):
define i32 @__gnu_uldivmod_helper(i32 %0, i32 %1, i32* nocapture writeonly %2) {
%4 = tail call i32 @__udivdi3(i32 %0, i32 %1)
%5 = mul nsw i32 %4, %1
%6 = sub nsw i32 %0, %5
store i32 %6, i32* %2
ret i32 %4
}
int price_replen(int num) {
  if (num < 4)
    return 2;
  num -= 2;
  return 1 + ((31 - __builtin_clz(num)) << 1);
}


x86 assembly (clang, -O0):
<price_replen>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    111d <price_replen+0x1d>
movl   $0x2,-0x4(%rbp)
jmp    113f <price_replen+0x3f>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
bsr    %eax,%ecx
xor    $0x1f,%ecx
mov    $0x1f,%eax
sub    %ecx,%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<price_replen>:
mov    $0x2,%eax
cmp    $0x4,%edi
jl     1118 <price_replen+0x18>
add    $0xfffffffe,%edi
bsr    %edi,%eax
xor    $0x1f,%eax
add    %eax,%eax
xor    $0x3f,%eax
ret

LLVM IR (-O0):
define i32 @price_replen(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 4
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 2, i32* %2
br label %15
7: ; preds = %1
%8 = load i32, i32* %3
%9 = sub nsw i32 %8, 2
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = call i32 @llvm.ctlz.i32(i32 %10, i1 true)
%12 = sub nsw i32 31, %11
%13 = shl i32 %12, 1
%14 = add nsw i32 1, %13
store i32 %14, i32* %2
br label %15
15: ; preds = %7, %6
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @price_replen(i32 %0) {
%2 = icmp slt i32 %0, 4
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = add nsw i32 %0, -2
%5 = tail call i32 @llvm.ctlz.i32(i32 %4, i1 true)
%6 = shl nuw nsw i32 %5, 1
%7 = xor i32 %6, 63
br label %8
8: ; preds = %1, %3
%9 = phi i32 [ %7, %3 ], [ 2, %1 ]
ret i32 %9
}
__attribute__((no, noclone)) signed __int128 t138_5sub(signed __int128 x) {
  signed __int128 r;
  if (__builtin_sub_overflow(x, (unsigned __int128)(1), &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t138_5sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    %rcx,%rdi
sar    $0x3f,%rdi
add    $0xffffffffffffffff,%rdx
adc    $0xffffffffffffffff,%rcx
mov    %rdi,%rsi
adc    $0xffffffffffffffff,%rsi
adc    $0xffffffffffffffff,%rdi
mov    %esi,%eax
and    $0x1,%eax
neg    %rax
mov    %rax,%r8
xor    %rdi,%r8
xor    %rsi,%rax
or     %r8,%rax
mov    %rcx,%r8
sar    $0x3f,%r8
xor    %r8,%rsi
xor    %r8,%rdi
or     %rdi,%rsi
or     %rsi,%rax
setne  %al
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x38(%rbp)
test   $0x1,%al
jne    1191 <t138_5sub+0x81>
jmp    1198 <t138_5sub+0x88>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t138_5sub>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
add    $0xffffffffffffffff,%r14
mov    %rsi,%rbx
adc    $0xffffffffffffffff,%rbx
movabs $0x8000000000000000,%rax
xor    %rsi,%rax
or     %rdi,%rax
jne    113b <t138_5sub+0x2b>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %r14,%rax
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define { i64, i64 } @t138_5sub(i64 %0, i64 %1) {
%3 = alloca i128
%4 = alloca i128
%5 = alloca i128
%6 = alloca i128
%7 = bitcast i128* %4 to { i64, i64 }*
%8 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 0
store i64 %0, i64* %8
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 1
store i64 %1, i64* %9
%10 = load i128, i128* %4
store i128 %10, i128* %5
%11 = load i128, i128* %5
%12 = sext i128 %11 to i129
%13 = call { i129, i1 } @llvm.ssub.with.overflow.i129(i129 %12, i129 1)
%14 = extractvalue { i129, i1 } %13, 1
%15 = extractvalue { i129, i1 } %13, 0
%16 = trunc i129 %15 to i128
%17 = sext i128 %16 to i129
%18 = icmp ne i129 %15, %17
%19 = or i1 %14, %18
store i128 %16, i128* %6
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 (...) @bar()
br label %22
22: ; preds = %20, %2
%23 = load i128, i128* %6
store i128 %23, i128* %3
%24 = bitcast i128* %3 to { i64, i64 }*
%25 = load { i64, i64 }, { i64, i64 }* %24
ret { i64, i64 } %25
}

LLVM IR (-O2):
define { i64, i64 } @t138_5sub(i64 %0, i64 %1) {
%3 = zext i64 %1 to i128
%4 = shl nuw i128 %3, 64
%5 = zext i64 %0 to i128
%6 = or i128 %4, %5
%7 = zext i128 %6 to i129
%8 = add nsw i129 %7, -1
%9 = icmp eq i128 %6, -170141183460469231731687303715884105728
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = tail call i32 (...) @bar()
br label %12
12: ; preds = %10, %2
%13 = trunc i129 %8 to i64
%14 = lshr i129 %8, 64
%15 = trunc i129 %14 to i64
%16 = insertvalue { i64, i64 } poison, i64 %13, 0
%17 = insertvalue { i64, i64 } %16, i64 %15, 1
ret { i64, i64 } %17
}
/* Variables and functions */
int g();
main() { return g(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @g()
ret i32 %1
}
void clear(char *s, char c) {
  while (*s != 0 && *s != c) {
    s++;
  }
  if (*s == c) {
    *s = ' ';
  }
}


x86 assembly (clang, -O0):
<clear>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xa(%rbp)
je     1136 <clear+0x36>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    1146 <clear+0x46>
jmp    1157 <clear+0x57>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110e <clear+0xe>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1171 <clear+0x71>
mov    -0x8(%rbp),%rax
movb   $0x20,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear>:
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
je     1110 <clear+0x10>
cmp    %sil,%al
jne    1100 <clear>
cmp    %sil,%al
jne    1119 <clear+0x19>
movb   $0x20,-0x1(%rdi)
ret

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

LLVM IR (-O2):
define void @clear(i8* nocapture %0, i8 signext %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %9, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = icmp eq i8 %5, %1
%8 = or i1 %6, %7
%9 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %8, label %10, label %3
10: ; preds = %3
br i1 %7, label %11, label %12
11: ; preds = %10
store i8 32, i8* %4
br label %12
12: ; preds = %11, %10
ret void
}
/* Variables and functions */
int /*<<< orphan*/ func2(int);
void func3(int i) {
  func2(i);
  return;
}


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

x86 assembly (clang, -O2):
<func3>:
jmp    1030 <func2@plt>

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

LLVM IR (-O2):
define void @func3(i32 %0) {
%2 = tail call i32 @func2(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ExitOn(char *);
void TerminateProc(int sig) { ExitOn("Got SIGINT/SIGTERM signal"); }


x86 assembly (clang, -O0):
<TerminateProc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <ExitOn@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [26 x i8] c"Got SIGINT/SIGTERM signal\00"
define void @TerminateProc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @ExitOn(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Got SIGINT/SIGTERM signal\00"
define void @TerminateProc(i32 %0) {
%2 = tail call i32 @ExitOn(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ notify_pvcall(char *);
int pvUnlockMemory(void *pMem, long dwSize) {
  notify_pvcall("f");
  return (0);
}


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

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

LLVM IR (-O0):
@.str = [2 x i8] c"f\00"
define i32 @pvUnlockMemory(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = call i32 @notify_pvcall(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"f\00"
define i32 @pvUnlockMemory(i8* nocapture readnone %0, i64 %1) {
%3 = tail call i32 @notify_pvcall(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
scalar_t__ strstr(char *, char *);
int error_line(char *line) {
  if (strstr(line, "control reaches end of non-void function")) {
    return 1;
  } else if (strstr(
                 line,
                 "suggest parentheses around assignment used as truth value")) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<error_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strstr@plt>
cmp    $0x0,%rax
je     1142 <error_line+0x32>
movl   $0x1,-0x4(%rbp)
jmp    1174 <error_line+0x64>
mov    -0x10(%rbp),%rdi
lea    0xedc(%rip),%rsi
call   1030 <strstr@plt>
cmp    $0x0,%rax
je     1168 <error_line+0x58>
movl   $0x1,-0x4(%rbp)
jmp    1174 <error_line+0x64>
jmp    116d <error_line+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error_line>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     112f <error_line+0x1f>
pop    %rbx
ret
lea    0xef3(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strstr@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"control reaches end of non-void function\00"
@.str.1 = [58 x i8] c"suggest parentheses around assignment used as truth value\00"
define i32 @error_line(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @strstr(i8* %4, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %2
br label %15
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i64 @strstr(i8* %9, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 1, i32* %2
br label %15
13: ; preds = %8
br label %14
14: ; preds = %13
store i32 0, i32* %2
br label %15
15: ; preds = %14, %12, %7
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@.str = [41 x i8] c"control reaches end of non-void function\00"
@.str.1 = [58 x i8] c"suggest parentheses around assignment used as truth value\00"
define i32 @error_line(i8* %0) {
%2 = tail call i64 @strstr(i8* %0, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @strstr(i8* %0, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
int close(f) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @close(i32 %0) {
ret i32 0
}
/* Variables and functions */
int EOF;
int getchar();
int main(int argc, char *argv[]) {
  int c;
  (void)argc;
  (void)argv;
  while ((c = getchar()) != EOF) {
    if (c & 0x80)
      return c;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2eb1(%rip),%rcx
cmp    (%rcx),%eax
je     1160 <main+0x50>
mov    -0x14(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     115b <main+0x4b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1167 <main+0x57>
jmp    1126 <main+0x16>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2ecd(%rip),%r14
nopl   0x0(%rax,%rax,1)
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    (%r14),%eax
je     1134 <main+0x24>
mov    %eax,%ebx
test   $0x80,%al
je     1120 <main+0x10>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %7, %2
%4 = tail call i32 (...) @getchar()
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %4, %5
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = and i32 %4, 128
%9 = icmp eq i32 %8, 0
br i1 %9, label %3, label %10
10: ; preds = %3, %7
%11 = phi i32 [ %4, %7 ], [ 0, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ disableparsing_();
void DisableParsing() { disableparsing_(); }


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

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

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

LLVM IR (-O2):
define void @DisableParsing() {
%1 = tail call i32 (...) @disableparsing_()
ret void
}
main() {
  int x, y;
  x = 0;
  y = 1;
  if (x == 1)
    printf(y);
  else {
    y++;
    printf(y);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1147 <main+0x37>
movslq -0xc(%rbp),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    115b <main+0x4b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %11
6: ; preds = %0
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i8*
%10 = call i32 (i8*, ...) @printf(i8* %9)
br label %18
11: ; preds = %0
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i8*
%17 = call i32 (i8*, ...) @printf(i8* %16)
br label %18
18: ; preds = %11, %6
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* inttoptr (i64 2 to i8*))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, short);
const char *pr_dlci(const char *ptr) {
  static char buf[12];
  snprintf(buf, sizeof(buf), "%i", *(short *)ptr);
  return (buf);
}


x86 assembly (clang, -O0):
<pr_dlci>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
lea    0x2f02(%rip),%rdi
mov    $0xc,%esi
lea    0xecd(%rip),%rdx
movswl (%rax),%ecx
call   1030 <snprintf@plt>
lea    0x2ee7(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_dlci>:
push   %rbx
movswl (%rdi),%ecx
lea    0x2f0e(%rip),%rbx
lea    0xede(%rip),%rdx
mov    %rbx,%rdi
mov    $0xc,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@pr_dlci.buf = internal global [12 x i8] zeroinitializer
@.str = [3 x i8] c"%i\00"
define i8* @pr_dlci(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i16*
%5 = load i16, i16* %4
%6 = call i32 @snprintf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @pr_dlci.buf, i64 0, i64 0), i32 12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i16 signext %5)
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @pr_dlci.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@pr_dlci.buf = internal global [12 x i8] zeroinitializer
@.str = [3 x i8] c"%i\00"
define i8* @pr_dlci(i8* nocapture %0) {
%2 = bitcast i8* %0 to i16*
%3 = load i16, i16* %2
%4 = tail call i32 @snprintf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @pr_dlci.buf, i64 0, i64 0), i32 12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i16 signext %3)
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @pr_dlci.buf, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ handle_WINCH(int /*<<< orphan*/);
int gen_WINCH() { handle_WINCH(0); }


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

x86 assembly (clang, -O2):
<gen_WINCH>:
xor    %edi,%edi
jmp    1030 <handle_WINCH@plt>

LLVM IR (-O0):
define i32 @gen_WINCH() {
%1 = alloca i32
%2 = call i32 @handle_WINCH(i32 0)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @gen_WINCH() {
%1 = tail call i32 @handle_WINCH(i32 0)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ nrf_802154_clock_deinit();
int /*<<< orphan*/ nrf_802154_core_deinit();
int /*<<< orphan*/ nrf_802154_lp_timer_deinit();
int /*<<< orphan*/ nrf_802154_rsch_uninit();
int /*<<< orphan*/ nrf_802154_temperature_deinit();
int /*<<< orphan*/ nrf_802154_timer_coord_uninit();
int /*<<< orphan*/ nrf_802154_timer_sched_deinit();
void nrf_802154_deinit(void) {
  nrf_802154_timer_sched_deinit();
  nrf_802154_timer_coord_uninit();
  nrf_802154_temperature_deinit();
  nrf_802154_rsch_uninit();
  nrf_802154_lp_timer_deinit();
  nrf_802154_clock_deinit();
  nrf_802154_core_deinit();
}


x86 assembly (clang, -O0):
<nrf_802154_deinit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <nrf_802154_timer_sched_deinit@plt>
mov    $0x0,%al
call   1030 <nrf_802154_timer_coord_uninit@plt>
mov    $0x0,%al
call   1090 <nrf_802154_temperature_deinit@plt>
mov    $0x0,%al
call   1070 <nrf_802154_rsch_uninit@plt>
mov    $0x0,%al
call   1080 <nrf_802154_lp_timer_deinit@plt>
mov    $0x0,%al
call   1040 <nrf_802154_clock_deinit@plt>
mov    $0x0,%al
call   1050 <nrf_802154_core_deinit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<nrf_802154_deinit>:
push   %rax
xor    %eax,%eax
call   1060 <nrf_802154_timer_sched_deinit@plt>
xor    %eax,%eax
call   1030 <nrf_802154_timer_coord_uninit@plt>
xor    %eax,%eax
call   1090 <nrf_802154_temperature_deinit@plt>
xor    %eax,%eax
call   1070 <nrf_802154_rsch_uninit@plt>
xor    %eax,%eax
call   1080 <nrf_802154_lp_timer_deinit@plt>
xor    %eax,%eax
call   1040 <nrf_802154_clock_deinit@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <nrf_802154_core_deinit@plt>

LLVM IR (-O0):
define void @nrf_802154_deinit() {
%1 = call i32 (...) @nrf_802154_timer_sched_deinit()
%2 = call i32 (...) @nrf_802154_timer_coord_uninit()
%3 = call i32 (...) @nrf_802154_temperature_deinit()
%4 = call i32 (...) @nrf_802154_rsch_uninit()
%5 = call i32 (...) @nrf_802154_lp_timer_deinit()
%6 = call i32 (...) @nrf_802154_clock_deinit()
%7 = call i32 (...) @nrf_802154_core_deinit()
ret void
}

LLVM IR (-O2):
define void @nrf_802154_deinit() {
%1 = tail call i32 (...) @nrf_802154_timer_sched_deinit()
%2 = tail call i32 (...) @nrf_802154_timer_coord_uninit()
%3 = tail call i32 (...) @nrf_802154_temperature_deinit()
%4 = tail call i32 (...) @nrf_802154_rsch_uninit()
%5 = tail call i32 (...) @nrf_802154_lp_timer_deinit()
%6 = tail call i32 (...) @nrf_802154_clock_deinit()
%7 = tail call i32 (...) @nrf_802154_core_deinit()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main() {
  puts("Hello World!\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 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [14 x i8] c"Hello World!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello World!\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, long, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
void *thr2(void *v) {
  FILE *f = fopen("bogus2", "r");
  printf("f  = %ld, errno  = %d (%s)\n", (long)f, errno, strerror(errno));
  return NULL;
}


x86 assembly (clang, -O0):
<thr2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
lea    0xebd(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    0x2e7e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    %eax,%ecx
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thr2>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
lea    0xec6(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
mov    0x2e90(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1050 <strerror@plt>
lea    0xea9(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"bogus2\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [28 x i8] c"f = %ld, errno = %d (%s)\0A\00"
@errno = global i32 0
define i8* @thr2(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %3
%5 = load i32*, i32** %3
%6 = ptrtoint i32* %5 to i64
%7 = load i32, i32* @errno
%8 = load i32, i32* @errno
%9 = call i32 @strerror(i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i64 %6, i32 %7, i32 %9)
ret i8* null
}

LLVM IR (-O2):
@.str = [7 x i8] c"bogus2\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [28 x i8] c"f = %ld, errno = %d (%s)\0A\00"
@errno = global i32 0
define noalias i8* @thr2(i8* nocapture readnone %0) {
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = ptrtoint i32* %2 to i64
%4 = load i32, i32* @errno
%5 = tail call i32 @strerror(i32 %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i64 %3, i32 %4, i32 %5)
ret i8* null
}
/* Variables and functions */
int func(int);
int foo(int arg) { return func(arg); }


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

x86 assembly (clang, -O2):
<foo>:
jmp    1030 <func@plt>

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = tail call i32 @func(i32 %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ WriteFrmtd(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
void vfprintf_t() {
  FILE *fp;
  fp = fopen("file.txt", "w");
  WriteFrmtd(fp, "This is just one argument %d \n", 10);
  fclose(fp);
}


x86 assembly (clang, -O0):
<vfprintf_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xec3(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb1(%rip),%rsi
mov    $0xa,%edx
call   1050 <WriteFrmtd@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vfprintf_t>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xeca(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
lea    0xebd(%rip),%rsi
mov    %rax,%rdi
mov    $0xa,%edx
call   1050 <WriteFrmtd@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"file.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [31 x i8] c"This is just one argument %d \0A\00"
define void @vfprintf_t() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = call i32 @WriteFrmtd(i32* %3, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 10)
%5 = load i32*, i32** %1
%6 = call i32 @fclose(i32* %5)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"file.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [31 x i8] c"This is just one argument %d \0A\00"
define void @vfprintf_t() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @WriteFrmtd(i32* %1, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 10)
%3 = tail call i32 @fclose(i32* %1)
ret void
}