xunge/DecIR huggingface dataset:
/* Variables and functions */
double avg(char *, double, int, double, int, int, int, int, int, int);
int /*<<< orphan*/ printf(char *, double);
int main(int argc, char *argv[]) {
  double foo;
  foo = avg("fifiiiiii", 1.0, 2, 3.0, 4, 5, 6, 7, 8, 9);
  printf("average: %f\n", foo);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rdi
movsd  0xebb(%rip),%xmm0
mov    $0x2,%esi
movsd  0xeb6(%rip),%xmm1
mov    $0x4,%edx
mov    $0x5,%ecx
mov    $0x6,%r8d
mov    $0x7,%r9d
movl   $0x8,(%rsp)
movl   $0x9,0x8(%rsp)
call   1040 <avg@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
movsd  0xed0(%rip),%xmm0
movsd  0xed0(%rip),%xmm1
mov    $0x2,%esi
mov    $0x4,%edx
mov    $0x5,%ecx
mov    $0x6,%r8d
mov    $0x7,%r9d
push   $0x9
push   $0x8
call   1040 <avg@plt>
add    $0x10,%rsp
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"fifiiiiii\00"
@.str.1 = [13 x i8] c"average: %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call double @avg(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double 1.000000e+00, i32 2, double 3.000000e+00, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9)
store double %7, double* %6
%8 = load double, double* %6
%9 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"fifiiiiii\00"
@.str.1 = [13 x i8] c"average: %f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call double @avg(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double 1.000000e+00, i32 2, double 3.000000e+00, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %3)
ret i32 0
}
double Dot2D(int tbl[], double x, double y) { return tbl[0] * x + tbl[1] * y; }


x86 assembly (clang, -O0):
<Dot2D>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cvtsi2sdl (%rax),%xmm0
movsd  -0x10(%rbp),%xmm2
mov    -0x8(%rbp),%rax
cvtsi2sdl 0x4(%rax),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Dot2D>:
cvtsi2sdl (%rdi),%xmm2
cvtsi2sdl 0x4(%rdi),%xmm3
mulsd  %xmm1,%xmm3
mulsd  %xmm2,%xmm0
addsd  %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @Dot2D(i32* %0, double %1, double %2) {
%4 = alloca i32*
%5 = alloca double
%6 = alloca double
store i32* %0, i32** %4
store double %1, double* %5
store double %2, double* %6
%7 = load i32*, i32** %4
%8 = getelementptr inbounds i32, i32* %7, i64 0
%9 = load i32, i32* %8
%10 = sitofp i32 %9 to double
%11 = load double, double* %5
%12 = load i32*, i32** %4
%13 = getelementptr inbounds i32, i32* %12, i64 1
%14 = load i32, i32* %13
%15 = sitofp i32 %14 to double
%16 = load double, double* %6
%17 = fmul double %15, %16
%18 = call double @llvm.fmuladd.f64(double %10, double %11, double %17)
ret double %18
}

