xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int sm_request_add(void *data, int len) {
  printf("request add:%s\n", (char *)data);
  return 0;
}


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

x86 assembly (clang, -O2):
<sm_request_add>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"request add:%s\0A\00"
define i32 @sm_request_add(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 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"request add:%s\0A\00"
define i32 @sm_request_add(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 0
}
int get_pow(int val, int base) {
  int nearest = 1;
  while (nearest < val) {
    nearest *= base;
  }
  return nearest;
}


x86 assembly (clang, -O0):
<get_pow>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    112c <get_pow+0x2c>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1111 <get_pow+0x11>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_pow>:
mov    $0x1,%eax
cmp    $0x2,%edi
jl     1117 <get_pow+0x17>
mov    $0x1,%eax
nop
imul   %esi,%eax
cmp    %edi,%eax
jl     1110 <get_pow+0x10>
ret

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

LLVM IR (-O2):
define i32 @get_pow(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2, %4
%5 = phi i32 [ %6, %4 ], [ 1, %2 ]
%6 = mul nsw i32 %5, %1
%7 = icmp slt i32 %6, %0
br i1 %7, label %4, label %8
8: ; preds = %4, %2
%9 = phi i32 [ 1, %2 ], [ %6, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ fabs(int);
float sqrt(int /*<<< orphan*/);
float findvifrom_a_vf_x(float a, float vf, float x) {
  return sqrt(fabs((-2 * a * x) + (vf * vf)));
}


x86 assembly (clang, -O0):
<findvifrom_a_vf_x>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  0xec1(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1030 <fabs@plt>
mov    %eax,%edi
call   1040 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findvifrom_a_vf_x>:
push   %rax
mulss  0xed7(%rip),%xmm0
mulss  %xmm1,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1030 <fabs@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <sqrt@plt>

LLVM IR (-O0):
define float @findvifrom_a_vf_x(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = fmul float -2.000000e+00, %7
%9 = load float, float* %6
%10 = load float, float* %5
%11 = load float, float* %5
%12 = fmul float %10, %11
%13 = call float @llvm.fmuladd.f32(float %8, float %9, float %12)
%14 = fptosi float %13 to i32
%15 = call i32 @fabs(i32 %14)
%16 = call float @sqrt(i32 %15)
ret float %16
}

LLVM IR (-O2):
define float @findvifrom_a_vf_x(float %0, float %1, float %2) {
%4 = fmul float %0, -2.000000e+00
%5 = fmul float %1, %1
%6 = tail call float @llvm.fmuladd.f32(float %4, float %2, float %5)
%7 = fptosi float %6 to i32
%8 = tail call i32 @fabs(i32 %7)
%9 = tail call float @sqrt(i32 %8)
ret float %9
}
/* Variables and functions */
int /*<<< orphan*/ DumpAllMemory();
int /*<<< orphan*/ finish();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void ill() {
  fprintf(stderr, "Illegal Opcode\n");
  DumpAllMemory();
  fprintf(stderr, "Illegal Opcode\n");
  finish();
}


x86 assembly (clang, -O0):
<ill>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
lea    0xebc(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1050 <DumpAllMemory@plt>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <finish@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ill>:
push   %r14
push   %rbx
push   %rax
mov    0x2ea5(%rip),%r14
mov    (%r14),%edi
lea    0xebb(%rip),%rbx
mov    %rbx,%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1050 <DumpAllMemory@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <finish@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"Illegal Opcode\0A\00"
define void @ill() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @DumpAllMemory()
%4 = load i32, i32* @stderr
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (...) @finish()
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"Illegal Opcode\0A\00"
define void @ill() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @DumpAllMemory()
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (...) @finish()
ret void
}
int cijfersom(int i, int *r) {
  int som = 0;
  while (i > 0) {
    som = som + (i % 10);
    i = i / 10;
  }
  *r = som;
  return som;
}


x86 assembly (clang, -O0):
<cijfersom>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1148 <cijfersom+0x48>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    1112 <cijfersom+0x12>
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cijfersom>:
xor    %eax,%eax
test   %edi,%edi
jle    112f <cijfersom+0x2f>
mov    $0xcccccccd,%r8d
nopl   0x0(%rax)
mov    %edi,%edx
imul   %r8,%rdx
shr    $0x23,%rdx
lea    (%rdx,%rdx,1),%ecx
lea    (%rcx,%rcx,4),%r9d
mov    %edi,%ecx
sub    %r9d,%ecx
add    %ecx,%eax
cmp    $0x9,%edi
mov    %edx,%edi
ja     1110 <cijfersom+0x10>
mov    %eax,(%rsi)
ret

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

LLVM IR (-O2):
define i32 @cijfersom(i32 %0, i32* nocapture writeonly %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %11
4: ; preds = %2, %4
%5 = phi i32 [ %8, %4 ], [ 0, %2 ]
%6 = phi i32 [ %9, %4 ], [ %0, %2 ]
%7 = urem i32 %6, 10
%8 = add nuw nsw i32 %5, %7
%9 = udiv i32 %6, 10
%10 = icmp ult i32 %6, 10
br i1 %10, label %11, label %4
11: ; preds = %4, %2
%12 = phi i32 [ 0, %2 ], [ %8, %4 ]
store i32 %12, i32* %1
ret i32 %12
}
unsigned int rng_seed_from_tid_nodeid(signed int tid, signed int node) {
  unsigned int seedbuf[11l] = {
      (unsigned int)12345678, (unsigned int)3498711,  (unsigned int)19872134,
      (unsigned int)1004141,  (unsigned int)1275987,  (unsigned int)23904273,
      (unsigned int)2091097,  (unsigned int)19872727, (unsigned int)31337,
      (unsigned int)20872837, (unsigned int)1020733};
  return seedbuf[(signed long int)(tid % 11)] + (unsigned int)(node * 31337);
}


x86 assembly (clang, -O0):
<rng_seed_from_tid_nodeid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xed7(%rip),%rsi
mov    $0x2c,%edx
call   1030 <memcpy@plt>
mov    -0x4(%rbp),%eax
mov    $0xb,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
mov    -0x40(%rbp,%rax,4),%eax
imul   $0x7a69,-0x8(%rbp),%ecx
add    %ecx,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rng_seed_from_tid_nodeid>:
movslq %edi,%rax
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,2),%ecx
sub    %ecx,%eax
movslq %eax,%rcx
lea    0xed7(%rip),%rdx
imul   $0x7a69,%esi,%eax
add    (%rdx,%rcx,4),%eax
ret

LLVM IR (-O0):
@__const.rng_seed_from_tid_nodeid.seedbuf = [11 x i32] [i32 12345678, i32 3498711, i32 19872134, i32 1004141, i32 1275987, i32 23904273, i32 2091097, i32 19872727, i32 31337, i32 20872837, i32 1020733]
define i32 @rng_seed_from_tid_nodeid(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [11 x i32]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = bitcast [11 x i32]* %5 to i8*
%7 = load i32, i32* %3
%8 = srem i32 %7, 11
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [11 x i32], [11 x i32]* %5, i64 0, i64 %9
%11 = load i32, i32* %10
%12 = load i32, i32* %4
%13 = mul nsw i32 %12, 31337
%14 = add i32 %11, %13
ret i32 %14
}

LLVM IR (-O2):
@__const.rng_seed_from_tid_nodeid.seedbuf = [11 x i32] [i32 12345678, i32 3498711, i32 19872134, i32 1004141, i32 1275987, i32 23904273, i32 2091097, i32 19872727, i32 31337, i32 20872837, i32 1020733]
define i32 @rng_seed_from_tid_nodeid(i32 %0, i32 %1) {
%3 = srem i32 %0, 11
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds [11 x i32], [11 x i32]* @__const.rng_seed_from_tid_nodeid.seedbuf, i64 0, i64 %4
%6 = load i32, i32* %5
%7 = mul nsw i32 %1, 31337
%8 = add i32 %6, %7
ret i32 %8
}
double dtr(double x) {
  return x * ((3.1415926535897932384626433832795028841971693993751) /
              (double)180.0);
}


x86 assembly (clang, -O0):
<dtr>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @dtr(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 0x3F91DF46A2529D39
ret double %4
}

LLVM IR (-O2):
define double @dtr(double %0) {
%2 = fmul double %0, 0x3F91DF46A2529D39
ret double %2
}
/* Variables and functions */
void *compare_funp_context(void) { return NULL; }


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

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

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

LLVM IR (-O2):
define noalias i8* @compare_funp_context() {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void clearScreen(int numToClear) {
  int ctr = 0;
  for (ctr = 0; ctr < numToClear; ctr++) {
    putchar('\n');
  }
}


x86 assembly (clang, -O0):
<clearScreen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    114d <clearScreen+0x3d>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <clearScreen+0x19>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearScreen>:
push   %rbx
test   %edi,%edi
jle    112f <clearScreen+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <clearScreen+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @clearScreen(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 @putchar(i8 signext 10)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ emit(unsigned int);
void emitI32(unsigned int val) {
  emit(val << 24 >> 24);
  emit(val << 16 >> 24);
  emit(val << 8 >> 24);
  emit(val << 0 >> 24);
}


x86 assembly (clang, -O0):
<emitI32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
shl    $0x18,%edi
shr    $0x18,%edi
call   1030 <emit@plt>
mov    -0x4(%rbp),%edi
shl    $0x10,%edi
shr    $0x18,%edi
call   1030 <emit@plt>
mov    -0x4(%rbp),%edi
shl    $0x8,%edi
shr    $0x18,%edi
call   1030 <emit@plt>
mov    -0x4(%rbp),%edi
shl    $0x0,%edi
shr    $0x18,%edi
call   1030 <emit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emitI32>:
push   %rbx
mov    %edi,%ebx
movzbl %bl,%edi
call   1030 <emit@plt>
movzbl %bh,%edi
call   1030 <emit@plt>
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%edi
call   1030 <emit@plt>
shr    $0x18,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <emit@plt>

LLVM IR (-O0):
define void @emitI32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 24
%5 = lshr i32 %4, 24
%6 = call i32 @emit(i32 %5)
%7 = load i32, i32* %2
%8 = shl i32 %7, 16
%9 = lshr i32 %8, 24
%10 = call i32 @emit(i32 %9)
%11 = load i32, i32* %2
%12 = shl i32 %11, 8
%13 = lshr i32 %12, 24
%14 = call i32 @emit(i32 %13)
%15 = load i32, i32* %2
%16 = shl i32 %15, 0
%17 = lshr i32 %16, 24
%18 = call i32 @emit(i32 %17)
ret void
}

LLVM IR (-O2):
define void @emitI32(i32 %0) {
%2 = and i32 %0, 255
%3 = tail call i32 @emit(i32 %2)
%4 = lshr i32 %0, 8
%5 = and i32 %4, 255
%6 = tail call i32 @emit(i32 %5)
%7 = lshr i32 %0, 16
%8 = and i32 %7, 255
%9 = tail call i32 @emit(i32 %8)
%10 = lshr i32 %0, 24
%11 = tail call i32 @emit(i32 %10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void __attribute__((destructor)) _para_dtor(void) {
  printf(
      "%s: Destructor\n",
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/frdeso/fun-with-so/refs/heads/master/bbb.c");
}


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"%s: Destructor\0A\00"
@.str.1 = [133 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/frdeso/fun-with-so/refs/heads/master/bbb.c\00"
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_para_dtor, i8* null }]
define void @_para_dtor() {
%1 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"%s: Destructor\0A\00"
@.str.1 = [133 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/frdeso/fun-with-so/refs/heads/master/bbb.c\00"
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_para_dtor, i8* null }]
define void @_para_dtor() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ strlen(char *);
bool str_is_empty(char *s) {
  if (s != NULL && strlen(s) > 0) {
    return false;
  } else {
    return true;
  }
}


x86 assembly (clang, -O0):
<str_is_empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1146 <str_is_empty+0x36>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jle    1146 <str_is_empty+0x36>
movl   $0x0,-0x4(%rbp)
jmp    114d <str_is_empty+0x3d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_is_empty>:
test   %rdi,%rdi
je     112b <str_is_empty+0x1b>
push   %rax
call   1030 <strlen@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
lea    0x8(%rsp),%rsp
jle    112b <str_is_empty+0x1b>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @str_is_empty(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i64 @strlen(i8* %0)
%5 = icmp sgt i64 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %3, %1
br label %7
7: ; preds = %3, %6
%8 = phi i32 [ 1, %6 ], [ 0, %3 ]
ret i32 %8
}
int func2(void) { return -12345; }


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

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

LLVM IR (-O0):
define i32 @func2() {
ret i32 -12345
}

LLVM IR (-O2):
define i32 @func2() {
ret i32 -12345
}
signed int convert_signed_int_to_signed_int(signed int x) { return x; }


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

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

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

LLVM IR (-O2):
define i32 @convert_signed_int_to_signed_int(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;
typedef int int8_t;

/* Variables and functions */
void GPIO_set(uint8_t pin) {
  ;
  int8_t set1 = pin - 32;
  if (set1 < 0)
    (*((volatile uint32_t *)(0x0020001C))) = (1 << pin);
  else
    (*((volatile uint32_t *)(0x00200020))) = (1 << set1);
}


x86 assembly (clang, -O0):
<GPIO_set>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1132 <GPIO_set+0x32>
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    $0x20001c,%eax
mov    %ecx,(%rax)
jmp    1145 <GPIO_set+0x45>
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    $0x200020,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPIO_set>:
mov    %edi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
cmp    $0x1f,%edi
jg     1116 <GPIO_set+0x16>
mov    %eax,0x20001c
ret
mov    %eax,0x200020
ret

LLVM IR (-O0):
define void @GPIO_set(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sub nsw i32 %4, 32
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* %2
%10 = shl i32 1, %9
store volatile i32 %10, i32* inttoptr (i64 2097180 to i32*)
br label %14
11: ; preds = %1
%12 = load i32, i32* %3
%13 = shl i32 1, %12
store volatile i32 %13, i32* inttoptr (i64 2097184 to i32*)
br label %14
14: ; preds = %11, %8
ret void
}

LLVM IR (-O2):
define void @GPIO_set(i32 %0) {
%2 = icmp slt i32 %0, 32
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = shl nuw i32 1, %0
store volatile i32 %4, i32* inttoptr (i64 2097180 to i32*)
br label %8
5: ; preds = %1
%6 = add nsw i32 %0, -32
%7 = shl nuw i32 1, %6
store volatile i32 %7, i32* inttoptr (i64 2097184 to i32*)
br label %8
8: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("hello world\r");
  return 1;
}


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"hello world\0D\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@.str = [13 x i8] c"hello world\0D\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 1
}
long int Pow(long int X, unsigned int N) {
  unsigned int i;
  long int res = 1;
  for (i = 0; i < N; i++) {
    res *= X;
  }
  return res;
}


x86 assembly (clang, -O0):
<Pow>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x1,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1141 <Pow+0x41>
mov    -0x8(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    111a <Pow+0x1a>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pow>:
test   %esi,%esi
je     1118 <Pow+0x18>
lea    -0x1(%rsi),%eax
mov    %esi,%ecx
and    $0x7,%ecx
cmp    $0x7,%eax
jae    111e <Pow+0x1e>
mov    $0x1,%eax
jmp    1155 <Pow+0x55>
mov    $0x1,%eax
ret
and    $0xfffffff8,%esi
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
imul   %rdi,%rax
imul   %rdi,%rax
imul   %rdi,%rax
imul   %rdi,%rax
imul   %rdi,%rax
imul   %rdi,%rax
imul   %rdi,%rax
imul   %rdi,%rax
add    $0xfffffff8,%esi
jne    1130 <Pow+0x30>
test   %ecx,%ecx
je     1169 <Pow+0x69>
nopl   0x0(%rax)
imul   %rdi,%rax
add    $0xffffffff,%ecx
jne    1160 <Pow+0x60>
ret

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

LLVM IR (-O2):
define i64 @Pow(i64 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %33, label %4
4: ; preds = %2
%5 = add i32 %1, -1
%6 = and i32 %1, 7
%7 = icmp ult i32 %5, 7
br i1 %7, label %23, label %8
8: ; preds = %4
%9 = and i32 %1, -8
br label %10
10: ; preds = %10, %8
%11 = phi i64 [ 1, %8 ], [ %20, %10 ]
%12 = phi i32 [ 0, %8 ], [ %21, %10 ]
%13 = mul nsw i64 %11, %0
%14 = mul nsw i64 %13, %0
%15 = mul nsw i64 %14, %0
%16 = mul nsw i64 %15, %0
%17 = mul nsw i64 %16, %0
%18 = mul nsw i64 %17, %0
%19 = mul nsw i64 %18, %0
%20 = mul nsw i64 %19, %0
%21 = add i32 %12, 8
%22 = icmp eq i32 %21, %9
br i1 %22, label %23, label %10
23: ; preds = %10, %4
%24 = phi i64 [ undef, %4 ], [ %20, %10 ]
%25 = phi i64 [ 1, %4 ], [ %20, %10 ]
%26 = icmp eq i32 %6, 0
br i1 %26, label %33, label %27
27: ; preds = %23, %27
%28 = phi i64 [ %30, %27 ], [ %25, %23 ]
%29 = phi i32 [ %31, %27 ], [ 0, %23 ]
%30 = mul nsw i64 %28, %0
%31 = add i32 %29, 1
%32 = icmp eq i32 %31, %6
br i1 %32, label %33, label %27
33: ; preds = %23, %27, %2
%34 = phi i64 [ 1, %2 ], [ %24, %23 ], [ %30, %27 ]
ret i64 %34
}
/* Variables and functions */
scalar_t__ strlen(char const *);
long str_len_std(const char *s) { return ((long)strlen(s)); }


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

x86 assembly (clang, -O2):
<str_len_std>:
jmp    1030 <strlen@plt>

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

LLVM IR (-O2):
define i64 @str_len_std(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
ret i64 %2
}
unsigned int compute_word_offset(char *start, unsigned int *addr) {
  unsigned int delta_bytes, ret;
  delta_bytes = (unsigned long)addr - (unsigned long)start;
  ret = delta_bytes / (sizeof(unsigned int));
  return ret;
}


x86 assembly (clang, -O0):
<compute_word_offset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shr    $0x2,%rax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_word_offset>:
mov    %rsi,%rax
sub    %edi,%eax
shr    $0x2,%eax
ret

LLVM IR (-O0):
define i32 @compute_word_offset(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
%7 = load i32*, i32** %4
%8 = ptrtoint i32* %7 to i64
%9 = load i8*, i8** %3
%10 = ptrtoint i8* %9 to i64
%11 = sub i64 %8, %10
%12 = trunc i64 %11 to i32
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = zext i32 %13 to i64
%15 = udiv i64 %14, 4
%16 = trunc i64 %15 to i32
store i32 %16, i32* %6
%17 = load i32, i32* %6
ret i32 %17
}

LLVM IR (-O2):
define i32 @compute_word_offset(i8* %0, i32* %1) {
%3 = ptrtoint i32* %1 to i64
%4 = ptrtoint i8* %0 to i64
%5 = sub i64 %3, %4
%6 = trunc i64 %5 to i32
%7 = lshr i32 %6, 2
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ ispunct(int);
void t_ispunct_0xdd() {
  Assert_real((ispunct(221) == 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_ispunct.c",
              1110, ("ispunct should be 0 for 0xdd"));
}


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

x86 assembly (clang, -O2):
<t_ispunct_0xdd>:
push   %rax
mov    $0xdd,%edi
call   1030 <ispunct@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x456,%edx
pop    %rax
jmp    1040 <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_ispunct.c\00"
@.str.1 = [29 x i8] c"ispunct should be 0 for 0xdd\00"
define void @t_ispunct_0xdd() {
%1 = call i64 @ispunct(i32 221)
%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 1110, 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_ispunct.c\00"
@.str.1 = [29 x i8] c"ispunct should be 0 for 0xdd\00"
define void @t_ispunct_0xdd() {
%1 = tail call i64 @ispunct(i32 221)
%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 1110, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int EOF;
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("The value of EOF is '%d'\n", EOF);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [26 x i8] c"The value of EOF is '%d'\0A\00"
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @EOF
%3 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"The value of EOF is '%d'\0A\00"
@EOF = global i32 0
define i32 @main() {
%1 = load i32, i32* @EOF
%2 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ _s2priv_ss2pt(unsigned int, int);
void ss2pt(unsigned int itextureID) { _s2priv_ss2pt(itextureID, 1); }


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

x86 assembly (clang, -O2):
<ss2pt>:
mov    $0x1,%esi
jmp    1030 <_s2priv_ss2pt@plt>

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

LLVM IR (-O2):
define void @ss2pt(i32 %0) {
%2 = tail call i32 @_s2priv_ss2pt(i32 %0, i32 1)
ret void
}
float lerp(float t, float a, float b) { return a + t * (b - a); }


x86 assembly (clang, -O0):
<lerp>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
subss  -0x8(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<lerp>:
subss  %xmm1,%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @lerp(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %5
%8 = load float, float* %4
%9 = load float, float* %6
%10 = load float, float* %5
%11 = fsub float %9, %10
%12 = call float @llvm.fmuladd.f32(float %8, float %11, float %7)
ret float %12
}

LLVM IR (-O2):
define float @lerp(float %0, float %1, float %2) {
%4 = fsub float %2, %1
%5 = tail call float @llvm.fmuladd.f32(float %0, float %4, float %1)
ret float %5
}
int test_imm_D7uint8_reg(unsigned char val) {
  return ((val) & (0xD7 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_D7uint8_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, 215
%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_D7uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -41
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct sockaddr {
  int dummy;
};

/* Variables and functions */
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ unix_error(char *);
void csapp_bind(int sockfd, struct sockaddr *my_addr, int addrlen) {
  int rc;
  if ((rc = bind(sockfd, my_addr, addrlen)) < 0)
    unix_error("bind error");
}


x86 assembly (clang, -O0):
<csapp_bind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <bind@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    1159 <csapp_bind+0x39>
lea    0xeac(%rip),%rdi
call   1030 <unix_error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csapp_bind>:
push   %rax
call   1040 <bind@plt>
test   %eax,%eax
js     112c <csapp_bind+0xc>
pop    %rax
ret
lea    0xecd(%rip),%rdi
pop    %rax
jmp    1030 <unix_error@plt>

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
@.str = [11 x i8] c"bind error\00"
define void @csapp_bind(i32 %0, %struct.sockaddr* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.sockaddr*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store %struct.sockaddr* %1, %struct.sockaddr** %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = load %struct.sockaddr*, %struct.sockaddr** %5
%10 = load i32, i32* %6
%11 = call i32 @bind(i32 %8, %struct.sockaddr* %9, i32 %10)
store i32 %11, i32* %7
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = call i32 @unix_error(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %3
ret void
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@.str = [11 x i8] c"bind error\00"
define void @csapp_bind(i32 %0, %struct.sockaddr* %1, i32 %2) {
%4 = tail call i32 @bind(i32 %0, %struct.sockaddr* %1, i32 %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @unix_error(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret void
}
void gtk_font_selection_get_type() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/ *, char const *,
                            int /*<<< orphan*/);
void vlog_out(FILE *file, const char *format, va_list args) {
  vfprintf(file, format, args);
  fflush(file);
}


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

x86 assembly (clang, -O2):
<vlog_out>:
push   %rbx
mov    %rdi,%rbx
call   1040 <vfprintf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fflush@plt>

LLVM IR (-O0):
define void @vlog_out(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @vfprintf(i32* %7, i8* %8, i32 %9)
%11 = load i32*, i32** %4
%12 = call i32 @fflush(i32* %11)
ret void
}

LLVM IR (-O2):
define void @vlog_out(i32* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @vfprintf(i32* %0, i8* %1, i32 %2)
%5 = tail call i32 @fflush(i32* %0)
ret void
}
__attribute__((no, noclone)) void fn3(const char *x) {
  if (x[0] != 0)
    __builtin_abort();
}


x86 assembly (clang, -O0):
<fn3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1131 <fn3+0x21>
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn3>:
push   %rax
cmpb   $0x0,(%rdi)
jne    1118 <fn3+0x8>
pop    %rax
ret
call   1030 <abort@plt>

LLVM IR (-O0):
define void @fn3(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
unreachable
9: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @fn3(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %5, label %4
4: ; preds = %1
tail call void @abort()
unreachable
5: ; preds = %1
ret void
}
int foo(char *n) { return 42; }


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

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

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

LLVM IR (-O2):
define i32 @foo(i8* nocapture readnone %0) {
ret i32 42
}
/* Variables and functions */
int _tigermain(int /*<<< orphan*/);
int main() {
  int i;
  return _tigermain(0);
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @_tigermain(i32 0)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ *scout_pchar(char const *);
const char *scout_path_empty(const char *c) {
  return (scout_pchar(c) == NULL) ? c : NULL;
}


x86 assembly (clang, -O0):
<scout_path_empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <scout_pchar@plt>
cmp    $0x0,%rax
jne    113c <scout_path_empty+0x2c>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1147 <scout_path_empty+0x37>
xor    %eax,%eax
mov    %rax,-0x10(%rbp)
jmp    1147 <scout_path_empty+0x37>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scout_path_empty>:
push   %rbx
mov    %rdi,%rbx
call   1030 <scout_pchar@plt>
xor    %ecx,%ecx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @scout_path_empty(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32* @scout_pchar(i8* %3)
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i8*, i8** %2
br label %9
8: ; preds = %1
br label %9
9: ; preds = %8, %6
%10 = phi i8* [ %7, %6 ], [ null, %8 ]
ret i8* %10
}

LLVM IR (-O2):
define i8* @scout_path_empty(i8* %0) {
%2 = tail call i32* @scout_pchar(i8* %0)
%3 = icmp eq i32* %2, null
%4 = select i1 %3, i8* %0, i8* null
ret i8* %4
}
/* Variables and functions */
float cblas_sdsdot(int const, float const, float const *, int const,
                   float const *, int const);
float c_sdsdot(const int N, const float scalar, const float *X,
               const int strideX, const float *Y, const int strideY) {
  return cblas_sdsdot(N, scalar, X, strideX, Y, strideY);
}


x86 assembly (clang, -O0):
<c_sdsdot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x4(%rbp),%edi
movss  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
call   1030 <cblas_sdsdot@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_sdsdot>:
jmp    1030 <cblas_sdsdot@plt>

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

LLVM IR (-O2):
define float @c_sdsdot(i32 %0, float %1, float* %2, i32 %3, float* %4, i32 %5) {
%7 = tail call float @cblas_sdsdot(i32 %0, float %1, float* %2, i32 %3, float* %4, i32 %5)
ret float %7
}
int foo(int x, int b) {
  int cst;
  if (b)
    cst = -0x7fffffff - 1;
  else
    cst = -0x7fffffff;
  x = x | cst;
  if (x >= 0)
    return 12345;
  return x;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1120 <foo+0x20>
movl   $0x80000000,-0x10(%rbp)
jmp    1127 <foo+0x27>
movl   $0x80000001,-0x10(%rbp)
mov    -0x8(%rbp),%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1146 <foo+0x46>
movl   $0x3039,-0x4(%rbp)
jmp    114c <foo+0x4c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
xor    %eax,%eax
test   %esi,%esi
sete   %al
or     %edi,%eax
or     $0x80000000,%eax
ret

LLVM IR (-O0):
define i32 @foo(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 -2147483648, i32* %6
br label %11
10: ; preds = %2
store i32 -2147483647, i32* %6
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %4
%13 = load i32, i32* %6
%14 = or i32 %12, %13
store i32 %14, i32* %4
%15 = load i32, i32* %4
%16 = icmp sge i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %11
store i32 12345, i32* %3
br label %20
18: ; preds = %11
%19 = load i32, i32* %4
store i32 %19, i32* %3
br label %20
20: ; preds = %18, %17
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = select i1 %3, i32 -2147483647, i32 -2147483648
%5 = or i32 %4, %0
ret i32 %5
}
/* Type definitions */
struct flashctx {
  int dummy;
};

/* Variables and functions */
int printlock_regspace2_uniform(struct flashctx *, int);
int printlock_regspace2_uniform_64k(struct flashctx *flash) {
  return printlock_regspace2_uniform(flash, 64 * 1024);
}


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

x86 assembly (clang, -O2):
<printlock_regspace2_uniform_64k>:
mov    $0x10000,%esi
jmp    1030 <printlock_regspace2_uniform@plt>

LLVM IR (-O0):
%struct.flashctx = type { i32 }
define i32 @printlock_regspace2_uniform_64k(%struct.flashctx* %0) {
%2 = alloca %struct.flashctx*
store %struct.flashctx* %0, %struct.flashctx** %2
%3 = load %struct.flashctx*, %struct.flashctx** %2
%4 = call i32 @printlock_regspace2_uniform(%struct.flashctx* %3, i32 65536)
ret i32 %4
}

LLVM IR (-O2):
%struct.flashctx = type { i32 }
define i32 @printlock_regspace2_uniform_64k(%struct.flashctx* %0) {
%2 = tail call i32 @printlock_regspace2_uniform(%struct.flashctx* %0, i32 65536)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
void uint_put(unsigned int number, FILE *stream) {
  if (number > (unsigned int)9) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
    uint_put(number / (unsigned int)10, stream);
#pragma GCC diagnostic pop
  }
  fputc('0' + (char)(number % (unsigned int)10), stream);
}


x86 assembly (clang, -O0):
<uint_put>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x9,-0x4(%rbp)
jbe    1150 <uint_put+0x30>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1030 <uint_put@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %dl,%al
movsbl %al,%eax
add    $0x30,%eax
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uint_put>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
mov    %edi,%ebx
cmp    $0xa,%edi
jb     1145 <uint_put+0x25>
mov    $0xcccccccd,%edi
imul   %rbx,%rdi
shr    $0x23,%rdi
mov    %r14,%rsi
call   1030 <uint_put@plt>
mov    $0xcccccccd,%eax
imul   %rbx,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebp
or     $0x30,%bpl
movzbl %bpl,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <fputc@plt>

LLVM IR (-O0):
define void @uint_put(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 = icmp ugt i32 %5, 9
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i32, i32* %3
%9 = udiv i32 %8, 10
%10 = load i32*, i32** %4
br label %11
11: ; preds = %7, %2
%12 = load i32, i32* %3
%13 = urem i32 %12, 10
%14 = trunc i32 %13 to i8
%15 = sext i8 %14 to i32
%16 = add nsw i32 48, %15
%17 = trunc i32 %16 to i8
%18 = load i32*, i32** %4
%19 = call i32 @fputc(i8 signext %17, i32* %18)
ret void
}

LLVM IR (-O2):
define void @uint_put(i32 %0, i32* nocapture %1) {
%3 = icmp ugt i32 %0, 9
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = udiv i32 %0, 10
tail call void @uint_put(i32 %5, i32* %1)
br label %6
6: ; preds = %4, %2
%7 = urem i32 %0, 10
%8 = trunc i32 %7 to i8
%9 = or i8 %8, 48
%10 = tail call i32 @fputc(i8 signext %9, i32* %1)
ret void
}
void cc_fips_fini(struct cc_drvdata *drvdata) {}


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

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

LLVM IR (-O0):
%struct.cc_drvdata = type opaque
define void @cc_fips_fini(%struct.cc_drvdata* %0) {
%2 = alloca %struct.cc_drvdata*
store %struct.cc_drvdata* %0, %struct.cc_drvdata** %2
ret void
}

LLVM IR (-O2):
%struct.cc_drvdata = type opaque
define void @cc_fips_fini(%struct.cc_drvdata* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ consumer_destroy();
int /*<<< orphan*/ q_destroy();
void dsp_shutdown() {
  consumer_destroy();
  q_destroy();
}


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

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

LLVM IR (-O0):
define void @dsp_shutdown() {
%1 = call i32 (...) @consumer_destroy()
%2 = call i32 (...) @q_destroy()
ret void
}

LLVM IR (-O2):
define void @dsp_shutdown() {
%1 = tail call i32 (...) @consumer_destroy()
%2 = tail call i32 (...) @q_destroy()
ret void
}