xunge/DecIR huggingface dataset:
void hls_macc(int a, int b, int *accum, _Bool accum_clr) {
#pragma HLS INTERFACE s_axilite port = return bundle = HLS_MACC_PERIPH_BUS
#pragma HLS INTERFACE s_axilite port = a bundle = HLS_MACC_PERIPH_BUS
#pragma HLS INTERFACE s_axilite port = b bundle = HLS_MACC_PERIPH_BUS
#pragma HLS INTERFACE s_axilite port = accum bundle = HLS_MACC_PERIPH_BUS
#pragma HLS INTERFACE s_axilite port = accum_clr bundle = HLS_MACC_PERIPH_BUS
  static acc_reg = 0;
  if (accum_clr)
    acc_reg = 0;
  acc_reg += a * b;
  *accum = acc_reg;
}


x86 assembly (clang, -O0):
<hls_macc>:
push   %rbp
mov    %rsp,%rbp
mov    %cl,%al
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
and    $0x1,%al
mov    %al,-0x11(%rbp)
testb  $0x1,-0x11(%rbp)
je     1129 <hls_macc+0x29>
movl   $0x0,0x2efb(%rip)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
add    0x2eee(%rip),%eax
mov    %eax,0x2ee8(%rip)
mov    0x2ee2(%rip),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<hls_macc>:
xor    %eax,%eax
test   %ecx,%ecx
jne    110c <hls_macc+0xc>
mov    0x2f18(%rip),%eax
imul   %edi,%esi
add    %eax,%esi
mov    %esi,0x2f0d(%rip)
mov    %esi,(%rdx)
ret

LLVM IR (-O0):
@hls_macc.acc_reg = internal global i32 0
define void @hls_macc(i32 %0, i32 %1, i32* %2, i1 zeroext %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i8
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32* %2, i32** %7
%9 = zext i1 %3 to i8
store i8 %9, i8* %8
%10 = load i8, i8* %8
%11 = trunc i8 %10 to i1
br i1 %11, label %12, label %13
12: ; preds = %4
store i32 0, i32* @hls_macc.acc_reg
br label %13
13: ; preds = %12, %4
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = mul nsw i32 %14, %15
%17 = load i32, i32* @hls_macc.acc_reg
%18 = add nsw i32 %17, %16
store i32 %18, i32* @hls_macc.acc_reg
%19 = load i32, i32* @hls_macc.acc_reg
%20 = load i32*, i32** %7
store i32 %19, i32* %20
ret void
}