LLVM IR (-O2):
define double @Dot2D(i32* nocapture %0, double %1, double %2) {
%4 = load i32, i32* %0
%5 = sitofp i32 %4 to double
%6 = getelementptr inbounds i32, i32* %0, i64 1
%7 = load i32, i32* %6
%8 = sitofp i32 %7 to double
%9 = fmul double %8, %2
%10 = tail call double @llvm.fmuladd.f64(double %5, double %1, double %9)
ret double %10
}
int test_2() {

#pragma GCC diagnostic ignored "-Wunused-variable"

  int x;
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @test_2() {
%1 = alloca i32
ret i32 0
}

LLVM IR (-O2):
define i32 @test_2() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void closeWithError(char *error) {
  perror(error);
  exit(1);
}


x86 assembly (clang, -O0):
<closeWithError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
define void @closeWithError(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @closeWithError(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int getlinex(char *, int);
int /*<<< orphan*/ printf(char *, int, char *);
int main() {
  int len;
  char line[1000];
  while ((len = getlinex(line, 1000)) > 0) {
    printf("%5d: %s", len, line);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    $0x3e8,%esi
call   1030 <getlinex@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    116a <main+0x4a>
mov    -0x8(%rbp),%esi
lea    -0x3f0(%rbp),%rdx
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
jmp    1132 <main+0x12>
mov    -0x4(%rbp),%eax
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3e8,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1030 <getlinex@plt>
test   %eax,%eax
jle    116e <main+0x4e>
lea    0xebe(%rip),%r14
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %eax,%esi
mov    %rbx,%rdx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1030 <getlinex@plt>
test   %eax,%eax
jg     1150 <main+0x30>
xor    %eax,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"%5d: %s\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = call i32 @getlinex(i8* %2, i32 1000)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %0, %5
%6 = phi i32 [ %8, %5 ], [ %3, %0 ]
%7 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %6, i8* %2)
%8 = call i32 @getlinex(i8* %2, i32 1000)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %5, label %10
10: ; preds = %5, %0
ret i32 0
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int celcon_append_lifted_point(int n, int i, double *point) {
  int fail;
  fail = _ada_use_c2phc4c(92, &i, &n, point, 0);
  return fail;
}


x86 assembly (clang, -O0):
<celcon_append_lifted_point>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    $0x5c,%edi
lea    -0x8(%rbp),%rsi
lea    -0x4(%rbp),%rdx
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<celcon_append_lifted_point>:
push   %rax
mov    %rdx,%rcx
mov    %edi,0x4(%rsp)
mov    %esi,(%rsp)
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
mov    $0x5c,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @celcon_append_lifted_point(i32 %0, i32 %1, double* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca double*
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store double* %2, double** %6
%8 = load double*, double** %6
%9 = call i32 @_ada_use_c2phc4c(i32 92, i32* %5, i32* %4, double* %8, i32 0)
store i32 %9, i32* %7
%10 = load i32, i32* %7
ret i32 %10
}

LLVM IR (-O2):
define i32 @celcon_append_lifted_point(i32 %0, i32 %1, double* %2) {
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = call i32 @_ada_use_c2phc4c(i32 92, i32* %5, i32* %4, double* %2, i32 0)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(void) {
  int a, b;
  scanf("%d%d", &a, &b);
  printf("%d\n", a + b);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = add nsw i32 %7, %6
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}
int audioFeed(char *src, int len) {}


x86 assembly (clang, -O0):
<audioFeed>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @audioFeed(i8* nocapture readnone %0, i32 %1) {
ret i32 undef
}
int create_cursor() { return 0; }


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

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

LLVM IR (-O0):
define i32 @create_cursor() {
ret i32 0
}

LLVM IR (-O2):
define i32 @create_cursor() {
ret i32 0
}
/* Variables and functions */
long double cosl(long double);
long double sinl(long double);
void sincosl(long double x, long double *p_sinl, long double *p_cosl) {
  *p_sinl = sinl(x);
  *p_cosl = cosl(x);
}


x86 assembly (clang, -O0):
<sincosl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <sinl@plt>
mov    -0x18(%rbp),%rax
fstpt  (%rax)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <cosl@plt>
mov    -0x20(%rbp),%rax
fstpt  (%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sincosl>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
fldt   0x40(%rsp)
fld    %st(0)
fstpt  0x1c(%rsp)
fstpt  (%rsp)
call   1030 <sinl@plt>
fstpt  (%rbx)
fldt   0x1c(%rsp)
fstpt  (%rsp)
call   1040 <cosl@plt>
fstpt  (%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @sincosl(x86_fp80 %0, x86_fp80* %1, x86_fp80* %2) {
%4 = alloca x86_fp80
%5 = alloca x86_fp80*
%6 = alloca x86_fp80*
store x86_fp80 %0, x86_fp80* %4
store x86_fp80* %1, x86_fp80** %5
store x86_fp80* %2, x86_fp80** %6
%7 = load x86_fp80, x86_fp80* %4
%8 = call x86_fp80 @sinl(x86_fp80 %7)
%9 = load x86_fp80*, x86_fp80** %5
store x86_fp80 %8, x86_fp80* %9
%10 = load x86_fp80, x86_fp80* %4
%11 = call x86_fp80 @cosl(x86_fp80 %10)
%12 = load x86_fp80*, x86_fp80** %6
store x86_fp80 %11, x86_fp80* %12
ret void
}

LLVM IR (-O2):
define void @sincosl(x86_fp80 %0, x86_fp80* nocapture writeonly %1, x86_fp80* nocapture writeonly %2) {
%4 = tail call x86_fp80 @sinl(x86_fp80 %0)
store x86_fp80 %4, x86_fp80* %1
%5 = tail call x86_fp80 @cosl(x86_fp80 %0)
store x86_fp80 %5, x86_fp80* %2
ret void
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ XPointer;
struct TYPE_3__ {
  scalar_t__ type;
};
typedef TYPE_1__ XEvent;
typedef int /*<<< orphan*/ Display;
typedef int Bool;

/* Variables and functions */
scalar_t__ MotionNotify;
Bool match_motion_events(Display *dpy, XEvent *ev, XPointer arg) {
  return ev->type == MotionNotify;
}


x86 assembly (clang, -O0):
<match_motion_events>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    0x2ecb(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_motion_events>:
mov    (%rsi),%rcx
mov    0x2ede(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%rcx
sete   %al
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64 }
@MotionNotify = global i64 0
define i32 @match_motion_events(i32* %0, %struct.TYPE_3__* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca %struct.TYPE_3__*
%6 = alloca i32
store i32* %0, i32** %4
store %struct.TYPE_3__* %1, %struct.TYPE_3__** %5
store i32 %2, i32* %6
%7 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%8 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %7, i32 0, i32 0
%9 = load i64, i64* %8
%10 = load i64, i64* @MotionNotify
%11 = icmp eq i64 %9, %10
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i64 }
@MotionNotify = global i64 0
define i32 @match_motion_events(i32* nocapture readnone %0, %struct.TYPE_3__* nocapture %1, i32 %2) {
%4 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 0
%5 = load i64, i64* %4
%6 = load i64, i64* @MotionNotify
%7 = icmp eq i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int get_third_smallest_number();
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char const *argv[]) {
  printf("%i\n", get_third_smallest_number());
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <get_third_smallest_number@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%i\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @get_third_smallest_number()
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @get_third_smallest_number()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ pcShared();
int /*<<< orphan*/ pcStatic();
int main() {
  pcStatic();
  pcShared();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <pcStatic@plt>
xor    %eax,%eax
call   1030 <pcShared@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @pcStatic()
%2 = tail call i32 (...) @pcShared()
ret i32 0
}
/* Variables and functions */
int main(void) {
  unsigned int **b;
  int **c;
  c = b;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
long good_rand(long x) {
  register long hi, lo;
  hi = x / 127773;
  lo = x % 127773;
  x = 16807 * lo - 2836 * hi;
  if (x <= 0)
    x += 0x7fffffff;
  return (x);
}


x86 assembly (clang, -O0):
<good_rand>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x1f31d,%ecx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x1f31d,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x18(%rbp)
imul   $0x41a7,-0x18(%rbp),%rax
imul   $0xb14,-0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jg     115c <good_rand+0x5c>
mov    -0x8(%rbp),%rax
add    $0x7fffffff,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<good_rand>:
movabs $0x41a705af1fe3fb79,%rcx
05 a7 41
mov    %rdi,%rax
imul   %rcx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0xf,%rdx
add    %rax,%rdx
imul   $0x1f31d,%rdx,%rax
sub    %rax,%rdi
imul   $0x41a7,%rdi,%rax
imul   $0xfffffffffffff4ec,%rdx,%rcx
lea    (%rcx,%rax,1),%rdx
test   %rdx,%rdx
lea    0x7fffffff(%rcx,%rax,1),%rax
7f
cmovg  %rdx,%rax
ret

LLVM IR (-O0):
define i64 @good_rand(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %2
%5 = load i64, i64* %2
%6 = sdiv i64 %5, 127773
store i64 %6, i64* %3
%7 = load i64, i64* %2
%8 = srem i64 %7, 127773
store i64 %8, i64* %4
%9 = load i64, i64* %4
%10 = mul nsw i64 16807, %9
%11 = load i64, i64* %3
%12 = mul nsw i64 2836, %11
%13 = sub nsw i64 %10, %12
store i64 %13, i64* %2
%14 = load i64, i64* %2
%15 = icmp sle i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %1
%17 = load i64, i64* %2
%18 = add nsw i64 %17, 2147483647
store i64 %18, i64* %2
br label %19
19: ; preds = %16, %1
%20 = load i64, i64* %2
ret i64 %20
}

LLVM IR (-O2):
define i64 @good_rand(i64 %0) {
%2 = sdiv i64 %0, 127773
%3 = srem i64 %0, 127773
%4 = mul nsw i64 %3, 16807
%5 = mul nsw i64 %2, -2836
%6 = add nsw i64 %5, %4
%7 = icmp slt i64 %6, 1
%8 = add nsw i64 %6, 2147483647
%9 = select i1 %7, i64 %8, i64 %6
ret i64 %9
}
/* Variables and functions */
long ssl3_default_timeout(void) { return (60 * 60 * 2); }


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

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

LLVM IR (-O0):
define i64 @ssl3_default_timeout() {
ret i64 7200
}

LLVM IR (-O2):
define i64 @ssl3_default_timeout() {
ret i64 7200
}
/* Variables and functions */
int /*<<< orphan*/ assem_debug(char *, int, int, int);
int /*<<< orphan*/ output_w32(int);
void emit_fsubd(int s1, int s2, int d) {
  assem_debug("fsubd d%d,d%d,d%d\n", d, s1, s2);
  output_w32(0xee300b40 | ((d & 7) << 12) | ((s1 & 7) << 16) | (s2 & 7));
}


x86 assembly (clang, -O0):
<emit_fsubd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xebf(%rip),%rdi
call   1030 <assem_debug@plt>
mov    -0xc(%rbp),%edi
and    $0x7,%edi
shl    $0xc,%edi
or     $0xee300b40,%edi
mov    -0x4(%rbp),%eax
and    $0x7,%eax
shl    $0x10,%eax
or     %eax,%edi
mov    -0x8(%rbp),%eax
and    $0x7,%eax
or     %eax,%edi
call   1040 <output_w32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_fsubd>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xece(%rip),%rdi
mov    %edx,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1030 <assem_debug@plt>
and    $0x7,%r14d
shl    $0xc,%r14d
and    $0x7,%ebp
shl    $0x10,%ebp
and    $0x7,%ebx
or     %ebp,%ebx
lea    (%r14,%rbx,1),%edi
add    $0xee300b40,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <output_w32@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"fsubd d%d,d%d,d%d\0A\00"
define void @emit_fsubd(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = call i32 @assem_debug(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8, i32 %9)
%11 = load i32, i32* %6
%12 = and i32 %11, 7
%13 = shl i32 %12, 12
%14 = or i32 -298841280, %13
%15 = load i32, i32* %4
%16 = and i32 %15, 7
%17 = shl i32 %16, 16
%18 = or i32 %14, %17
%19 = load i32, i32* %5
%20 = and i32 %19, 7
%21 = or i32 %18, %20
%22 = call i32 @output_w32(i32 %21)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"fsubd d%d,d%d,d%d\0A\00"
define void @emit_fsubd(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @assem_debug(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %0, i32 %1)
%5 = shl i32 %2, 12
%6 = and i32 %5, 28672
%7 = shl i32 %0, 16
%8 = and i32 %7, 458752
%9 = and i32 %1, 7
%10 = or i32 %8, %9
%11 = or i32 %10, %6
%12 = or i32 %11, -298841280
%13 = tail call i32 @output_w32(i32 %12)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AT_FDCWD;
int /*<<< orphan*/ __NR_symlinkat;
int syscall(int /*<<< orphan*/, char const *, int /*<<< orphan*/, char const *);
__attribute__((always_)) int _syscall_symlink(const char *target,
                                              const char *linkpath) {
  return syscall(__NR_symlinkat, target, AT_FDCWD, linkpath);
}


x86 assembly (clang, -O0):
<_syscall_symlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    0x2e9c(%rip),%rax
mov    (%rax),%edx
mov    -0x10(%rbp),%rcx
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_syscall_symlink>:
mov    %rsi,%rcx
mov    %rdi,%rsi
mov    0x2ecb(%rip),%rax
mov    (%rax),%edi
mov    0x2eaa(%rip),%rax
mov    (%rax),%edx
jmp    1030 <syscall@plt>

LLVM IR (-O0):
@__NR_symlinkat = global i32 0
@AT_FDCWD = global i32 0
define i32 @_syscall_symlink(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @__NR_symlinkat
%6 = load i8*, i8** %3
%7 = load i32, i32* @AT_FDCWD
%8 = load i8*, i8** %4
%9 = call i32 @syscall(i32 %5, i8* %6, i32 %7, i8* %8)
ret i32 %9
}

LLVM IR (-O2):
@__NR_symlinkat = global i32 0
@AT_FDCWD = global i32 0
define i32 @_syscall_symlink(i8* %0, i8* %1) {
%3 = load i32, i32* @__NR_symlinkat
%4 = load i32, i32* @AT_FDCWD
%5 = tail call i32 @syscall(i32 %3, i8* %0, i32 %4, i8* %1)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ *tracefs_find_mountpoint();
bool tracefs_configured(void) { return tracefs_find_mountpoint() != NULL; }


x86 assembly (clang, -O0):
<tracefs_configured>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <tracefs_find_mountpoint@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tracefs_configured>:
push   %rax
xor    %eax,%eax
call   1030 <tracefs_find_mountpoint@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @tracefs_configured() {
%1 = call i32* (...) @tracefs_find_mountpoint()
%2 = icmp ne i32* %1, null
%3 = zext i1 %2 to i32
ret i32 %3
}

LLVM IR (-O2):
define i32 @tracefs_configured() {
%1 = tail call i32* (...) @tracefs_find_mountpoint()
%2 = icmp ne i32* %1, null
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int __VERIFIER_nondet_int();
int *alloca(int);
int main() {
  int *x = alloca(sizeof(int));
  *x = __VERIFIER_nondet_int();
  while (*x >= 0) {
    *x = 2 * (*x) + 10;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jl     1170 <main+0x50>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
shl    $0x1,%ecx
add    $0xa,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    114c <main+0x2c>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
test   %eax,%eax
js     114f <main+0x2f>
nopl   0x0(%rax)
lea    (%rax,%rax,1),%ecx
add    $0xa,%ecx
cmp    $0xfffffffa,%eax
mov    %ecx,%eax
jg     1140 <main+0x20>
jmp    1151 <main+0x31>
mov    %eax,%ecx
mov    %ecx,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @alloca(i32 4)
%2 = tail call i32 (...) @__VERIFIER_nondet_int()
%3 = icmp sgt i32 %2, -1
br i1 %3, label %4, label %9
4: ; preds = %0, %4
%5 = phi i32 [ %7, %4 ], [ %2, %0 ]
%6 = shl nuw nsw i32 %5, 1
%7 = add nsw i32 %6, 10
%8 = icmp sgt i32 %5, -6
br i1 %8, label %4, label %9
9: ; preds = %4, %0
%10 = phi i32 [ %2, %0 ], [ %7, %4 ]
store i32 %10, i32* %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ bar(char, char);
int foo(char b) {
  char a;
  a = b;
  b = 'b';
  bar(a, b);
  b = a;
  if (b == 0)
    a++;
  return a + b;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
mov    %al,-0x2(%rbp)
movb   $0x62,-0x1(%rbp)
mov    -0x2(%rbp),%al
movsbl %al,%edi
movsbl -0x1(%rbp),%esi
call   1030 <bar@plt>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x0,%eax
jne    1152 <foo+0x42>
mov    -0x2(%rbp),%al
add    $0x1,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
movsbl -0x1(%rbp),%ecx
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbx
mov    %edi,%ebx
mov    $0x62,%esi
call   1030 <bar@plt>
test   %bl,%bl
mov    $0x1,%eax
cmovne %ebx,%eax
add    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @foo(i8 signext %0) {
%2 = tail call i32 @bar(i8 signext %0, i8 signext 98)
%3 = icmp eq i8 %0, 0
%4 = select i1 %3, i8 1, i8 %0
%5 = sext i8 %0 to i32
%6 = sext i8 %4 to i32
%7 = add nsw i32 %6, %5
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ _assert_true(unsigned long long, char *, char *, int);
int /*<<< orphan*/ free(void *);
void free_value(const void *value, void *cleanup_value_data) {
  _assert_true(((unsigned long long)((value))), "value",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/50wu/gpdb/refs/heads/master/"
               "src/test/unit/cmockery/cmockery.c",
               500);
  free((void *)value);
}


x86 assembly (clang, -O0):
<free_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec5(%rip),%rsi
lea    0xec4(%rip),%rdx
mov    $0x1f4,%ecx
call   1040 <_assert_true@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_value>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rsi
lea    0xed4(%rip),%rdx
mov    $0x1f4,%ecx
call   1040 <_assert_true@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"value\00"
@.str.1 = [152 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/50wu/gpdb/refs/heads/master/src/test/unit/cmockery/cmockery.c\00"
define void @free_value(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i64
%7 = call i32 @_assert_true(i64 %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.1, i64 0, i64 0), i32 500)
%8 = load i8*, i8** %3
%9 = call i32 @free(i8* %8)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"value\00"
@.str.1 = [152 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/50wu/gpdb/refs/heads/master/src/test/unit/cmockery/cmockery.c\00"
define void @free_value(i8* %0, i8* nocapture readnone %1) {
%3 = ptrtoint i8* %0 to i64
%4 = tail call i32 @_assert_true(i64 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.1, i64 0, i64 0), i32 500)
%5 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int system_time();
unsigned long gettime() { return system_time() / 1000; }


x86 assembly (clang, -O0):
<gettime>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <system_time@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<gettime>:
push   %rax
xor    %eax,%eax
call   1030 <system_time@plt>
cltq
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i64 @gettime() {
%1 = call i32 (...) @system_time()
%2 = sdiv i32 %1, 1000
%3 = sext i32 %2 to i64
ret i64 %3
}

LLVM IR (-O2):
define i64 @gettime() {
%1 = tail call i32 (...) @system_time()
%2 = sdiv i32 %1, 1000
%3 = sext i32 %2 to i64
ret i64 %3
}
/* Type definitions */
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
scalar_t__ ntohs(int);
uint16_t csum_expected(uint16_t sum, uint16_t computed_sum) {
  uint32_t shouldbe;
  shouldbe = sum;
  shouldbe += ntohs(computed_sum);
  shouldbe = (shouldbe & 0xFFFF) + (shouldbe >> 16);
  shouldbe = (shouldbe & 0xFFFF) + (shouldbe >> 16);
  return shouldbe;
}


x86 assembly (clang, -O0):
<csum_expected>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <ntohs@plt>
mov    %rax,%rcx
movslq -0xc(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xffff,%eax
mov    -0xc(%rbp),%ecx
sar    $0x10,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xffff,%eax
mov    -0xc(%rbp),%ecx
sar    $0x10,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csum_expected>:
push   %rbx
mov    %edi,%ebx
mov    %esi,%edi
call   1030 <ntohs@plt>
add    %ebx,%eax
movzwl %ax,%ecx
sar    $0x10,%eax
add    %ecx,%eax
movzwl %ax,%ecx
sar    $0x10,%eax
add    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @csum_expected(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
store i32 %6, i32* %5
%7 = load i32, i32* %4
%8 = call i64 @ntohs(i32 %7)
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = add nsw i64 %10, %8
%12 = trunc i64 %11 to i32
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = and i32 %13, 65535
%15 = load i32, i32* %5
%16 = ashr i32 %15, 16
%17 = add nsw i32 %14, %16
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = and i32 %18, 65535
%20 = load i32, i32* %5
%21 = ashr i32 %20, 16
%22 = add nsw i32 %19, %21
store i32 %22, i32* %5
%23 = load i32, i32* %5
ret i32 %23
}

LLVM IR (-O2):
define i32 @csum_expected(i32 %0, i32 %1) {
%3 = tail call i64 @ntohs(i32 %1)
%4 = trunc i64 %3 to i32
%5 = add i32 %4, %0
%6 = and i32 %5, 65535
%7 = ashr i32 %5, 16
%8 = add nsw i32 %6, %7
%9 = and i32 %8, 65535
%10 = ashr i32 %8, 16
%11 = add nsw i32 %9, %10
ret i32 %11
}
A2(x) {
  int y[9999];
  return 2 * (x + 3);
}


x86 assembly (clang, -O0):
<A2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9bc0,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x3,%eax
shl    $0x1,%eax
add    $0x9bc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<A2>:
lea    (%rdi,%rdi,1),%eax
add    $0x6,%eax
ret

LLVM IR (-O0):
define i32 @A2(i32 %0) {
%2 = alloca i32
%3 = alloca [9999 x i32]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 3
%6 = mul nsw i32 2, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @A2(i32 %0) {
%2 = shl i32 %0, 1
%3 = add i32 %2, 6
ret i32 %3
}
char *reg_get_flag_name(int coord) {
  char *coordunit[] = {"Unknown", "Logical", "Physical", "World"};
  if (coord > 3 || coord < 0) {
    return coordunit[0];
  }
  return coordunit[coord];
}


x86 assembly (clang, -O0):
<reg_get_flag_name>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    0x2d22(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2d1f(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2d1c(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2d19(%rip),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x3,-0xc(%rbp)
jg     1147 <reg_get_flag_name+0x47>
cmpl   $0x0,-0xc(%rbp)
jge    1154 <reg_get_flag_name+0x54>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1161 <reg_get_flag_name+0x61>
movslq -0xc(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reg_get_flag_name>:
cmp    $0x4,%edi
movslq %edi,%rax
lea    0x2d23(%rip),%rcx
lea    (%rcx,%rax,8),%rax
cmovae %rcx,%rax
mov    (%rax),%rax
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Unknown\00"
@.str.1 = [8 x i8] c"Logical\00"
@.str.2 = [9 x i8] c"Physical\00"
@.str.3 = [6 x i8] c"World\00"
@__const.reg_get_flag_name.coordunit = [4 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0)]
define i8* @reg_get_flag_name(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [4 x i8*]
store i32 %0, i32* %3
%5 = bitcast [4 x i8*]* %4 to i8*
%6 = load i32, i32* %3
%7 = icmp sgt i32 %6, 3
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8, %1
%12 = getelementptr inbounds [4 x i8*], [4 x i8*]* %4, i64 0, i64 0
%13 = load i8*, i8** %12
store i8* %13, i8** %2
br label %19
14: ; preds = %8
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [4 x i8*], [4 x i8*]* %4, i64 0, i64 %16
%18 = load i8*, i8** %17
store i8* %18, i8** %2
br label %19
19: ; preds = %14, %11
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
@.str = [8 x i8] c"Unknown\00"
@.str.1 = [8 x i8] c"Logical\00"
@.str.2 = [9 x i8] c"Physical\00"
@.str.3 = [6 x i8] c"World\00"
@__const.reg_get_flag_name.coordunit = [4 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0)]
define i8* @reg_get_flag_name(i32 %0) {
%2 = icmp ugt i32 %0, 3
%3 = sext i32 %0 to i64
%4 = getelementptr inbounds [4 x i8*], [4 x i8*]* @__const.reg_get_flag_name.coordunit, i64 0, i64 %3
%5 = select i1 %2, i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @__const.reg_get_flag_name.coordunit, i64 0, i64 0), i8** %4
%6 = load i8*, i8** %5
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int sqrt(int);
int main(void) {
  int max = sqrt(9);
  printf("%d\n", max);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x9,%edi
call   1040 <sqrt@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
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
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @sqrt(i32 9)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @sqrt(i32 9)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
void VID_PrepareModeList(void) {}


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

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

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

LLVM IR (-O2):
define void @VID_PrepareModeList() {
ret void
}
/* Type definitions */
struct tms {
  int dummy;
};
typedef int clock_t;

/* Variables and functions */
clock_t _times(struct tms *buf) { return -1; }


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

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

LLVM IR (-O0):
%struct.tms = type { i32 }
define i32 @_times(%struct.tms* %0) {
%2 = alloca %struct.tms*
store %struct.tms* %0, %struct.tms** %2
ret i32 -1
}

LLVM IR (-O2):
%struct.tms = type { i32 }
define i32 @_times(%struct.tms* nocapture readnone %0) {
ret i32 -1
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long colormap;
};
typedef TYPE_1__ XSetWindowAttributes;

/* Variables and functions */
void set_XSetWindowAttributes_colormap(void *_p, unsigned long _v) {
  ((XSetWindowAttributes *)_p)->colormap = (unsigned long)_v;
}


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

x86 assembly (clang, -O2):
<set_XSetWindowAttributes_colormap>:
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define void @set_XSetWindowAttributes_colormap(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %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 i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @set_XSetWindowAttributes_colormap(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
int do_754() { return 754; }


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

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

LLVM IR (-O0):
define i32 @do_754() {
ret i32 754
}

LLVM IR (-O2):
define i32 @do_754() {
ret i32 754
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
void main() {
  int32_t a;
  a = 3;
  a %= 2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @main() {
ret void
}
__attribute__((no, noipa)) void g(char *ptr, int y) { ptr[y] = '\0'; }


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<g>:
movslq %esi,%rax
movb   $0x0,(%rdi,%rax,1)
ret

LLVM IR (-O0):
define void @g(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
store i8 0, i8* %8
ret void
}

LLVM IR (-O2):
define void @g(i8* nocapture writeonly %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
store i8 0, i8* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ base_test();
int /*<<< orphan*/ greth_test(int);
int /*<<< orphan*/ report_end();
int /*<<< orphan*/ report_start();
main() {
  report_start();
  base_test();
  greth_test(0x80000f00);
  report_end();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <report_start@plt>
mov    $0x0,%al
call   1050 <base_test@plt>
mov    $0x80000f00,%edi
call   1040 <greth_test@plt>
mov    $0x0,%al
call   1030 <report_end@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <report_start@plt>
xor    %eax,%eax
call   1050 <base_test@plt>
mov    $0x80000f00,%edi
call   1040 <greth_test@plt>
xor    %eax,%eax
call   1030 <report_end@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @report_start()
%2 = call i32 (...) @base_test()
%3 = call i32 @greth_test(i32 -2147479808)
%4 = call i32 (...) @report_end()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @report_start()
%2 = tail call i32 (...) @base_test()
%3 = tail call i32 @greth_test(i32 -2147479808)
%4 = tail call i32 (...) @report_end()
ret i32 0
}
/* Type definitions */
struct spawn {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ die(char *);
int runnable_execute(const void *_this, struct spawn *spawn) {
  ((void)(_this));
  ((void)(spawn));
  die("Invoke pure virtual: runnable->execute.");
  return -1;
}


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

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

LLVM IR (-O0):
%struct.spawn = type { i32 }
@.str = [40 x i8] c"Invoke pure virtual: runnable->execute.\00"
define i32 @runnable_execute(i8* %0, %struct.spawn* %1) {
%3 = alloca i8*
%4 = alloca %struct.spawn*
store i8* %0, i8** %3
store %struct.spawn* %1, %struct.spawn** %4
%5 = load i8*, i8** %3
%6 = load %struct.spawn*, %struct.spawn** %4
%7 = call i32 @die(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
%struct.spawn = type { i32 }
@.str = [40 x i8] c"Invoke pure virtual: runnable->execute.\00"
define i32 @runnable_execute(i8* nocapture readnone %0, %struct.spawn* nocapture readnone %1) {
%3 = tail call i32 @die(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int rte_is_power_of_2(uint32_t n) { return n && !(n & (n - 1)); }


x86 assembly (clang, -O0):
<rte_is_power_of_2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     112c <rte_is_power_of_2+0x2c>
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rte_is_power_of_2>:
test   %edi,%edi
je     110f <rte_is_power_of_2+0xf>
lea    -0x1(%rdi),%ecx
xor    %eax,%eax
test   %ecx,%edi
sete   %al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @rte_is_power_of_2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = load i32, i32* %2
%7 = load i32, i32* %2
%8 = sub nsw i32 %7, 1
%9 = and i32 %6, %8
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
br label %12
12: ; preds = %5, %1
%13 = phi i1 [ false, %1 ], [ %11, %5 ]
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @rte_is_power_of_2(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i32 @llvm.ctpop.i32(i32 %0)
%5 = icmp ult i32 %4, 2
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %1
%8 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %8
}