xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isgraph(int);
void t_isgraph_0x90() {
  Assert_real((isgraph(144) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isgraph.c",
              725, ("isgraph should be 0 for 0x90"));
}


x86 assembly (clang, -O0):
<t_isgraph_0x90>:
push   %rbp
mov    %rsp,%rbp
mov    $0x90,%edi
call   1040 <isgraph@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x2d5,%edx
lea    0xf5b(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isgraph_0x90>:
push   %rax
mov    $0x90,%edi
call   1040 <isgraph@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x2d5,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [29 x i8] c"isgraph should be 0 for 0x90\00"
define void @t_isgraph_0x90() {
%1 = call i64 @isgraph(i32 144)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 725, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [29 x i8] c"isgraph should be 0 for 0x90\00"
define void @t_isgraph_0x90() {
%1 = tail call i64 @isgraph(i32 144)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 725, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int greatest_digit(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  printf("greatest digit is %d :\n", greatest_digit(n));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1050 <greatest_digit@plt>
mov    %eax,%esi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%edi
call   1050 <greatest_digit@plt>
lea    0xeb1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [24 x i8] c"greatest digit is %d :\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%4 = load i32, i32* %2
%5 = call i32 @greatest_digit(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [24 x i8] c"greatest digit is %d :\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @greatest_digit(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int solve_by_dobldobl_homotopy_continuation(int number_of_tasks) {
  int *b, fail;
  double *c;
  fail = _ada_use_c2phc(236, &number_of_tasks, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<solve_by_dobldobl_homotopy_continuation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0xec,%edi
lea    -0x4(%rbp),%rsi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve_by_dobldobl_homotopy_continuation>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0xec,%edi
call   1030 <_ada_use_c2phc@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @solve_by_dobldobl_homotopy_continuation(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca double*
store i32 %0, i32* %2
%6 = load i32*, i32** %3
%7 = load double*, double** %5
%8 = call i32 @_ada_use_c2phc(i32 236, i32* %2, i32* %6, double* %7)
store i32 %8, i32* %4
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
define i32 @solve_by_dobldobl_homotopy_continuation(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @_ada_use_c2phc(i32 236, i32* %2, i32* undef, double* undef)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ db_printf0(char *);
void db_send_exit() { db_printf0("*DEBUG*:X\n"); }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"*DEBUG*:X\0A\00"
define void @db_send_exit() {
%1 = call i32 @db_printf0(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"*DEBUG*:X\0A\00"
define void @db_send_exit() {
%1 = tail call i32 @db_printf0(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
void *freeipmi_memcpy(void *dest, const void *src, size_t n) {
  while (0 <= --n)
    ((unsigned char *)dest)[n] = ((unsigned char *)src)[n];
  return dest;
}


x86 assembly (clang, -O0):
<freeipmi_memcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x18(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
ja     1142 <freeipmi_memcpy+0x42>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1110 <freeipmi_memcpy+0x10>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeipmi_memcpy>:
add    $0xffffffffffffffff,%rdx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rsi,%rdx,1),%eax
mov    %al,(%rdi,%rdx,1)
add    $0xffffffffffffffff,%rdx
jmp    1110 <freeipmi_memcpy+0x10>

LLVM IR (-O0):
define i8* @freeipmi_memcpy(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
br label %7
7: ; preds = %11, %3
%8 = load i64, i64* %6
%9 = add i64 %8, -1
store i64 %9, i64* %6
%10 = icmp ule i64 0, %9
br i1 %10, label %11, label %19
11: ; preds = %7
%12 = load i8*, i8** %5
%13 = load i64, i64* %6
%14 = getelementptr inbounds i8, i8* %12, i64 %13
%15 = load i8, i8* %14
%16 = load i8*, i8** %4
%17 = load i64, i64* %6
%18 = getelementptr inbounds i8, i8* %16, i64 %17
store i8 %15, i8* %18
br label %7
19: ; preds = %7
%20 = load i8*, i8** %4
ret i8* %20
}

LLVM IR (-O2):
define noalias i8* @freeipmi_memcpy(i8* nocapture writeonly %0, i8* nocapture %1, i64 %2) {
br label %4
4: ; preds = %4, %3
%5 = phi i64 [ %2, %3 ], [ %6, %4 ]
%6 = add i64 %5, -1
%7 = getelementptr inbounds i8, i8* %1, i64 %6
%8 = load i8, i8* %7
%9 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 %8, i8* %9
br label %4
}
/* Variables and functions */
float mycalc(float, float);
int /*<<< orphan*/ printf(char *, float, float, float);
int /*<<< orphan*/ scanf(char *, float *, float *);
int main() {
  float x, y, z;
  scanf("%f %f", &x, &y);
  z = mycalc(x, y);
  printf("%f minus %f = %.2f\n", x, y, z);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1050 <scanf@plt>
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1040 <mycalc@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm0
movss  (%rsp),%xmm1
call   1040 <mycalc@plt>
movaps %xmm0,%xmm2
movss  0x4(%rsp),%xmm0
movss  (%rsp),%xmm1
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%f %f\00"
@.str.1 = [20 x i8] c"%f minus %f = %.2f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), float* %1, float* %2)
%5 = load float, float* %1
%6 = load float, float* %2
%7 = call float @mycalc(float %5, float %6)
store float %7, float* %3
%8 = load float, float* %1
%9 = load float, float* %2
%10 = load float, float* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), float %8, float %9, float %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%f %f\00"
@.str.1 = [20 x i8] c"%f minus %f = %.2f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), float* %1, float* %2)
%6 = load float, float* %1
%7 = load float, float* %2
%8 = call float @mycalc(float %6, float %7)
%9 = load float, float* %1
%10 = load float, float* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), float %9, float %10, float %8)
ret i32 0
}
void XtNewString() {}


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

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

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

LLVM IR (-O2):
define void @XtNewString() {
ret void
}
double my_random_double() {
  int x, exp, mant;
  double d;
  union {
    double d;
    int i;
  } b;
  x = random();
  asm("bsfl %1, %0" : "=r"(exp) : "r"(x));
  exp = 1022 - exp;
  mant = x >> 8;
  b.i = (exp << 23) | mant;
  return b.d;
}


x86 assembly (clang, -O0):
<my_random_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1030 <random@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
bsf    %eax,%eax
mov    %eax,-0x8(%rbp)
mov    $0x3fe,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x17,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_random_double>:
push   %rax
xor    %eax,%eax
call   1030 <random@plt>
bsf    %eax,%ecx
sar    $0x8,%eax
shl    $0x17,%ecx
mov    $0xff000000,%edx
sub    %ecx,%edx
or     %eax,%edx
movq   %rdx,%xmm0
pop    %rax
ret

LLVM IR (-O0):
%union.anon = type { double }
define double @my_random_double() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca %union.anon
%6 = call i32 (...) @random()
store i32 %6, i32* %1
%7 = load i32, i32* %1
%8 = call i32 asm "bsfl $1, $0", "=r,r,~{dirflag},~{fpsr},~{flags}"(i32 %7)
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = sub nsw i32 1022, %9
store i32 %10, i32* %2
%11 = load i32, i32* %1
%12 = ashr i32 %11, 8
store i32 %12, i32* %3
%13 = load i32, i32* %2
%14 = shl i32 %13, 23
%15 = load i32, i32* %3
%16 = or i32 %14, %15
%17 = bitcast %union.anon* %5 to i32*
store i32 %16, i32* %17
%18 = bitcast %union.anon* %5 to double*
%19 = load double, double* %18
ret double %19
}

LLVM IR (-O2):
define double @my_random_double() {
%1 = tail call i32 (...) @random()
%2 = tail call i32 asm "bsfl $1, $0", "=r,r,~{dirflag},~{fpsr},~{flags}"(i32 %1)
%3 = ashr i32 %1, 8
%4 = mul i32 %2, -8388608
%5 = add i32 %4, -16777216
%6 = or i32 %5, %3
%7 = zext i32 %6 to i64
%8 = bitcast i64 %7 to double
ret double %8
}
/* Type definitions */
typedef int uint64_t;
typedef int uint32_t;

/* Variables and functions */
void bm_set(uint64_t *bm, uint32_t v) {
  bm[v / (8 * sizeof(uint64_t))] |= (1 << (v % (8 * sizeof(uint64_t))));
}


x86 assembly (clang, -O0):
<bm_set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movslq -0xc(%rbp),%rax
and    $0x1f,%rax
mov    %eax,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shr    $0x5,%rcx
or     (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bm_set>:
movslq %esi,%rcx
mov    $0x1,%eax
shl    %cl,%eax
shr    $0x5,%rcx
or     %eax,(%rdi,%rcx,4)
ret

LLVM IR (-O0):
define void @bm_set(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = sext i32 %5 to i64
%7 = urem i64 %6, 32
%8 = trunc i64 %7 to i32
%9 = shl i32 1, %8
%10 = load i32*, i32** %3
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = udiv i64 %12, 32
%14 = getelementptr inbounds i32, i32* %10, i64 %13
%15 = load i32, i32* %14
%16 = or i32 %15, %9
store i32 %16, i32* %14
ret void
}

LLVM IR (-O2):
define void @bm_set(i32* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = and i32 %1, 31
%5 = shl nuw i32 1, %4
%6 = lshr i64 %3, 5
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = load i32, i32* %7
%9 = or i32 %8, %5
store i32 %9, i32* %7
ret void
}
float foof(float x) { return 1.0f / x; }


x86 assembly (clang, -O0):
<foof>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xeef(%rip),%xmm0
divss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<foof>:
movss  0xef8(%rip),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @foof(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fdiv float 1.000000e+00, %3
ret float %4
}

LLVM IR (-O2):
define float @foof(float %0) {
%2 = fdiv float 1.000000e+00, %0
ret float %2
}
int foo() {
  int r = 10;
  r++;
  int ret = r + 10;
  return ret;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @foo() {
ret i32 21
}
/* Type definitions */
struct t_logger_buffer {
  int dummy;
};

/* Variables and functions */
struct t_logger_buffer *logger_buffer_search_buffer(void *);
int /*<<< orphan*/ logger_stop(struct t_logger_buffer *, int /*<<< orphan*/);
int logger_stop_signal_cb(void *data, const char *signal, const char *type_data,
                          void *signal_data) {
  struct t_logger_buffer *ptr_logger_buffer;
  (void)data;
  (void)signal;
  (void)type_data;
  ptr_logger_buffer = logger_buffer_search_buffer(signal_data);
  if (ptr_logger_buffer)
    logger_stop(ptr_logger_buffer, 0);
  return 0;
}


x86 assembly (clang, -O0):
<logger_stop_signal_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <logger_buffer_search_buffer@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     115b <logger_stop_signal_cb+0x3b>
mov    -0x28(%rbp),%rdi
xor    %esi,%esi
call   1030 <logger_stop@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logger_stop_signal_cb>:
push   %rax
mov    %rcx,%rdi
call   1040 <logger_buffer_search_buffer@plt>
test   %rax,%rax
je     1138 <logger_stop_signal_cb+0x18>
mov    %rax,%rdi
xor    %esi,%esi
call   1030 <logger_stop@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.t_logger_buffer = type { i32 }
define i32 @logger_stop_signal_cb(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca %struct.t_logger_buffer*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = load i8*, i8** %7
%13 = load i8*, i8** %8
%14 = call %struct.t_logger_buffer* @logger_buffer_search_buffer(i8* %13)
store %struct.t_logger_buffer* %14, %struct.t_logger_buffer** %9
%15 = load %struct.t_logger_buffer*, %struct.t_logger_buffer** %9
%16 = icmp ne %struct.t_logger_buffer* %15, null
br i1 %16, label %17, label %20
17: ; preds = %4
%18 = load %struct.t_logger_buffer*, %struct.t_logger_buffer** %9
%19 = call i32 @logger_stop(%struct.t_logger_buffer* %18, i32 0)
br label %20
20: ; preds = %17, %4
ret i32 0
}

LLVM IR (-O2):
%struct.t_logger_buffer = type { i32 }
define i32 @logger_stop_signal_cb(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* %3) {
%5 = tail call %struct.t_logger_buffer* @logger_buffer_search_buffer(i8* %3)
%6 = icmp eq %struct.t_logger_buffer* %5, null
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @logger_stop(%struct.t_logger_buffer* %5, i32 0)
br label %9
9: ; preds = %7, %4
ret i32 0
}
/* Variables and functions */
char *concat_strings(char *, char *);
char *strchr(char *, char);
char *string_copy(char *);
char *expand_template_string(char *template, char *arg) {
  char *percent;
  char *new = string_copy(template);
  percent = strchr(new, '%');
  if (percent == NULL)
    return new;
  *percent = '\0';
  return concat_strings(new, arg);
}


x86 assembly (clang, -O0):
<expand_template_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <string_copy@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x25,%esi
call   1030 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1177 <expand_template_string+0x47>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    118f <expand_template_string+0x5f>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <concat_strings@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expand_template_string>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1050 <string_copy@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x25,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1166 <expand_template_string+0x36>
movb   $0x0,(%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <concat_strings@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @expand_template_string(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = call i8* @string_copy(i8* %8)
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = call i8* @strchr(i8* %10, i8 signext 37)
store i8* %11, i8** %6
%12 = load i8*, i8** %6
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = load i8*, i8** %7
store i8* %15, i8** %3
br label %21
16: ; preds = %2
%17 = load i8*, i8** %6
store i8 0, i8* %17
%18 = load i8*, i8** %7
%19 = load i8*, i8** %5
%20 = call i8* @concat_strings(i8* %18, i8* %19)
store i8* %20, i8** %3
br label %21
21: ; preds = %16, %14
%22 = load i8*, i8** %3
ret i8* %22
}

LLVM IR (-O2):
define i8* @expand_template_string(i8* %0, i8* %1) {
%3 = tail call i8* @string_copy(i8* %0)
%4 = tail call i8* @strchr(i8* dereferenceable(1) %3, i8 signext 37)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %2
store i8 0, i8* %4
%7 = tail call i8* @concat_strings(i8* %3, i8* %1)
br label %8
8: ; preds = %2, %6
%9 = phi i8* [ %7, %6 ], [ %3, %2 ]
ret i8* %9
}
void main(void) {
  int y;
  {
    int x;
    y = x;
  }
}


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

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

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

LLVM IR (-O2):
define void @main() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void sig_alarm(int signo) {
  printf("catch alarm signal %d\n", signo);
  return;
}


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

x86 assembly (clang, -O2):
<sig_alarm>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [23 x i8] c"catch alarm signal %d\0A\00"
define void @sig_alarm(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Type definitions */
struct RNAsubopt_args_info {
  int dummy;
};

/* Variables and functions */
int RNAsubopt_cmdline_parser2(int, char **, struct RNAsubopt_args_info *,
                              int /*<<< orphan*/, int, int);
int RNAsubopt_cmdline_parser(int argc, char **argv,
                             struct RNAsubopt_args_info *args_info) {
  return RNAsubopt_cmdline_parser2(argc, argv, args_info, 0, 1, 1);
}


x86 assembly (clang, -O0):
<RNAsubopt_cmdline_parser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
xor    %ecx,%ecx
mov    $0x1,%r9d
mov    %r9d,%r8d
call   1030 <RNAsubopt_cmdline_parser2@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RNAsubopt_cmdline_parser>:
xor    %ecx,%ecx
mov    $0x1,%r8d
mov    $0x1,%r9d
jmp    1030 <RNAsubopt_cmdline_parser2@plt>

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

LLVM IR (-O2):
%struct.RNAsubopt_args_info = type { i32 }
define i32 @RNAsubopt_cmdline_parser(i32 %0, i8** %1, %struct.RNAsubopt_args_info* %2) {
%4 = tail call i32 @RNAsubopt_cmdline_parser2(i32 %0, i8** %1, %struct.RNAsubopt_args_info* %2, i32 0, i32 1, i32 1)
ret i32 %4
}
void do_general_protection(void *x) {
  do {
    kprintf("Unsupport Now...[%s]\n", __FUNCTION__);
    while (1)
      ;
  } while (0);
  ;
}


x86 assembly (clang, -O0):
<do_general_protection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
lea    0xeec(%rip),%rsi
mov    $0x0,%al
call   1030 <kprintf@plt>
jmp    1131 <do_general_protection+0x21>

x86 assembly (clang, -O2):
<do_general_protection>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xef7(%rip),%rsi
xor    %eax,%eax
call   1030 <kprintf@plt>
cs nopw 0x0(%rax,%rax,1)
jmp    1130 <do_general_protection+0x20>

LLVM IR (-O0):
@.str = [22 x i8] c"Unsupport Now...[%s]\0A\00"
@__FUNCTION__.do_general_protection = [22 x i8] c"do_general_protection\00"
define void @do_general_protection(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1
%4 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @kprintf to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__FUNCTION__.do_general_protection, i64 0, i64 0))
br label %5
5: ; preds = %3, %5
br label %5
6: ; No predecessors!
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"Unsupport Now...[%s]\0A\00"
@__FUNCTION__.do_general_protection = [22 x i8] c"do_general_protection\00"
define void @do_general_protection(i8* nocapture readnone %0) {
%2 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @kprintf to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__FUNCTION__.do_general_protection, i64 0, i64 0))
br label %3
3: ; preds = %1, %3
br label %3
}
int eq(int A, int B) { return A == B; }


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

x86 assembly (clang, -O2):
<eq>:
xor    %eax,%eax
cmp    %esi,%edi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @eq(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;
typedef int const uint16_t;

/* Variables and functions */
uint16_t rtp3640_get_au_headers_length(const uint8_t *header) {
  return (header[0] << 8) | header[1];
}


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

x86 assembly (clang, -O2):
<rtp3640_get_au_headers_length>:
mov    (%rdi),%eax
shl    $0x8,%eax
or     0x4(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @rtp3640_get_au_headers_length(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = shl i32 %5, 8
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 1
%9 = load i32, i32* %8
%10 = or i32 %6, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @rtp3640_get_au_headers_length(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 8
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = or i32 %3, %5
ret i32 %6
}
int test_imm_50uint8_reg(unsigned char val) {
  return ((val) & (0x50 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_50uint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0x50,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_50uint8_reg>:
test   $0x50,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_50uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 80
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ long2s(char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
find_blockkey(int DataChain, int DataNumber, char BlockKey[]) {
  if (DataChain == 0)
    strncpy(BlockKey, "All", 64 + 1);
  else
    long2s(BlockKey, DataNumber);
  return (0);
}


x86 assembly (clang, -O0):
<find_blockkey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1156 <find_blockkey+0x36>
mov    -0x10(%rbp),%rdi
lea    0xeb9(%rip),%rsi
mov    $0x41,%edx
call   1030 <strncpy@plt>
jmp    1162 <find_blockkey+0x42>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1040 <long2s@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_blockkey>:
push   %rax
test   %edi,%edi
je     112f <find_blockkey+0xf>
mov    %rdx,%rdi
call   1040 <long2s@plt>
jmp    1143 <find_blockkey+0x23>
lea    0xeca(%rip),%rsi
mov    %rdx,%rdi
mov    $0x41,%edx
call   1030 <strncpy@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"All\00"
define i32 @find_blockkey(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = load i8*, i8** %6
%11 = call i32 @strncpy(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 65)
br label %16
12: ; preds = %3
%13 = load i8*, i8** %6
%14 = load i32, i32* %5
%15 = call i32 @long2s(i8* %13, i32 %14)
br label %16
16: ; preds = %12, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"All\00"
define i32 @find_blockkey(i32 %0, i32 %1, i8* %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @strncpy(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 65)
br label %9
7: ; preds = %3
%8 = tail call i32 @long2s(i8* %2, i32 %1)
br label %9
9: ; preds = %7, %5
ret i32 0
}
/* Variables and functions */
int partition(int *, int, int);
void quickSort(int *arrptr, int fIndex, int lIndex) {
  int mIndex;
  if (fIndex < lIndex) {
    mIndex = partition(arrptr, fIndex, lIndex);
    quickSort(arrptr, fIndex, mIndex);
    quickSort(arrptr, mIndex + 1, lIndex);
  }
}


x86 assembly (clang, -O0):
<quickSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1171 <quickSort+0x51>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <quickSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <quickSort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quickSort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1165 <quickSort+0x45>
mov    %edx,%r14d
mov    %esi,%ebx
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebp
mov    %r15,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <quickSort@plt>
add    $0x1,%ebp
mov    %ebp,%ebx
cmp    %r14d,%ebp
jl     1140 <quickSort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @quickSort(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* %5
%9 = load i32, i32* %6
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %23
11: ; preds = %3
%12 = load i32*, i32** %4
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = call i32 @partition(i32* %12, i32 %13, i32 %14)
store i32 %15, i32* %7
%16 = load i32*, i32** %4
%17 = load i32, i32* %5
%18 = load i32, i32* %7
%19 = load i32*, i32** %4
%20 = load i32, i32* %7
%21 = add nsw i32 %20, 1
%22 = load i32, i32* %6
br label %23
23: ; preds = %11, %3
ret void
}

LLVM IR (-O2):
define void @quickSort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %10
5: ; preds = %3, %5
%6 = phi i32 [ %8, %5 ], [ %1, %3 ]
%7 = tail call i32 @partition(i32* %0, i32 %6, i32 %2)
tail call void @quickSort(i32* %0, i32 %6, i32 %7)
%8 = add nsw i32 %7, 1
%9 = icmp slt i32 %8, %2
br i1 %9, label %5, label %10
10: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bprintf(char *, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ write_output();
void usage(char *err) {
  bprintf("finsig <primary> <base> <outputfilename> [alt base] - Error = %s\n",
          err);
  write_output();
  fprintf(stderr,
          "finsig <primary> <base> <outputfilename> [alt base] - Error = %s\n",
          err);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1040 <bprintf@plt>
mov    $0x0,%al
call   1030 <write_output@plt>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe89(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xeb2(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <bprintf@plt>
xor    %eax,%eax
call   1030 <write_output@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [66 x i8] c"finsig <primary> <base> <outputfilename> [alt base] - Error = %s\0A\00"
@stderr = global i32 0
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @bprintf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (...) @write_output()
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %2
%8 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [66 x i8] c"finsig <primary> <base> <outputfilename> [alt base] - Error = %s\0A\00"
@stderr = global i32 0
define void @usage(i8* %0) {
%2 = tail call i32 @bprintf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (...) @write_output()
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void IntPrint(const void *a) { printf("%i", *(int *)a); }


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

x86 assembly (clang, -O2):
<IntPrint>:
mov    (%rdi),%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
define void @IntPrint(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
unsigned kol_system_cpufreq() { asm("int $0x40" ::"a"(18), "b"(5)); }


x86 assembly (clang, -O0):
<kol_system_cpufreq>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    $0x12,%eax
mov    $0x5,%ebx
int    $0x40
mov    -0xc(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<kol_system_cpufreq>:
push   %rbx
mov    $0x12,%eax
mov    $0x5,%ebx
int    $0x40
pop    %rbx
ret

LLVM IR (-O0):
define i32 @kol_system_cpufreq() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @kol_system_cpufreq() {
tail call void asm sideeffect "int $$0x40", "{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i32 18, i32 5)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ mgetstring();
int /*<<< orphan*/ mgetuleb128();
int /*<<< orphan*/ mputstring(int /*<<< orphan*/);
int /*<<< orphan*/ mputuleb128(int /*<<< orphan*/);
scalar_t__ msynch();
long export_entry(void) {
  long delta = 0;
  mputstring(mgetstring());
  delta += msynch();
  mputuleb128(mgetuleb128());
  mputuleb128(mgetuleb128());
  delta += msynch();
  return delta;
}


x86 assembly (clang, -O0):
<export_entry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1070 <mgetstring@plt>
mov    %eax,%edi
call   1030 <mputstring@plt>
mov    $0x0,%al
call   1060 <msynch@plt>
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <mgetuleb128@plt>
mov    %eax,%edi
call   1050 <mputuleb128@plt>
mov    $0x0,%al
call   1040 <mgetuleb128@plt>
mov    %eax,%edi
call   1050 <mputuleb128@plt>
mov    $0x0,%al
call   1060 <msynch@plt>
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<export_entry>:
push   %rbx
xor    %eax,%eax
call   1070 <mgetstring@plt>
mov    %eax,%edi
call   1030 <mputstring@plt>
xor    %eax,%eax
call   1060 <msynch@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <mgetuleb128@plt>
mov    %eax,%edi
call   1050 <mputuleb128@plt>
xor    %eax,%eax
call   1040 <mgetuleb128@plt>
mov    %eax,%edi
call   1050 <mputuleb128@plt>
xor    %eax,%eax
call   1060 <msynch@plt>
add    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @export_entry() {
%1 = alloca i64
store i64 0, i64* %1
%2 = call i32 (...) @mgetstring()
%3 = call i32 @mputstring(i32 %2)
%4 = call i64 (...) @msynch()
%5 = load i64, i64* %1
%6 = add nsw i64 %5, %4
store i64 %6, i64* %1
%7 = call i32 (...) @mgetuleb128()
%8 = call i32 @mputuleb128(i32 %7)
%9 = call i32 (...) @mgetuleb128()
%10 = call i32 @mputuleb128(i32 %9)
%11 = call i64 (...) @msynch()
%12 = load i64, i64* %1
%13 = add nsw i64 %12, %11
store i64 %13, i64* %1
%14 = load i64, i64* %1
ret i64 %14
}

LLVM IR (-O2):
define i64 @export_entry() {
%1 = tail call i32 (...) @mgetstring()
%2 = tail call i32 @mputstring(i32 %1)
%3 = tail call i64 (...) @msynch()
%4 = tail call i32 (...) @mgetuleb128()
%5 = tail call i32 @mputuleb128(i32 %4)
%6 = tail call i32 (...) @mgetuleb128()
%7 = tail call i32 @mputuleb128(i32 %6)
%8 = tail call i64 (...) @msynch()
%9 = add nsw i64 %8, %3
ret i64 %9
}
int test_imm_00uint8_reg(unsigned char val) {
  return ((val) & (0x00 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0x0,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_00uint8_reg(i8 zeroext %0) {
ret i32 -40
}
void av_codec_get_tag() {}


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

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

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

LLVM IR (-O2):
define void @av_codec_get_tag() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outbyte(char);
comment() { outbyte('#'); }


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

x86 assembly (clang, -O2):
<comment>:
mov    $0x23,%edi
jmp    1030 <outbyte@plt>

LLVM IR (-O0):
define i32 @comment() {
%1 = alloca i32
%2 = call i32 @outbyte(i8 signext 35)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @comment() {
%1 = tail call i32 @outbyte(i8 signext 35)
ret i32 undef
}
/* Variables and functions */
float sin(float);
float sine(float a) {
  float b = sin(a);
  return b;
}


x86 assembly (clang, -O0):
<sine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sine>:
jmp    1030 <sin@plt>

LLVM IR (-O0):
define float @sine(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = call float @sin(float %4)
store float %5, float* %3
%6 = load float, float* %3
ret float %6
}

LLVM IR (-O2):
define float @sine(float %0) {
%2 = tail call float @sin(float %0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ checkKeyPress();
scalar_t__ isTick();
int /*<<< orphan*/ printScreen();
int /*<<< orphan*/ tickActions();
int /*<<< orphan*/ usleep(int);
void tick() {
  if (isTick())
    tickActions();
  usleep(40);
  checkKeyPress();
  usleep(40);
  printScreen();
  usleep(40);
}


x86 assembly (clang, -O0):
<tick>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <isTick@plt>
cmp    $0x0,%rax
je     116c <tick+0x1c>
mov    $0x0,%al
call   1040 <tickActions@plt>
mov    $0x28,%edi
call   1070 <usleep@plt>
mov    $0x0,%al
call   1030 <checkKeyPress@plt>
mov    $0x28,%edi
call   1070 <usleep@plt>
mov    $0x0,%al
call   1060 <printScreen@plt>
mov    $0x28,%edi
call   1070 <usleep@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<tick>:
push   %rax
xor    %eax,%eax
call   1050 <isTick@plt>
test   %rax,%rax
je     1164 <tick+0x14>
xor    %eax,%eax
call   1040 <tickActions@plt>
mov    $0x28,%edi
call   1070 <usleep@plt>
xor    %eax,%eax
call   1030 <checkKeyPress@plt>
mov    $0x28,%edi
call   1070 <usleep@plt>
xor    %eax,%eax
call   1060 <printScreen@plt>
mov    $0x28,%edi
pop    %rax
jmp    1070 <usleep@plt>

LLVM IR (-O0):
define void @tick() {
%1 = call i64 (...) @isTick()
%2 = icmp ne i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 (...) @tickActions()
br label %5
5: ; preds = %3, %0
%6 = call i32 @usleep(i32 40)
%7 = call i32 (...) @checkKeyPress()
%8 = call i32 @usleep(i32 40)
%9 = call i32 (...) @printScreen()
%10 = call i32 @usleep(i32 40)
ret void
}

LLVM IR (-O2):
define void @tick() {
%1 = tail call i64 (...) @isTick()
%2 = icmp eq i64 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @tickActions()
br label %5
5: ; preds = %3, %0
%6 = tail call i32 @usleep(i32 40)
%7 = tail call i32 (...) @checkKeyPress()
%8 = tail call i32 @usleep(i32 40)
%9 = tail call i32 (...) @printScreen()
%10 = tail call i32 @usleep(i32 40)
ret void
}
/* Variables and functions */
char *hnj_malloc(int);
int /*<<< orphan*/ memcpy(char *, char const *, int);
int strlen(char const *);
char *hnj_strdup(const char *s) {
  char *new;
  int l;
  l = strlen(s);
  new = hnj_malloc(l + 1);
  memcpy(new, s, l);
  new[l] = 0;
  return new;
}


x86 assembly (clang, -O0):
<hnj_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
add    $0x1,%edi
call   1050 <hnj_malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hnj_strdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %eax,%r15d
lea    0x1(%r15),%edi
call   1050 <hnj_malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1040 <memcpy@plt>
movslq %r15d,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @hnj_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = add nsw i32 %7, 1
%9 = call i8* @hnj_malloc(i32 %8)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = load i8*, i8** %2
%12 = load i32, i32* %4
%13 = call i32 @memcpy(i8* %10, i8* %11, i32 %12)
%14 = load i8*, i8** %3
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
store i8 0, i8* %17
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
define i8* @hnj_strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i8* @hnj_malloc(i32 %3)
%5 = tail call i32 @memcpy(i8* %4, i8* %0, i32 %2)
%6 = sext i32 %2 to i64
%7 = getelementptr inbounds i8, i8* %4, i64 %6
store i8 0, i8* %7
ret i8* %4
}
/* Variables and functions */
double cos(int);
int log(double);
double random_uniform();
double sqrt(int);
double random_normal(void) {
  double x1 = random_uniform();
  double x2 = random_uniform();
  double y = sqrt(-2 * log(x1)) * cos(2 * 3.14159265358979323846264338328 * x2);
  return y;
}


x86 assembly (clang, -O0):
<random_normal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1030 <random_uniform@plt>
movsd  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <random_uniform@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <log@plt>
imul   $0xfffffffe,%eax,%edi
call   1060 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  0xe7e(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_normal>:
sub    $0x18,%rsp
xor    %eax,%eax
call   1030 <random_uniform@plt>
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1030 <random_uniform@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <log@plt>
lea    (%rax,%rax,1),%edi
neg    %edi
call   1060 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xe79(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <cos@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @random_normal() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = call double (...) @random_uniform()
store double %4, double* %1
%5 = call double (...) @random_uniform()
store double %5, double* %2
%6 = load double, double* %1
%7 = call i32 @log(double %6)
%8 = mul nsw i32 -2, %7
%9 = call double @sqrt(i32 %8)
%10 = load double, double* %2
%11 = fmul double 0x401921FB54442D18, %10
%12 = fptosi double %11 to i32
%13 = call double @cos(i32 %12)
%14 = fmul double %9, %13
store double %14, double* %3
%15 = load double, double* %3
ret double %15
}

LLVM IR (-O2):
define double @random_normal() {
%1 = tail call double (...) @random_uniform()
%2 = tail call double (...) @random_uniform()
%3 = tail call i32 @log(double %1)
%4 = mul nsw i32 %3, -2
%5 = tail call double @sqrt(i32 %4)
%6 = fmul double %2, 0x401921FB54442D18
%7 = fptosi double %6 to i32
%8 = tail call double @cos(i32 %7)
%9 = fmul double %5, %8
ret double %9
}