LLVM IR (-O2):
@hls_macc.acc_reg = internal unnamed_addr global i32 0
define void @hls_macc(i32 %0, i32 %1, i32* nocapture writeonly %2, i1 zeroext %3) {
%5 = load i32, i32* @hls_macc.acc_reg
%6 = select i1 %3, i32 0, i32 %5
%7 = mul nsw i32 %1, %0
%8 = add nsw i32 %6, %7
store i32 %8, i32* @hls_macc.acc_reg
store i32 %8, i32* %2
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
void *GC_malloc_atomic(int x) {
  void *p = (void *)malloc(x);
  return p;
}


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

x86 assembly (clang, -O2):
<GC_malloc_atomic>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define i8* @GC_malloc_atomic(i32 %0) {
%2 = tail call i64 @malloc(i32 %0)
%3 = inttoptr i64 %2 to i8*
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopenTex(char *, char *);
void addTexExt(char *file) {
  FILE *fl;
  fl = fopenTex(file, "rt");
  if (fl != NULL)
    fclose(fl);
}


x86 assembly (clang, -O0):
<addTexExt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopenTex@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1154 <addTexExt+0x34>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addTexExt>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <fopenTex@plt>
test   %rax,%rax
je     113b <addTexExt+0x1b>
mov    %rax,%rdi
pop    %rax
jmp    1030 <fclose@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rt\00"
define void @addTexExt(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32* @fopenTex(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = icmp ne i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32*, i32** %3
%10 = call i32 @fclose(i32* %9)
br label %11
11: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"rt\00"
define void @addTexExt(i8* %0) {
%2 = tail call i32* @fopenTex(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @fclose(i32* %2)
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
size_t min(size_t, scalar_t__);
scalar_t__ strlen(char const *);
char *strncpy(char *dst, const char *src, size_t n) {
  n = min(n, strlen(src) + 1);
  memcpy(dst, src, n);
  if (n > 0)
    dst[n - 1] = 0;
  return dst;
}


x86 assembly (clang, -O0):
<strncpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rsi
add    $0x1,%rsi
call   1040 <min@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <memcpy@plt>
cmpq   $0x0,-0x18(%rbp)
jbe    1195 <strncpy+0x65>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncpy>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%rsi
mov    %rbx,%rdi
call   1040 <min@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
call   1050 <memcpy@plt>
test   %rbx,%rbx
je     116e <strncpy+0x3e>
movb   $0x0,-0x1(%rbx,%r14,1)
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strncpy(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i64, i64* %6
%8 = load i8*, i8** %5
%9 = call i64 @strlen(i8* %8)
%10 = add nsw i64 %9, 1
%11 = call i64 @min(i64 %7, i64 %10)
store i64 %11, i64* %6
%12 = load i8*, i8** %4
%13 = load i8*, i8** %5
%14 = load i64, i64* %6
%15 = call i32 @memcpy(i8* %12, i8* %13, i64 %14)
%16 = load i64, i64* %6
%17 = icmp ugt i64 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %3
%19 = load i8*, i8** %4
%20 = load i64, i64* %6
%21 = sub i64 %20, 1
%22 = getelementptr inbounds i8, i8* %19, i64 %21
store i8 0, i8* %22
br label %23
23: ; preds = %18, %3
%24 = load i8*, i8** %4
ret i8* %24
}

LLVM IR (-O2):
define i8* @strncpy(i8* returned %0, i8* %1, i64 %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add nsw i64 %4, 1
%6 = tail call i64 @min(i64 %2, i64 %5)
%7 = tail call i32 @memcpy(i8* %0, i8* %1, i64 %6)
%8 = icmp eq i64 %6, 0
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = add i64 %6, -1
%11 = getelementptr inbounds i8, i8* %0, i64 %10
store i8 0, i8* %11
br label %12
12: ; preds = %9, %3
ret i8* %0
}
/* Variables and functions */
scalar_t__ rintl(long double);
long long llrintl(long double x) { return (long long)rintl(x); }


x86 assembly (clang, -O0):
<llrintl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <rintl@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<llrintl>:
jmp    1030 <rintl@plt>

LLVM IR (-O0):
define i64 @llrintl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = call i64 @rintl(x86_fp80 %3)
ret i64 %4
}

LLVM IR (-O2):
define i64 @llrintl(x86_fp80 %0) {
%2 = tail call i64 @rintl(x86_fp80 %0)
ret i64 %2
}
int np1(x, y)
int x;
float y;
{ return x; }


x86 assembly (clang, -O0):
<np1>:
push   %rbp
mov    %rsp,%rbp
cvtsd2ss %xmm0,%xmm0
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @np1(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca float
%5 = fptrunc double %1 to float
store i32 %0, i32* %3
store float %5, float* %4
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @np1(i32 returned %0, double %1) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
main() {
  int f, j, n;
  float e;
  f = 1;
  e = 1;
  n = 2;
  while (e > 0)
    ;
  {
    for (j = 1; j <= n; j++) {
      n = n + 1;
      f *= j;
      e = e + 1 / f;
    }
  }
  printf("%.6f", e);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movss  0xed2(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movl   $0x2,-0x10(%rbp)
movss  -0x14(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1150 <main+0x40>
jmp    113a <main+0x2a>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     119f <main+0x8f>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
movss  -0x14(%rbp),%xmm0
mov    $0x1,%eax
cltd
idivl  -0x8(%rbp)
cvtsi2ss %eax,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1157 <main+0x47>
movss  -0x14(%rbp),%xmm0
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1100 <main>

LLVM IR (-O0):
@.str = [5 x i8] c"%.6f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
store i32 0, i32* %1
store i32 1, i32* %2
store float 1.000000e+00, float* %5
store i32 2, i32* %4
br label %6
6: ; preds = %9, %0
%7 = load float, float* %5
%8 = fcmp ogt float %7, 0.000000e+00
br i1 %8, label %9, label %10
9: ; preds = %6
br label %6
10: ; preds = %6
store i32 1, i32* %3
br label %11
11: ; preds = %26, %10
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %29
15: ; preds = %11
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
%18 = load i32, i32* %3
%19 = load i32, i32* %2
%20 = mul nsw i32 %19, %18
store i32 %20, i32* %2
%21 = load float, float* %5
%22 = load i32, i32* %2
%23 = sdiv i32 1, %22
%24 = sitofp i32 %23 to float
%25 = fadd float %21, %24
store float %25, float* %5
br label %26
26: ; preds = %15
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %11
29: ; preds = %11
%30 = load float, float* %5
%31 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float %30)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void abc(void) { printf("abc!\n"); }


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

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

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

LLVM IR (-O2):
@str = [5 x i8] c"abc!\00"
define void @abc() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void getNumberTill1000(int a) {
  if (a <= 1000) {
    printf("%d \n", a);
    getNumberTill1000(a + 1);
  }
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x3e8,-0x4(%rbp)
jg     1152 <getNumberTill1000+0x32>
mov    -0x4(%rbp),%esi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
call   1040 <getNumberTill1000@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %r14
push   %rbx
push   %rax
cmp    $0x3e8,%edi
jg     1145 <getNumberTill1000+0x35>
mov    %edi,%ebx
lea    0xedb(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x3e9,%ebx
jne    1130 <getNumberTill1000+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d \0A\00"
define void @getNumberTill1000(i32 %0) {
%2 = icmp slt i32 %0, 1001
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ %0, %1 ]
%5 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = add i32 %4, 1
%7 = icmp eq i32 %6, 1001
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
float func2(float x) {
  float s;
  s = 2 * x + 3;
  return s;
}


x86 assembly (clang, -O0):
<func2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
addss  %xmm0,%xmm0
movss  0xee6(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<func2>:
addss  %xmm0,%xmm0
addss  0xef4(%rip),%xmm0
ret

LLVM IR (-O0):
define float @func2(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %4, float 3.000000e+00)
store float %5, float* %3
%6 = load float, float* %3
ret float %6
}

LLVM IR (-O2):
define float @func2(float %0) {
%2 = tail call float @llvm.fmuladd.f32(float %0, float 2.000000e+00, float 3.000000e+00)
ret float %2
}
int ifThen(int argc, char **argv) {
  int foo;
  if (foo > 0) {
    foo += 12;
  } else {
    foo -= 12;
  }
  return 0;
}


x86 assembly (clang, -O0):
<ifThen>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1123 <ifThen+0x23>
mov    -0x14(%rbp),%eax
add    $0xc,%eax
mov    %eax,-0x14(%rbp)
jmp    112c <ifThen+0x2c>
mov    -0x14(%rbp),%eax
sub    $0xc,%eax
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @ifThen(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = load i32, i32* %5
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* %5
%10 = add nsw i32 %9, 12
store i32 %10, i32* %5
br label %14
11: ; preds = %2
%12 = load i32, i32* %5
%13 = sub nsw i32 %12, 12
store i32 %13, i32* %5
br label %14
14: ; preds = %11, %8
ret i32 0
}

LLVM IR (-O2):
define i32 @ifThen(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int getchar();
void skip_bad_input(void) {
  int c;
  while ((c = getchar()) != '\n') {
    ;
  }
}


x86 assembly (clang, -O0):
<skip_bad_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x4(%rbp)
cmp    $0xa,%eax
je     1130 <skip_bad_input+0x20>
jmp    1118 <skip_bad_input+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_bad_input>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%eax
jne    1120 <skip_bad_input+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @skip_bad_input() {
%1 = alloca i32
br label %2
2: ; preds = %5, %0
%3 = call i32 (...) @getchar()
store i32 %3, i32* %1
%4 = icmp ne i32 %3, 10
br i1 %4, label %5, label %6
5: ; preds = %2
br label %2
6: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @skip_bad_input() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @getchar()
%3 = icmp eq i32 %2, 10
br i1 %3, label %4, label %1
4: ; preds = %1
ret void
}
int also_has_local_var(int local_var) { return local_var; }


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

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

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

LLVM IR (-O2):
define i32 @also_has_local_var(i32 returned %0) {
ret i32 %0
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  int /*<<< orphan*/ fts_name;
};
typedef TYPE_1__ FTSENT;

/* Variables and functions */
int strcoll(int /*<<< orphan*/, int /*<<< orphan*/);
int namecmp(const FTSENT *a, const FTSENT *b) {
  return (strcoll(a->fts_name, b->fts_name));
}


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

x86 assembly (clang, -O2):
<namecmp>:
mov    (%rdi),%edi
mov    (%rsi),%esi
jmp    1030 <strcoll@plt>

LLVM IR (-O0):
%struct.TYPE_4__ = type { i32 }
define i32 @namecmp(%struct.TYPE_4__* %0, %struct.TYPE_4__* %1) {
%3 = alloca %struct.TYPE_4__*
%4 = alloca %struct.TYPE_4__*
store %struct.TYPE_4__* %0, %struct.TYPE_4__** %3
store %struct.TYPE_4__* %1, %struct.TYPE_4__** %4
%5 = load %struct.TYPE_4__*, %struct.TYPE_4__** %3
%6 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %5, i32 0, i32 0
%7 = load i32, i32* %6
%8 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
%9 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %8, i32 0, i32 0
%10 = load i32, i32* %9
%11 = call i32 @strcoll(i32 %7, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i32 }
define i32 @namecmp(%struct.TYPE_4__* nocapture %0, %struct.TYPE_4__* nocapture %1) {
%3 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %0, i64 0, i32 0
%4 = load i32, i32* %3
%5 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %1, i64 0, i32 0
%6 = load i32, i32* %5
%7 = tail call i32 @strcoll(i32 %4, i32 %6)
ret i32 %7
}
int *fn_test1(void) {
  int arr[3];
  arr[0] = 0;
  arr[1] = 1;
  arr[2] = 2;
  return arr;
}


x86 assembly (clang, -O0):
<fn_test1>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x2,-0x4(%rbp)
lea    -0xc(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn_test1>:
lea    -0xc(%rsp),%rax
ret

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

LLVM IR (-O2):
define noalias i32* @fn_test1() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
ret i32* %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void caml_gr_set_line_width() { exit(1); }


x86 assembly (clang, -O0):
<caml_gr_set_line_width>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<caml_gr_set_line_width>:
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @caml_gr_set_line_width() {
%1 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @caml_gr_set_line_width() {
%1 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int callee_deep_s(int);
int caller_deep_s(int bla) { return callee_deep_s(bla); }


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

x86 assembly (clang, -O2):
<caller_deep_s>:
jmp    1030 <callee_deep_s@plt>

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

LLVM IR (-O2):
define i32 @caller_deep_s(i32 %0) {
%2 = tail call i32 @callee_deep_s(i32 %0)
ret i32 %2
}
int main(int argc) {
  goto out;
  switch (argc) {
  case 1:;
  default:
    break;
  }
out:
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %2
store i32 %0, i32* %3
br label %4
4: ; preds = %1
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0) {
ret i32 0
}
void handle_43(int sig) {}


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

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

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

LLVM IR (-O2):
define void @handle_43(i32 %0) {
ret void
}
/* Variables and functions */
void co_init() {}


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @tgi_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int mod1() {
  printf("mod1\n");
  return 1;
}


x86 assembly (clang, -O0):
<mod1>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [6 x i8] c"mod1\0A\00"
define i32 @mod1() {
%1 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@str = [5 x i8] c"mod1\00"
define i32 @mod1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 1
}
int main() {
  int x, y;
  while (1) {
    x = y + x;
    y = 2 * x - 2 * y;
    x = x - y / 2;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
mov    %ecx,-0x1c(%rbp)
sub    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    %eax,-0x8(%rbp)
jmp    110b <main+0xb>

x86 assembly (clang, -O2):
<main>:
jmp    1100 <main>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %0, %4
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = add nsw i32 %5, %6
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = mul nsw i32 2, %8
%10 = load i32, i32* %3
%11 = mul nsw i32 2, %10
%12 = sub nsw i32 %9, %11
store i32 %12, i32* %3
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = sdiv i32 %14, 2
%16 = sub nsw i32 %13, %15
store i32 %16, i32* %2
br label %4
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void test_info(const char *section) {
  printf("%s"
         "\r\n",
         section);
}


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"%s\0D\0A\00"
define void @test_info(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ yogrt_set_remaining(int);
int iyogrt_set_remaining_(int *seconds) {
  yogrt_set_remaining(*seconds);
  return *seconds;
}


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

x86 assembly (clang, -O2):
<iyogrt_set_remaining_>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%edi
call   1030 <yogrt_set_remaining@plt>
mov    (%rbx),%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @iyogrt_set_remaining_(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @yogrt_set_remaining(i32 %2)
%4 = load i32, i32* %0
ret i32 %4
}
void print_time(int row) { return; }


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

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

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

LLVM IR (-O2):
define void @print_time(i32 %0) {
ret void
}
int main(void) { return (42 / 2) + ((21 + 21) / 2); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 42
}
/* Variables and functions */
int /*<<< orphan*/ setLogging(char *);
void print_caption() {
  setLogging("%%CPU\twork quantum\tsleep quantum\tactive rate");
}


x86 assembly (clang, -O0):
<print_caption>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <setLogging@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [45 x i8] c"%%CPU\09work quantum\09sleep quantum\09active rate\00"
define void @print_caption() {
%1 = call i32 @setLogging(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [45 x i8] c"%%CPU\09work quantum\09sleep quantum\09active rate\00"
define void @print_caption() {
%1 = tail call i32 @setLogging(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
ret void
}
short map2check_non_det_short() { return 0; }


x86 assembly (clang, -O0):
<map2check_non_det_short>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
cwtl
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i16 @map2check_non_det_short() {
ret i16 0
}

LLVM IR (-O2):
define signext i16 @map2check_non_det_short() {
ret i16 0
}
/* Variables and functions */
char const *_is_single_terminal(char const *la, char c) {
  return *la == c ? ++la : NULL;
}


x86 assembly (clang, -O0):
<_is_single_terminal>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1136 <_is_single_terminal+0x36>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    %rax,-0x18(%rbp)
jmp    1141 <_is_single_terminal+0x41>
xor    %eax,%eax
mov    %rax,-0x18(%rbp)
jmp    1141 <_is_single_terminal+0x41>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_is_single_terminal>:
lea    0x1(%rdi),%rcx
xor    %eax,%eax
cmp    %sil,(%rdi)
cmove  %rcx,%rax
ret

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

LLVM IR (-O2):
define i8* @_is_single_terminal(i8* %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = select i1 %4, i8* %5, i8* null
ret i8* %6
}
char *test_read_1_element() { return 0; }


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

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

LLVM IR (-O0):
define i8* @test_read_1_element() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @test_read_1_element() {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ CompileCondition();
int /*<<< orphan*/ ResetIf();
void CR_StackIf(void) {
  CompileCondition();
  ResetIf();
}


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

x86 assembly (clang, -O2):
<CR_StackIf>:
push   %rax
xor    %eax,%eax
call   1040 <CompileCondition@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <ResetIf@plt>

LLVM IR (-O0):
define void @CR_StackIf() {
%1 = call i32 (...) @CompileCondition()
%2 = call i32 (...) @ResetIf()
ret void
}

LLVM IR (-O2):
define void @CR_StackIf() {
%1 = tail call i32 (...) @CompileCondition()
%2 = tail call i32 (...) @ResetIf()
ret void
}
void glDisableVertexAttribArray(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glDisableVertexAttribArray() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char const *, int /*<<< orphan*/);
char *malloc(int);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
char *nogr_prompt_string(const char *prompt) {
  char *tmp = malloc(256);
  fputs(prompt, stdout);
  fgets(tmp, 256, stdin);
  return tmp;
}


x86 assembly (clang, -O0):
<nogr_prompt_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x100,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e83(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    -0x10(%rbp),%rdi
mov    0x2e81(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1040 <fgets@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nogr_prompt_string>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x100,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    0x2e8d(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   1030 <fputs@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1040 <fgets@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdout = global i32 0
@stdin = global i32 0
define i8* @nogr_prompt_string(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = call i8* @malloc(i32 256)
store i8* %4, i8** %3
%5 = load i8*, i8** %2
%6 = load i32, i32* @stdout
%7 = call i32 @fputs(i8* %5, i32 %6)
%8 = load i8*, i8** %3
%9 = load i32, i32* @stdin
%10 = call i32 @fgets(i8* %8, i32 256, i32 %9)
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@stdout = global i32 0
@stdin = global i32 0
define i8* @nogr_prompt_string(i8* %0) {
%2 = tail call dereferenceable_or_null(256) i8* @malloc(i32 256)
%3 = load i32, i32* @stdout
%4 = tail call i32 @fputs(i8* %0, i32 %3)
%5 = load i32, i32* @stdin
%6 = tail call i32 @fgets(i8* %2, i32 256, i32 %5)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void touch_update() { system("touch ./.prodlk"); }


x86 assembly (clang, -O0):
<touch_update>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <system@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [16 x i8] c"touch ./.prodlk\00"
define void @touch_update() {
%1 = call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"touch ./.prodlk\00"
define void @touch_update() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}
int process(void *data) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @process(i8* nocapture readnone %0) {
ret i32 0
}
void ISRHardFault(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<ISRHardFault>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <ISRHardFault+0x9>
jmp    1109 <ISRHardFault+0x9>

x86 assembly (clang, -O2):
<ISRHardFault>:
jmp    1100 <ISRHardFault>

LLVM IR (-O0):
define void @ISRHardFault() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @ISRHardFault() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int main() {
  printf("%d\n", 2.0);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 2.000000e+00)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 2.000000e+00)
ret i32 0
}
/* Variables and functions */
int asm_syscall(char const *, char const *, int /*<<< orphan*/ *, int);
int __attribute__((section("libgloss_epiphany")))
_link(const char *old, const char *new) {
  return asm_syscall(old, new, NULL, 9);
}


x86 assembly (clang, -O0):
<_link>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    $0x9,%ecx
call   1030 <asm_syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_link>:
xor    %edx,%edx
mov    $0x9,%ecx
jmp    1030 <asm_syscall@plt>

LLVM IR (-O0):
define i32 @_link(i8* %0, i8* %1) section "libgloss_epiphany" {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @asm_syscall(i8* %5, i8* %6, i32* null, i32 9)
ret i32 %7
}

LLVM IR (-O2):
define i32 @_link(i8* %0, i8* %1) section "libgloss_epiphany" {
%3 = tail call i32 @asm_syscall(i8* %0, i8* %1, i32* null, i32 9)
ret i32 %3
}
int ti_cosh_start(double const *options) {
  (void)options;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @ti_cosh_start(double* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
char *concatenate(char *, char *, int, char const *, char *);
char *get_tmp_directory(const char *work_dir) {
  return concatenate("%s/%s", "tmp dir", 2, work_dir, "tmp");
}


x86 assembly (clang, -O0):
<get_tmp_directory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
lea    0xed9(%rip),%rdi
lea    0xed8(%rip),%rsi
mov    $0x2,%edx
lea    0xed4(%rip),%r8
call   1030 <concatenate@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_tmp_directory>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
lea    0xee5(%rip),%rsi
lea    0xee6(%rip),%r8
mov    $0x2,%edx
jmp    1030 <concatenate@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%s/%s\00"
@.str.1 = [8 x i8] c"tmp dir\00"
@.str.2 = [4 x i8] c"tmp\00"
define i8* @get_tmp_directory(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @concatenate(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 2, i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret i8* %4
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s/%s\00"
@.str.1 = [8 x i8] c"tmp dir\00"
@.str.2 = [4 x i8] c"tmp\00"
define i8* @get_tmp_directory(i8* %0) {
%2 = tail call i8* @concatenate(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 2, i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret i8* %2
}
int slib_export(int a) {
  (void)a;
  return 42;
}


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

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

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

LLVM IR (-O2):
define i32 @slib_export(i32 %0) {
ret i32 42
}
void _vCls(void) {}


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

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

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

LLVM IR (-O2):
define void @_vCls() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void foobar(char *str) {
  char buf[10];
  strcpy(buf, str);
  printf("%s\n", buf);
}


x86 assembly (clang, -O0):
<foobar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x12(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x12(%rbp),%rsi
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foobar>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rsi
lea    0x6(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xec4(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @foobar(i8* %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* %0)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}
int func7(void) { return 7; }


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

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

LLVM IR (-O0):
define i32 @func7() {
ret i32 7
}

LLVM IR (-O2):
define i32 @func7() {
ret i32 7
}
/* Variables and functions */
int /*<<< orphan*/ getLine(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stripNonLetters(char *, char *);
int main() {
  char line[30];
  char stripped[30];
  printf("Enter a line of text: ");
  getLine(line, 30);
  stripNonLetters(line, stripped);
  printf("Stripped version = %s\n", stripped);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x1e,%esi
call   1050 <getLine@plt>
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1030 <stripNonLetters@plt>
lea    -0x50(%rbp),%rsi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x48,%rsp
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1e,%esi
call   1050 <getLine@plt>
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <stripNonLetters@plt>
lea    0xeab(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Enter a line of text: \00"
@.str.1 = [23 x i8] c"Stripped version = %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [30 x i8]
%3 = alloca [30 x i8]
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%6 = call i32 @getLine(i8* %5, i32 30)
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%9 = call i32 @stripNonLetters(i8* %7, i8* %8)
%10 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Enter a line of text: \00"
@.str.1 = [23 x i8] c"Stripped version = %s\0A\00"
define i32 @main() {
%1 = alloca [30 x i8]
%2 = alloca [30 x i8]
%3 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @getLine(i8* %3, i32 30)
%7 = call i32 @stripNonLetters(i8* %3, i8* %4)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int state;
};
typedef TYPE_1__ XVisibilityEvent;

/* Variables and functions */
void set_XVisibilityEvent_state(void *_p, int _v) {
  ((XVisibilityEvent *)_p)->state = (int)_v;
}


x86 assembly (clang, -O0):
<set_XVisibilityEvent_state>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XVisibilityEvent_state>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XVisibilityEvent_state(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XVisibilityEvent_state(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_proplist_sets() {
  printf("NOT IMPLEMENTED:"
         "pa_proplist_sets"
         "\n");
}


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

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

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

LLVM IR (-O2):
@str = [33 x i8] c"NOT IMPLEMENTED:pa_proplist_sets\00"
define i32 @pa_proplist_sets() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
unsigned long BIT_MASK(int);
int BIT_WORD(int);
int __test_and_change_bit(int nr, volatile unsigned long *addr) {
  unsigned long mask = BIT_MASK(nr);
  unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
  unsigned long old = *p;
  *p = old ^ mask;
  return (old & mask) != 0;
}


x86 assembly (clang, -O0):
<__test_and_change_bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <BIT_MASK@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <BIT_WORD@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rcx
xor    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
and    -0x18(%rbp),%rax
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__test_and_change_bit>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
call   1030 <BIT_MASK@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   1040 <BIT_WORD@plt>
cltq
mov    (%r14,%rax,8),%rcx
mov    %rcx,%rdx
xor    %rbx,%rdx
mov    %rdx,(%r14,%rax,8)
xor    %eax,%eax
test   %rbx,%rcx
setne  %al
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @__test_and_change_bit(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i64*
%7 = alloca i64
store i32 %0, i32* %3
store i64* %1, i64** %4
%8 = load i32, i32* %3
%9 = call i64 @BIT_MASK(i32 %8)
store i64 %9, i64* %5
%10 = load i64*, i64** %4
%11 = load i32, i32* %3
%12 = call i32 @BIT_WORD(i32 %11)
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i64, i64* %10, i64 %13
store i64* %14, i64** %6
%15 = load i64*, i64** %6
%16 = load i64, i64* %15
store i64 %16, i64* %7
%17 = load i64, i64* %7
%18 = load i64, i64* %5
%19 = xor i64 %17, %18
%20 = load i64*, i64** %6
store i64 %19, i64* %20
%21 = load i64, i64* %7
%22 = load i64, i64* %5
%23 = and i64 %21, %22
%24 = icmp ne i64 %23, 0
%25 = zext i1 %24 to i32
ret i32 %25
}

LLVM IR (-O2):
define i32 @__test_and_change_bit(i32 %0, i64* nocapture %1) {
%3 = tail call i64 @BIT_MASK(i32 %0)
%4 = tail call i32 @BIT_WORD(i32 %0)
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i64, i64* %1, i64 %5
%7 = load i64, i64* %6
%8 = xor i64 %7, %3
store i64 %8, i64* %6
%9 = and i64 %7, %3
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}