xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
void readPersnr(char *person) { fgets(person, 11, stdin); }


x86 assembly (clang, -O0):
<readPersnr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%edx
mov    $0xb,%esi
call   1030 <fgets@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readPersnr>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edx
mov    $0xb,%esi
jmp    1030 <fgets@plt>

LLVM IR (-O0):
@stdin = global i32 0
define void @readPersnr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %3, i32 11, i32 %4)
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
define void @readPersnr(i8* %0) {
%2 = load i32, i32* @stdin
%3 = tail call i32 @fgets(i8* %0, i32 11, i32 %2)
ret void
}
int f_ble_rr2(float a1, float a2) { return !(__builtin_islessequal(a1, a2)); }


x86 assembly (clang, -O0):
<f_ble_rr2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
setae  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_ble_rr2>:
xor    %eax,%eax
ucomiss %xmm0,%xmm1
setb   %al
ret

LLVM IR (-O0):
define i32 @f_ble_rr2(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp ole float %5, %6
%8 = xor i1 %7, true
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @f_ble_rr2(float %0, float %1) {
%3 = fcmp ugt float %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
int key_avail() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @key_avail() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ subsystem_power(int, int /*<<< orphan*/);
void io_config_clk_off(void) { subsystem_power((1 << 16), 0); }


x86 assembly (clang, -O0):
<io_config_clk_off>:
push   %rbp
mov    %rsp,%rbp
mov    $0x10000,%edi
xor    %esi,%esi
call   1030 <subsystem_power@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_config_clk_off>:
mov    $0x10000,%edi
xor    %esi,%esi
jmp    1030 <subsystem_power@plt>

LLVM IR (-O0):
define void @io_config_clk_off() {
%1 = call i32 @subsystem_power(i32 65536, i32 0)
ret void
}

LLVM IR (-O2):
define void @io_config_clk_off() {
%1 = tail call i32 @subsystem_power(i32 65536, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_subsets_aux(char *, int /*<<< orphan*/, size_t, int *,
                                     int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *);
void print_subsets(size_t n, int set[n]) {
  char buff[n * 4 + 5];
  print_subsets_aux(buff, sprintf(buff, "{ "), n, set, 0);
}


x86 assembly (clang, -O0):
<print_subsets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
lea    0x5(,%rcx,4),%rax
mov    %rsp,%rdx
mov    %rdx,-0x18(%rbp)
lea    0x14(,%rcx,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x28(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x20(%rbp)
lea    0xe99(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
xor    %r8d,%r8d
call   1030 <print_subsets_aux@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_subsets>:
push   %rbp
mov    %rsp,%rbp
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    %rsp,%rax
lea    0x14(,%rdi,4),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rax,%rdi
sub    %rsi,%rdi
mov    %rdi,%rsp
neg    %rsi
movw   $0x207b,(%rax,%rsi,1)
movb   $0x0,0x2(%rdi)
mov    $0x2,%esi
xor    %r8d,%r8d
call   1030 <print_subsets_aux@plt>
mov    %rbp,%rsp
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"{ \00"
define void @print_subsets(i64 %0, i32* %1) {
%3 = alloca i64
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i64
store i64 %0, i64* %3
store i32* %1, i32** %4
%7 = load i64, i64* %3
%8 = load i64, i64* %3
%9 = mul i64 %8, 4
%10 = add i64 %9, 5
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %5
%12 = alloca i8, i64 %10
store i64 %10, i64* %6
%13 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%14 = load i64, i64* %3
%15 = load i32*, i32** %4
%16 = call i32 @print_subsets_aux(i8* %12, i32 %13, i64 %14, i32* %15, i32 0)
%17 = load i8*, i8** %5
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"{ \00"
define void @print_subsets(i64 %0, i32* %1) {
%3 = shl i64 %0, 2
%4 = add i64 %3, 5
%5 = alloca i8, i64 %4
%6 = call i32 @print_subsets_aux(i8* %5, i32 2, i64 %0, i32* %1, i32 0)
ret void
}
void INT_TM07(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_TM07() {
ret void
}
int __attribute__((weak)) sigprocmask() { return -1; }


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

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

LLVM IR (-O0):
define weak i32 @sigprocmask() {
ret i32 -1
}

LLVM IR (-O2):
define weak i32 @sigprocmask() {
ret i32 -1
}
float ne_float(float a, float b) { return a != b; }


x86 assembly (clang, -O0):
<ne_float>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%eax
cvtsi2ss %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ne_float>:
cmpneqss %xmm1,%xmm0
movss  0xef3(%rip),%xmm1
andps  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @ne_float(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp une float %5, %6
%8 = zext i1 %7 to i32
%9 = sitofp i32 %8 to float
ret float %9
}

LLVM IR (-O2):
define float @ne_float(float %0, float %1) {
%3 = fcmp une float %0, %1
%4 = uitofp i1 %3 to float
ret float %4
}
void write_trap(void *addr, void *oldPC, unsigned long oldTid, void *newPC,
                unsigned long newTid) {}


x86 assembly (clang, -O0):
<write_trap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @write_trap(i8* %0, i8* %1, i64 %2, i8* %3, i64 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i64
store i8* %0, i8** %6
store i8* %1, i8** %7
store i64 %2, i64* %8
store i8* %3, i8** %9
store i64 %4, i64* %10
ret void
}

LLVM IR (-O2):
define void @write_trap(i8* nocapture %0, i8* nocapture %1, i64 %2, i8* nocapture %3, i64 %4) {
ret void
}
int Compare_doubles(const void *arg1, const void *arg2) {
  if (*(double *)arg1 < *(double *)arg2)
    return (-1);
  else
    return (1);
}


x86 assembly (clang, -O0):
<Compare_doubles>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1132 <Compare_doubles+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    1139 <Compare_doubles+0x39>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Compare_doubles>:
movsd  (%rsi),%xmm0
xor    %eax,%eax
ucomisd (%rdi),%xmm0
setbe  %al
add    %eax,%eax
add    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @Compare_doubles(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = bitcast i8* %6 to double*
%8 = load double, double* %7
%9 = load i8*, i8** %5
%10 = bitcast i8* %9 to double*
%11 = load double, double* %10
%12 = fcmp olt double %8, %11
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 -1, i32* %3
br label %15
14: ; preds = %2
store i32 1, i32* %3
br label %15
15: ; preds = %14, %13
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @Compare_doubles(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fcmp olt double %4, %6
%8 = select i1 %7, i32 -1, i32 1
ret i32 %8
}
int test_imm_1Fint8_reg(signed char val) {
  return ((val) & (-0x1F << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_1Fint8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, -31
%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_1Fint8_reg(i8 signext %0) {
%2 = and i8 %0, -31
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
const char *Parrot_dlerror(void) { return "Parrot_dlerror not implemented"; }


x86 assembly (clang, -O0):
<Parrot_dlerror>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Parrot_dlerror>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Parrot_dlerror not implemented\00"
define i8* @Parrot_dlerror() {
ret i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [31 x i8] c"Parrot_dlerror not implemented\00"
define i8* @Parrot_dlerror() {
ret i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
struct ansiseq {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ screen_go(int /*<<< orphan*/, int);
void termop_curup(struct ansiseq *s) { screen_go(0, -1); }


x86 assembly (clang, -O0):
<termop_curup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
mov    $0xffffffff,%esi
call   1030 <screen_go@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<termop_curup>:
xor    %edi,%edi
mov    $0xffffffff,%esi
jmp    1030 <screen_go@plt>

LLVM IR (-O0):
%struct.ansiseq = type { i32 }
define void @termop_curup(%struct.ansiseq* %0) {
%2 = alloca %struct.ansiseq*
store %struct.ansiseq* %0, %struct.ansiseq** %2
%3 = call i32 @screen_go(i32 0, i32 -1)
ret void
}

LLVM IR (-O2):
%struct.ansiseq = type { i32 }
define void @termop_curup(%struct.ansiseq* nocapture readnone %0) {
%2 = tail call i32 @screen_go(i32 0, i32 -1)
ret void
}
/* Type definitions */
struct io_file {
  int dummy;
};

/* Variables and functions */
int io_out(struct io_file *, int, unsigned char *, int);
int io_out_i2(struct io_file *f, int pos, short int o) {
  unsigned char x[2];
  x[0] = o >> 8;
  x[1] = o;
  return io_out(f, pos, x, sizeof x);
}


x86 assembly (clang, -O0):
<io_out_i2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dx,%ax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %ax,-0xe(%rbp)
movswl -0xe(%rbp),%eax
sar    $0x8,%eax
mov    %al,-0x10(%rbp)
mov    -0xe(%rbp),%ax
mov    %al,-0xf(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x10(%rbp),%rdx
mov    $0x2,%ecx
call   1030 <io_out@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_out_i2>:
push   %rax
rol    $0x8,%dx
mov    %dx,0x6(%rsp)
lea    0x6(%rsp),%rdx
mov    $0x2,%ecx
call   1030 <io_out@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.io_file = type { i32 }
define i32 @io_out_i2(%struct.io_file* %0, i32 %1, i16 signext %2) {
%4 = alloca %struct.io_file*
%5 = alloca i32
%6 = alloca i16
%7 = alloca [2 x i8]
store %struct.io_file* %0, %struct.io_file** %4
store i32 %1, i32* %5
store i16 %2, i16* %6
%8 = load i16, i16* %6
%9 = sext i16 %8 to i32
%10 = ashr i32 %9, 8
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
store i8 %11, i8* %12
%13 = load i16, i16* %6
%14 = trunc i16 %13 to i8
%15 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 1
store i8 %14, i8* %15
%16 = load %struct.io_file*, %struct.io_file** %4
%17 = load i32, i32* %5
%18 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%19 = call i32 @io_out(%struct.io_file* %16, i32 %17, i8* %18, i32 2)
ret i32 %19
}

LLVM IR (-O2):
%struct.io_file = type { i32 }
define i32 @io_out_i2(%struct.io_file* %0, i32 %1, i16 signext %2) {
%4 = alloca [2 x i8]
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%6 = lshr i16 %2, 8
%7 = trunc i16 %6 to i8
store i8 %7, i8* %5
%8 = trunc i16 %2 to i8
%9 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 1
store i8 %8, i8* %9
%10 = call i32 @io_out(%struct.io_file* %0, i32 %1, i8* %5, i32 2)
ret i32 %10
}
void what_date() { return; }


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

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

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

LLVM IR (-O2):
define void @what_date() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ group_sum(char);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  char delimiter = {0};
  if (argc != 2) {
    fprintf(stderr, "Usage: %s delimiter\n", argv[0]);
    exit(1);
  }
  delimiter = *argv[1];
  group_sum(delimiter);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     117a <main+0x4a>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe95(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%edi
call   1030 <group_sum@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1146 <main+0x16>
mov    0x8(%rsi),%rax
movsbl (%rax),%edi
call   1030 <group_sum@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xea7(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"Usage: %s delimiter\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 0, i8* %6
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %16
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = load i8, i8* %19
store i8 %20, i8* %6
%21 = load i8, i8* %6
%22 = call i32 @group_sum(i8 signext %21)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"Usage: %s delimiter\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = tail call i32 @group_sum(i8 signext %12)
ret i32 0
}
void func() {
  return;
  int i = 0;
}


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

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

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

LLVM IR (-O2):
define void @func() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memory_new(void **, int, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, int, char *);
void memory_new_detail(void **p, int size, char *file, char *function, int line,
                       char *name) {
  char temp[128];
  sprintf(temp, "[%s]%s(%d) %s", file, function, line, name);
  memory_new(p, size, temp);
}


x86 assembly (clang, -O0):
<memory_new_detail>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
lea    -0xb0(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x30(%rbp),%r9
lea    0xea0(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0xb0(%rbp),%rdx
call   1030 <memory_new@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memory_new_detail>:
push   %rbp
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xec9(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   1030 <memory_new@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"[%s]%s(%d) %s\00"
define void @memory_new_detail(i8** %0, i32 %1, i8* %2, i8* %3, i32 %4, i8* %5) {
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca [128 x i8]
store i8** %0, i8*** %7
store i32 %1, i32* %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i32 %4, i32* %11
store i8* %5, i8** %12
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%15 = load i8*, i8** %9
%16 = load i8*, i8** %10
%17 = load i32, i32* %11
%18 = load i8*, i8** %12
%19 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %16, i32 %17, i8* %18)
%20 = load i8**, i8*** %7
%21 = load i32, i32* %8
%22 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%23 = call i32 @memory_new(i8** %20, i32 %21, i8* %22)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"[%s]%s(%d) %s\00"
define void @memory_new_detail(i8** %0, i32 %1, i8* %2, i8* %3, i32 %4, i8* %5) {
%7 = alloca [128 x i8]
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%9 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %3, i32 %4, i8* %5)
%10 = call i32 @memory_new(i8** %0, i32 %1, i8* %8)
ret void
}
/* Variables and functions */
scalar_t__ strlen(char const *);
int strlen_(const char *s) { return ((int)strlen(s)); }


x86 assembly (clang, -O0):
<strlen_>:
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):
<strlen_>:
jmp    1030 <strlen@plt>

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

LLVM IR (-O2):
define i32 @strlen_(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Variables and functions */
int atoi(char *);
long atol(char *);
long long atoll(char *);
int /*<<< orphan*/ scanf(char *, char *);
void atoiTest() {
  char s[80];
  scanf("%s", s);
  int d = atoi(s);
  int td = d;
  long l = atol(s);
  int tl = l;
  long long ll = atoll(s);
  int tll = ll;
}


x86 assembly (clang, -O0):
<atoiTest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x50(%rbp),%rsi
lea    0xeaa(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x50(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%eax
mov    %eax,-0x58(%rbp)
lea    -0x50(%rbp),%rdi
call   1050 <atol@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
mov    %eax,-0x64(%rbp)
lea    -0x50(%rbp),%rdi
call   1030 <atoll@plt>
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rax
mov    %eax,-0x74(%rbp)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atoiTest>:
sub    $0x58,%rsp
lea    0xee5(%rip),%rdi
mov    %rsp,%rsi
call   1030 <scanf@plt>
add    $0x58,%rsp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @atoiTest() {
%1 = alloca [80 x i8]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca i32
%6 = alloca i64
%7 = alloca i32
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%11 = call i32 @atoi(i8* %10)
store i32 %11, i32* %2
%12 = load i32, i32* %2
store i32 %12, i32* %3
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%14 = call i64 @atol(i8* %13)
store i64 %14, i64* %4
%15 = load i64, i64* %4
%16 = trunc i64 %15 to i32
store i32 %16, i32* %5
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%18 = call i64 @atoll(i8* %17)
store i64 %18, i64* %6
%19 = load i64, i64* %6
%20 = trunc i64 %19 to i32
store i32 %20, i32* %7
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @atoiTest() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
ret void
}
int prestupny(int y) {
  int foo = 0;
  if (y % 4 == 0)
    foo = 1;
  if (y % 100 == 0)
    foo = 0;
  if (y % 400 == 0)
    foo = 1;
  if (y % 4000 == 0)
    foo = 0;
  return foo;
}


x86 assembly (clang, -O0):
<prestupny>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1129 <prestupny+0x29>
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1144 <prestupny+0x44>
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    115f <prestupny+0x5f>
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xfa0,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    117a <prestupny+0x7a>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<prestupny>:
test   $0x3,%dil
sete   %al
imul   $0xc28f5c29,%edi,%ecx
add    $0x51eb850,%ecx
mov    %ecx,%edx
ror    $0x2,%edx
cmp    $0x28f5c29,%edx
setae  %dl
ror    $0x4,%ecx
and    %al,%dl
cmp    $0xa3d70b,%ecx
setb   %al
or     %dl,%al
imul   $0x26e978d5,%edi,%ecx
add    $0x10624c0,%ecx
ror    $0x5,%ecx
cmp    $0x10624d,%ecx
setae  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @prestupny(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = srem i32 %4, 4
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %3
br label %8
8: ; preds = %7, %1
%9 = load i32, i32* %2
%10 = srem i32 %9, 100
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 0, i32* %3
br label %13
13: ; preds = %12, %8
%14 = load i32, i32* %2
%15 = srem i32 %14, 400
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 1, i32* %3
br label %18
18: ; preds = %17, %13
%19 = load i32, i32* %2
%20 = srem i32 %19, 4000
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 0, i32* %3
br label %23
23: ; preds = %22, %18
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @prestupny(i32 %0) {
%2 = and i32 %0, 3
%3 = icmp eq i32 %2, 0
%4 = srem i32 %0, 100
%5 = icmp ne i32 %4, 0
%6 = and i1 %5, %3
%7 = srem i32 %0, 400
%8 = icmp eq i32 %7, 0
%9 = or i1 %8, %6
%10 = srem i32 %0, 4000
%11 = icmp ne i32 %10, 0
%12 = and i1 %11, %9
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Variables and functions */
double exp(double);
double diff(double x) { return (exp(x) - 2); }


x86 assembly (clang, -O0):
<diff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
movsd  0xed1(%rip),%xmm1
subsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<diff>:
push   %rax
call   1030 <exp@plt>
addsd  0xee2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @diff(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @exp(double %3)
%5 = fsub double %4, 2.000000e+00
ret double %5
}

LLVM IR (-O2):
define double @diff(double %0) {
%2 = tail call double @exp(double %0)
%3 = fadd double %2, -2.000000e+00
ret double %3
}
int setbits(unsigned x, int p, int n, unsigned y) {
  return x & ((~0 << (p + 1) | ~(~0 << (p - n + 1))) |
              ((~(~0 << n) & y) << (p - n + 1)));
}


x86 assembly (clang, -O0):
<setbits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
mov    $0xffffffff,%edx
shl    %cl,%edx
mov    %edx,-0x18(%rbp)
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
add    $0x1,%ecx
mov    $0xffffffff,%edx
shl    %cl,%edx
mov    -0x18(%rbp),%ecx
xor    $0xffffffff,%edx
or     %edx,%ecx
mov    %ecx,-0x14(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0xffffffff,%edx
shl    %cl,%edx
xor    $0xffffffff,%edx
and    -0x10(%rbp),%edx
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
add    $0x1,%ecx
shl    %cl,%edx
mov    -0x14(%rbp),%ecx
or     %edx,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<setbits>:
mov    %ecx,%r8d
lea    0x1(%rsi),%ecx
mov    $0xffffffff,%r9d
shl    %cl,%r9d
mov    $0xffffffff,%eax
sub    %edx,%esi
lea    0x1(%rsi),%r10d
mov    $0xffffffff,%esi
mov    %r10d,%ecx
shl    %cl,%esi
mov    %edx,%ecx
shl    %cl,%eax
not    %eax
and    %r8d,%eax
mov    %r10d,%ecx
shl    %cl,%eax
not    %esi
or     %r9d,%esi
or     %esi,%eax
and    %edi,%eax
ret

LLVM IR (-O0):
define i32 @setbits(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = add nsw i32 %10, 1
%12 = shl i32 -1, %11
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = sub nsw i32 %13, %14
%16 = add nsw i32 %15, 1
%17 = shl i32 -1, %16
%18 = xor i32 %17, -1
%19 = or i32 %12, %18
%20 = load i32, i32* %7
%21 = shl i32 -1, %20
%22 = xor i32 %21, -1
%23 = load i32, i32* %8
%24 = and i32 %22, %23
%25 = load i32, i32* %6
%26 = load i32, i32* %7
%27 = sub nsw i32 %25, %26
%28 = add nsw i32 %27, 1
%29 = shl i32 %24, %28
%30 = or i32 %19, %29
%31 = and i32 %9, %30
ret i32 %31
}

LLVM IR (-O2):
define i32 @setbits(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = add nsw i32 %1, 1
%6 = shl nsw i32 -1, %5
%7 = sub nsw i32 %1, %2
%8 = add nsw i32 %7, 1
%9 = shl nsw i32 -1, %8
%10 = xor i32 %9, -1
%11 = or i32 %6, %10
%12 = shl nsw i32 -1, %2
%13 = xor i32 %12, -1
%14 = and i32 %13, %3
%15 = shl i32 %14, %8
%16 = or i32 %11, %15
%17 = and i32 %16, %0
ret i32 %17
}
void gen_epilogue(void) {}


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

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

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

LLVM IR (-O2):
define void @gen_epilogue() {
ret void
}
/* Variables and functions */
void usb_ep0_stall();
void usb_ep0_standard_interface_rx() { return usb_ep0_stall(); }


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

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

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

LLVM IR (-O2):
define void @usb_ep0_standard_interface_rx() {
tail call void (...) @usb_ep0_stall()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ printf(char *, int);
int pthread_self();
void thread_exit_handler(int sock) {
  printf("thread %u exit\n", pthread_self());
  close(sock);
}


x86 assembly (clang, -O0):
<thread_exit_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1050 <pthread_self@plt>
mov    %eax,%esi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_exit_handler>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1050 <pthread_self@plt>
lea    0xebf(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <close@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"thread %u exit\0A\00"
define void @thread_exit_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @pthread_self()
%4 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @close(i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"thread %u exit\0A\00"
define void @thread_exit_handler(i32 %0) {
%2 = tail call i32 (...) @pthread_self()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @close(i32 %0)
ret void
}
/* Type definitions */
struct nxtd_nxt_bt {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
ssize_t nxtd_bt_send(struct nxtd_nxt_bt *nxt, const void *data, size_t size) {
  return 0;
}


x86 assembly (clang, -O0):
<nxtd_bt_send>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.nxtd_nxt_bt = type { i32 }
define i32 @nxtd_bt_send(%struct.nxtd_nxt_bt* %0, i8* %1, i64 %2) {
%4 = alloca %struct.nxtd_nxt_bt*
%5 = alloca i8*
%6 = alloca i64
store %struct.nxtd_nxt_bt* %0, %struct.nxtd_nxt_bt** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
ret i32 0
}

LLVM IR (-O2):
%struct.nxtd_nxt_bt = type { i32 }
define i32 @nxtd_bt_send(%struct.nxtd_nxt_bt* nocapture readnone %0, i8* nocapture readnone %1, i64 %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ time1_test();
int /*<<< orphan*/ time2_test();
int /*<<< orphan*/ time3_test();
int main() {
  time1_test();
  time2_test();
  time3_test();
  time1_test();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @time1_test()
%3 = call i32 (...) @time2_test()
%4 = call i32 (...) @time3_test()
%5 = call i32 (...) @time1_test()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @time1_test()
%2 = tail call i32 (...) @time2_test()
%3 = tail call i32 (...) @time3_test()
%4 = tail call i32 (...) @time1_test()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ GyroStateHandle();
int /*<<< orphan*/ UAVObjRequestUpdate(int /*<<< orphan*/);
void GyroStateRequestUpdate() { UAVObjRequestUpdate(GyroStateHandle()); }


x86 assembly (clang, -O0):
<GyroStateRequestUpdate>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <GyroStateHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjRequestUpdate@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<GyroStateRequestUpdate>:
push   %rax
xor    %eax,%eax
call   1030 <GyroStateHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjRequestUpdate@plt>

LLVM IR (-O0):
define void @GyroStateRequestUpdate() {
%1 = call i32 (...) @GyroStateHandle()
%2 = call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}

LLVM IR (-O2):
define void @GyroStateRequestUpdate() {
%1 = tail call i32 (...) @GyroStateHandle()
%2 = tail call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "usage: sudo beastdump <path_to_gigabeat>\ne.g. /dev/sdb \n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [57 x i8] c"usage: sudo beastdump <path_to_gigabeat>\0Ae.g. /dev/sdb \0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [57 x i8] c"usage: sudo beastdump <path_to_gigabeat>\0Ae.g. /dev/sdb \0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int *malloc(int);
void mallocFailedOrNot() {
  int *p = malloc(12);
  if (!p)
    free(p);
  else
    free(p);
}


x86 assembly (clang, -O0):
<mallocFailedOrNot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xc,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    114f <mallocFailedOrNot+0x2f>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
jmp    1158 <mallocFailedOrNot+0x38>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mallocFailedOrNot>:
push   %rax
mov    $0xc,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1139 <mallocFailedOrNot+0x19>
mov    %rax,%rdi
pop    %rax
jmp    1030 <free@plt>
xor    %edi,%edi
pop    %rax
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @mallocFailedOrNot() {
%1 = tail call i32* @malloc(i32 12)
%2 = icmp eq i32* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @free(i32* null)
br label %7
5: ; preds = %0
%6 = tail call i32 @free(i32* %1)
br label %7
7: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ closeListener();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void onSignal(int signal) {
  ;
  fprintf(stderr, "Shutting down.\n");
  closeListener();
  exit(0);
}


x86 assembly (clang, -O0):
<onSignal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
lea    0xeb5(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x0,%al
call   1040 <closeListener@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<onSignal>:
push   %rax
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
lea    0xebf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
call   1040 <closeListener@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"Shutting down.\0A\00"
define void @onSignal(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (...) @closeListener()
%6 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"Shutting down.\0A\00"
define void @onSignal(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @closeListener()
%5 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void stub1();
int _myassertbug(int line, char *file, char *err) {
  fprintf(stderr, "Assertion failed: %s:%d: %s\n", file, line, err);
  fprintf(stderr, "I HATE YOU!!!");
  ((void (*)())0)();
  abort();
  return 0;
}


x86 assembly (clang, -O0):
<_myassertbug>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x4(%rbp),%ecx
mov    -0x18(%rbp),%r8
lea    0xeb2(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
lea    0xeb8(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
xor    %eax,%eax
mov    %eax,%ecx
mov    $0x0,%al
call   *%rcx
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<_myassertbug>:
push   %rbx
mov    %rdx,%r8
mov    %rsi,%rdx
mov    %edi,%ecx
mov    0x2ec0(%rip),%rbx
mov    (%rbx),%edi
lea    0xed7(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xee4(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [29 x i8] c"Assertion failed: %s:%d: %s\0A\00"
@.str.1 = [14 x i8] c"I HATE YOU!!!\00"
define i32 @_myassertbug(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %5
%9 = load i32, i32* %4
%10 = load i8*, i8** %6
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %9, i8* %10)
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"Assertion failed: %s:%d: %s\0A\00"
@.str.1 = [14 x i8] c"I HATE YOU!!!\00"
define i32 @_myassertbug(i32 %0, i8* %1, i8* %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %0, i8* %2)
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ demoC();
int main() { demoC(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @demoC()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @demoC()
ret i32 0
}
int test_imm_32uint32_mem(unsigned int *val) {
  return ((*val) & (0x32 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_32uint32_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
and    $0x32,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_32uint32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 50
%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_32uint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 50
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void HorzPrint(char *name) {
  if (!name)
    return;
  printf("%s", name);
}


x86 assembly (clang, -O0):
<HorzPrint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <HorzPrint+0x1c>
jmp    113c <HorzPrint+0x2c>
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HorzPrint>:
test   %rdi,%rdi
je     1124 <HorzPrint+0x14>
mov    %rdi,%rsi
lea    0xee1(%rip),%rdi
jmp    1030 <printf@plt>
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @HorzPrint(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %5
5: ; preds = %1, %3
ret void
}
void wifi_rsp_hardware_set_soft_timer(
    const struct wifi_msg_hardware_set_soft_timer_rsp_t *msg) {}


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

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

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

LLVM IR (-O2):
%struct.wifi_msg_hardware_set_soft_timer_rsp_t = type opaque
define void @wifi_rsp_hardware_set_soft_timer(%struct.wifi_msg_hardware_set_soft_timer_rsp_t* nocapture %0) {
ret void
}
int int_to_string(int input, char *destination) {
  assert(input);
  assert(destination);
  if (sprintf(destination, "%d", input) < 0) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<int_to_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1030 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xeae(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
cmp    $0x0,%eax
jge    116e <int_to_string+0x4e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1175 <int_to_string+0x55>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_to_string>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <assert@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <assert@plt>
lea    0xec0(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
sar    $0x1f,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @int_to_string(i32 %0, i8* %1) {
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %0)
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @assert to i32 (i8*, ...)*)(i8* %1)
%5 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = ashr i32 %5, 31
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_memblockq_set_tlength() {
  printf("NOT IMPLEMENTED:"
         "pa_memblockq_set_tlength"
         "\n");
}


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

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

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

LLVM IR (-O2):
@str = [41 x i8] c"NOT IMPLEMENTED:pa_memblockq_set_tlength\00"
define i32 @pa_memblockq_set_tlength() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ do_stuff();
main() { do_stuff(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @do_stuff()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @do_stuff()
ret i32 0
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ default_gc;
};
typedef TYPE_1__ Screen;

/* Variables and functions */
void *get_Screen_default_gc(void *_p) {
  return (void *)((Screen *)_p)->default_gc;
}


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

x86 assembly (clang, -O2):
<get_Screen_default_gc>:
mov    (%rdi),%rax
ret

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

LLVM IR (-O2):
define i8* @get_Screen_default_gc(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}