xunge/DecIR huggingface dataset:
/* Variables and functions */
double fact(int);
double pow(double, int);
double calculateNext(double x, int n) {
  double result = pow(-1, n + 1) * (pow(x, 2 * n - 1) / fact(2 * n - 1));
  return result;
}


x86 assembly (clang, -O0):
<calculateNext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
movsd  0xec2(%rip),%xmm0
call   1040 <pow@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
shl    $0x1,%edi
sub    $0x1,%edi
call   1040 <pow@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0xc(%rbp),%edi
shl    $0x1,%edi
sub    $0x1,%edi
call   1030 <fact@plt>
movsd  -0x28(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x20(%rbp),%xmm0
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculateNext>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movsd  %xmm0,(%rsp)
lea    0x1(%rbx),%edi
movsd  0xec9(%rip),%xmm0
call   1040 <pow@plt>
movsd  %xmm0,0x8(%rsp)
add    %ebx,%ebx
add    $0xffffffff,%ebx
movsd  (%rsp),%xmm0
mov    %ebx,%edi
call   1040 <pow@plt>
movsd  %xmm0,(%rsp)
mov    %ebx,%edi
call   1030 <fact@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
mulsd  0x8(%rsp),%xmm1
movapd %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @calculateNext(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca double
store double %0, double* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = add nsw i32 %6, 1
%8 = call double @pow(double -1.000000e+00, i32 %7)
%9 = load double, double* %3
%10 = load i32, i32* %4
%11 = mul nsw i32 2, %10
%12 = sub nsw i32 %11, 1
%13 = call double @pow(double %9, i32 %12)
%14 = load i32, i32* %4
%15 = mul nsw i32 2, %14
%16 = sub nsw i32 %15, 1
%17 = call double @fact(i32 %16)
%18 = fdiv double %13, %17
%19 = fmul double %8, %18
store double %19, double* %5
%20 = load double, double* %5
ret double %20
}

LLVM IR (-O2):
define double @calculateNext(double %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = tail call double @pow(double -1.000000e+00, i32 %3)
%5 = shl nsw i32 %1, 1
%6 = add nsw i32 %5, -1
%7 = tail call double @pow(double %0, i32 %6)
%8 = tail call double @fact(i32 %6)
%9 = fdiv double %7, %8
%10 = fmul double %4, %9
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ test1();
int /*<<< orphan*/ test2();
int main() {
  test1();
  test2();
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test1()
%2 = tail call i32 (...) @test2()
ret i32 0
}
/* Type definitions */
struct nvme_passthru_cmd {
  int dummy;
};

/* Variables and functions */
int ioctl(int, unsigned long, struct nvme_passthru_cmd *);
int nvme_submit_passthru(int fd, unsigned long ioctl_cmd,
                         struct nvme_passthru_cmd *cmd) {
  return ioctl(fd, ioctl_cmd, cmd);
}


x86 assembly (clang, -O0):
<nvme_submit_passthru>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <ioctl@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nvme_submit_passthru>:
jmp    1030 <ioctl@plt>

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

LLVM IR (-O2):
%struct.nvme_passthru_cmd = type { i32 }
define i32 @nvme_submit_passthru(i32 %0, i64 %1, %struct.nvme_passthru_cmd* %2) {
%4 = tail call i32 @ioctl(i32 %0, i64 %1, %struct.nvme_passthru_cmd* %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ second();
void first() {
  second();
  printf("first\n");
}


x86 assembly (clang, -O0):
<first>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <second@plt>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<first>:
push   %rax
xor    %eax,%eax
call   1040 <second@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [6 x i8] c"first\00"
define void @first() {
%1 = tail call i32 (...) @second()
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ aligned_alloc(size_t, size_t);
int /*<<< orphan*/ free(int /*<<< orphan*/);
void uninitvar_aligned_alloc(size_t alignment, size_t size) {
  size_t uninitVar;
  free(aligned_alloc(uninitVar, size));
  free(aligned_alloc(alignment, uninitVar));
  free(aligned_alloc(uninitVar, uninitVar));
  free(aligned_alloc(alignment, size));
}


x86 assembly (clang, -O0):
<uninitvar_aligned_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <aligned_alloc@plt>
mov    %eax,%edi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <aligned_alloc@plt>
mov    %eax,%edi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <aligned_alloc@plt>
mov    %eax,%edi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <aligned_alloc@plt>
mov    %eax,%edi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uninitvar_aligned_alloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <aligned_alloc@plt>
mov    %eax,%edi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1040 <aligned_alloc@plt>
mov    %eax,%edi
call   1030 <free@plt>
call   1040 <aligned_alloc@plt>
mov    %eax,%edi
call   1030 <free@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <aligned_alloc@plt>
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @uninitvar_aligned_alloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %5
%7 = load i64, i64* %4
%8 = call i32 @aligned_alloc(i64 %6, i64 %7)
%9 = call i32 @free(i32 %8)
%10 = load i64, i64* %3
%11 = load i64, i64* %5
%12 = call i32 @aligned_alloc(i64 %10, i64 %11)
%13 = call i32 @free(i32 %12)
%14 = load i64, i64* %5
%15 = load i64, i64* %5
%16 = call i32 @aligned_alloc(i64 %14, i64 %15)
%17 = call i32 @free(i32 %16)
%18 = load i64, i64* %3
%19 = load i64, i64* %4
%20 = call i32 @aligned_alloc(i64 %18, i64 %19)
%21 = call i32 @free(i32 %20)
ret void
}

LLVM IR (-O2):
define void @uninitvar_aligned_alloc(i64 %0, i64 %1) {
%3 = tail call i32 @aligned_alloc(i64 undef, i64 %1)
%4 = tail call i32 @free(i32 %3)
%5 = tail call i32 @aligned_alloc(i64 %0, i64 undef)
%6 = tail call i32 @free(i32 %5)
%7 = tail call i32 @aligned_alloc(i64 undef, i64 undef)
%8 = tail call i32 @free(i32 %7)
%9 = tail call i32 @aligned_alloc(i64 %0, i64 %1)
%10 = tail call i32 @free(i32 %9)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void sqlite3_free(char *p) { free(p); }


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

x86 assembly (clang, -O2):
<sqlite3_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @sqlite3_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
int test_imm_1Cuint16_mem(unsigned short *val) {
  return ((*val) & (-0x1C << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_1Cuint16_mem>:
movzwl (%rdi),%eax
test   $0xffe4,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_1Cuint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -28
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
char const *skip_string(char const *, char *);
const char *skip_whitespace(const char *string) {
  return skip_string(string, " %n");
}


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

x86 assembly (clang, -O2):
<skip_whitespace>:
lea    0xee9(%rip),%rsi
jmp    1030 <skip_string@plt>

LLVM IR (-O0):
@.str = [4 x i8] c" %n\00"
define i8* @skip_whitespace(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @skip_string(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i8* %4
}

LLVM IR (-O2):
@.str = [4 x i8] c" %n\00"
define i8* @skip_whitespace(i8* %0) {
%2 = tail call i8* @skip_string(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i8* %2
}
/* Variables and functions */
char *mus_header_type2string(int);
char *sound_type_name(int type) { return (mus_header_type2string(type)); }


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

x86 assembly (clang, -O2):
<sound_type_name>:
jmp    1030 <mus_header_type2string@plt>

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

LLVM IR (-O2):
define i8* @sound_type_name(i32 %0) {
%2 = tail call i8* @mus_header_type2string(i32 %0)
ret i8* %2
}
int waitpid(int pid, int *status, int options) { return 0; }


x86 assembly (clang, -O0):
<waitpid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @waitpid(i32 %0, i32* nocapture readnone %1, i32 %2) {
ret i32 0
}
void glTranslatef(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glTranslatef() {
ret void
}
/* Variables and functions */
int RTP_get_extension(unsigned char *);
int RTP_get_extension_len(unsigned char *);
int RTP_get_header_len(unsigned char *p) {
  int ext = RTP_get_extension(p);
  if (ext == 0) {
    return 12;
  } else {
    int extlen = RTP_get_extension_len(p);
    return (12 + 4 + extlen);
  }
}


x86 assembly (clang, -O0):
<RTP_get_header_len>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <RTP_get_extension@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    114e <RTP_get_header_len+0x2e>
movl   $0xc,-0x4(%rbp)
jmp    1163 <RTP_get_header_len+0x43>
mov    -0x10(%rbp),%rdi
call   1030 <RTP_get_extension_len@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RTP_get_header_len>:
push   %rbx
mov    %rdi,%rbx
call   1040 <RTP_get_extension@plt>
test   %eax,%eax
je     113a <RTP_get_header_len+0x1a>
mov    %rbx,%rdi
call   1030 <RTP_get_extension_len@plt>
add    $0x10,%eax
pop    %rbx
ret
mov    $0xc,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @RTP_get_header_len(i8* %0) {
%2 = tail call i32 @RTP_get_extension(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @RTP_get_extension_len(i8* %0)
%6 = add nsw i32 %5, 16
br label %7
7: ; preds = %1, %4
%8 = phi i32 [ %6, %4 ], [ 12, %1 ]
ret i32 %8
}
int find_optimal(int x, int parent[]) {
  if (x != parent[x])
    parent[x] = find_optimal(parent[x], parent);
  return (parent[x]);
}


x86 assembly (clang, -O0):
<find_optimal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x4(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
je     1154 <find_optimal+0x44>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x10(%rbp),%rsi
call   1030 <find_optimal@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_optimal>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%eax
movslq %edi,%rbx
mov    (%rsi,%rbx,4),%edi
cmp    %ebx,%edi
je     112c <find_optimal+0x1c>
mov    %rsi,%r14
call   1030 <find_optimal@plt>
mov    %eax,(%r14,%rbx,4)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @find_optimal(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32, i32* %3
%6 = load i32*, i32** %4
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %6, i64 %8
%10 = load i32, i32* %9
%11 = icmp ne i32 %5, %10
br i1 %11, label %12, label %24
12: ; preds = %2
%13 = load i32*, i32** %4
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = load i32*, i32** %4
%19 = call i32 @find_optimal(i32 %17, i32* %18)
%20 = load i32*, i32** %4
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
store i32 %19, i32* %23
br label %24
24: ; preds = %12, %2
%25 = load i32*, i32** %4
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
%29 = load i32, i32* %28
ret i32 %29
}

LLVM IR (-O2):
define i32 @find_optimal(i32 %0, i32* nocapture %1) {
%3 = sext i32 %0 to i64
%4 = getelementptr inbounds i32, i32* %1, i64 %3
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, %0
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call i32 @find_optimal(i32 %5, i32* %1)
store i32 %8, i32* %4
br label %9
9: ; preds = %7, %2
%10 = phi i32 [ %8, %7 ], [ %0, %2 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void free_imatrix(int **m, long nrl, long nrh, long ncl, long nch) {
  free((char *)(m[nrl] + ncl - 1));
  free((char *)(m + nrl - 1));
}


x86 assembly (clang, -O0):
<free_imatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
add    $0xfffffffffffffffc,%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_imatrix>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi,%rsi,8),%rax
lea    (%rax,%rcx,4),%rdi
add    $0xfffffffffffffffc,%rdi
call   1030 <free@plt>
lea    (%rbx,%r14,8),%rdi
add    $0xfffffffffffffff8,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_imatrix(i32** %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca i32**
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i32** %0, i32*** %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i64 %4, i64* %10
%11 = load i32**, i32*** %6
%12 = load i64, i64* %7
%13 = getelementptr inbounds i32*, i32** %11, i64 %12
%14 = load i32*, i32** %13
%15 = load i64, i64* %9
%16 = getelementptr inbounds i32, i32* %14, i64 %15
%17 = getelementptr inbounds i32, i32* %16, i64 -1
%18 = bitcast i32* %17 to i8*
%19 = call i32 @free(i8* %18)
%20 = load i32**, i32*** %6
%21 = load i64, i64* %7
%22 = getelementptr inbounds i32*, i32** %20, i64 %21
%23 = getelementptr inbounds i32*, i32** %22, i64 -1
%24 = bitcast i32** %23 to i8*
%25 = call i32 @free(i8* %24)
ret void
}

LLVM IR (-O2):
define void @free_imatrix(i32** nocapture %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = getelementptr inbounds i32*, i32** %0, i64 %1
%7 = load i32*, i32** %6
%8 = getelementptr inbounds i32, i32* %7, i64 %3
%9 = getelementptr inbounds i32, i32* %8, i64 -1
%10 = bitcast i32* %9 to i8*
%11 = tail call i32 @free(i8* %10)
%12 = getelementptr inbounds i32*, i32** %6, i64 -1
%13 = bitcast i32** %12 to i8*
%14 = tail call i32 @free(i8* %13)
ret void
}
void snd_gun(void) {}


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

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

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

LLVM IR (-O2):
define void @snd_gun() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ echo(char *);
main() {
  switch (20) {
  case 10:
    echo("One");
    break;
  case 20:
    echo("Two");
    break;
  case 30:
    echo("Three");
  case 40:
  default:
    echo("Default");
    break;
  }
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"Two\00"
define i32 @main() {
%1 = tail call i32 @echo(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int am33xx_bbu_nand_register_handler(const char *name, char *devicefile) {
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @am33xx_bbu_nand_register_handler(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
float __infer_nondet_float();
float hypotf(float x, float y) { return __infer_nondet_float(); }


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

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

LLVM IR (-O0):
define float @hypotf(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = call float (...) @__infer_nondet_float()
ret float %5
}

LLVM IR (-O2):
define float @hypotf(float %0, float %1) {
%3 = tail call float (...) @__infer_nondet_float()
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int **subsetsWithDup(int *, int, int **, int *);
int main(void) {
  int x[] = {1, 2, 2};
  int **res, *col, n;
  res = subsetsWithDup(x, 3, &col, &n);
  printf("%d\n", n);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x3,%esi
lea    -0x20(%rbp),%rdx
lea    -0x24(%rbp),%rcx
call   1030 <subsetsWithDup@plt>
mov    %rax,-0x18(%rbp)
mov    -0x24(%rbp),%esi
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xede(%rip),%eax
mov    %eax,0x18(%rsp)
mov    0xecb(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0x10(%rsp),%rdi
lea    0x20(%rsp),%rdx
lea    0xc(%rsp),%rcx
mov    $0x3,%esi
call   1030 <subsetsWithDup@plt>
mov    0xc(%rsp),%esi
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
@__const.main.x = [3 x i32] [i32 1, i32 2, i32 2]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [3 x i32]
%2 = alloca i32*
%3 = alloca i32
%4 = bitcast [3 x i32]* %1 to i8*
%5 = bitcast i32** %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%8 = call i32** @subsetsWithDup(i32* %7, i32 3, i32** %2, i32* %3)
%9 = load i32, i32* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i32 0
}
/* Variables and functions */
scalar_t__ line(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ reverse(char *);
int main() {
  char s[1000 + 1];
  while (line(s, 1000)) {
    reverse(s);
    printf("%s", s);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    $0x3e8,%esi
call   1050 <line@plt>
cmp    $0x0,%rax
je     1181 <main+0x51>
lea    -0x3f0(%rbp),%rdi
call   1030 <reverse@plt>
lea    -0x3f0(%rbp),%rsi
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
jmp    1142 <main+0x12>
mov    -0x4(%rbp),%eax
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3f8,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1050 <line@plt>
test   %rax,%rax
je     1185 <main+0x55>
mov    %rsp,%rbx
lea    0xeaa(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <reverse@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1050 <line@plt>
test   %rax,%rax
jne    1160 <main+0x30>
xor    %eax,%eax
add    $0x3f8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [1001 x i8]
%2 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 0
%3 = call i64 @line(i8* %2, i32 1000)
%4 = icmp eq i64 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %0, %5
%6 = call i32 @reverse(i8* %2)
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%8 = call i64 @line(i8* %2, i32 1000)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %5
10: ; preds = %5, %0
ret i32 0
}
int test0(const char str[]) { return (str[0] == 'a' ? 0 : -1); }


x86 assembly (clang, -O0):
<test0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
mov    $0xffffffff,%eax
xor    %ecx,%ecx
cmp    $0x61,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test0>:
xor    %eax,%eax
cmpb   $0x61,(%rdi)
setne  %al
neg    %eax
ret

LLVM IR (-O0):
define i32 @test0(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 eq i32 %6, 97
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 0, i32 -1
ret i32 %9
}

LLVM IR (-O2):
define i32 @test0(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp ne i8 %2, 97
%4 = sext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ SIGTERM;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ raise(int /*<<< orphan*/);
void check_recv(int recv_res) {
  if (recv_res == 0) {
    printf("No data received!\n");
    raise(SIGTERM);
  }
  if (recv_res == -1) {
    printf("Receive failed!\n");
    raise(SIGTERM);
  }
}


x86 assembly (clang, -O0):
<check_recv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    114f <check_recv+0x2f>
lea    0xec4(%rip),%rdi
call   1040 <printf@plt>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
cmpl   $0xffffffff,-0x4(%rbp)
jne    1173 <check_recv+0x53>
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_recv>:
test   %edi,%edi
je     1132 <check_recv+0x12>
cmp    $0xffffffff,%edi
jne    114e <check_recv+0x2e>
lea    0xed0(%rip),%rdi
jmp    1139 <check_recv+0x19>
lea    0xed7(%rip),%rdi
push   %rax
call   1040 <puts@plt>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1030 <raise@plt>
ret

LLVM IR (-O0):
@.str = [19 x i8] c"No data received!\0A\00"
@SIGTERM = global i32 0
@.str.1 = [17 x i8] c"Receive failed!\0A\00"
define void @check_recv(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @SIGTERM
%8 = call i32 @raise(i32 %7)
br label %9
9: ; preds = %5, %1
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* @SIGTERM
%15 = call i32 @raise(i32 %14)
br label %16
16: ; preds = %12, %9
ret void
}

LLVM IR (-O2):
@SIGTERM = global i32 0
@str = [16 x i8] c"Receive failed!\00"
@str.2 = [18 x i8] c"No data received!\00"
define void @check_recv(i32 %0) {
switch i32 %0, label %8 [
i32 0, label %3
i32 -1, label %2
]
2: ; preds = %1
br label %3
3: ; preds = %1, %2
%4 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @str.2, i64 0, i64 0), %1 ]
%5 = tail call i32 @puts(i8* dereferenceable(1) %4)
%6 = load i32, i32* @SIGTERM
%7 = tail call i32 @raise(i32 %6)
br label %8
8: ; preds = %3, %1
ret void
}
/* Type definitions */
struct option {
  int dummy;
};
struct _getopt_data {
  int dummy;
};

/* Variables and functions */
int _getopt_internal_r(int, char *const *, char const *, struct option const *,
                       int *, int, struct _getopt_data *, int /*<<< orphan*/);
int _getopt_long_only_r(int argc, char *const *argv, const char *options,
                        const struct option *long_options, int *opt_index,
                        struct _getopt_data *d) {
  return _getopt_internal_r(argc, argv, options, long_options, opt_index, 1, d,
                            0);
}


x86 assembly (clang, -O0):
<_getopt_long_only_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%rax
mov    $0x1,%r9d
xor    %r10d,%r10d
mov    %rax,(%rsp)
movl   $0x0,0x8(%rsp)
call   1030 <_getopt_internal_r@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_getopt_long_only_r>:
push   %rax
mov    %r9,%rax
mov    $0x1,%r9d
push   $0x0
push   %rax
call   1030 <_getopt_internal_r@plt>
add    $0x10,%rsp
pop    %rcx
ret

LLVM IR (-O0):
%struct.option = type { i32 }
%struct._getopt_data = type { i32 }
define i32 @_getopt_long_only_r(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4, %struct._getopt_data* %5) {
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i8*
%10 = alloca %struct.option*
%11 = alloca i32*
%12 = alloca %struct._getopt_data*
store i32 %0, i32* %7
store i8** %1, i8*** %8
store i8* %2, i8** %9
store %struct.option* %3, %struct.option** %10
store i32* %4, i32** %11
store %struct._getopt_data* %5, %struct._getopt_data** %12
%13 = load i32, i32* %7
%14 = load i8**, i8*** %8
%15 = load i8*, i8** %9
%16 = load %struct.option*, %struct.option** %10
%17 = load i32*, i32** %11
%18 = load %struct._getopt_data*, %struct._getopt_data** %12
%19 = call i32 @_getopt_internal_r(i32 %13, i8** %14, i8* %15, %struct.option* %16, i32* %17, i32 1, %struct._getopt_data* %18, i32 0)
ret i32 %19
}

LLVM IR (-O2):
%struct.option = type { i32 }
%struct._getopt_data = type { i32 }
define i32 @_getopt_long_only_r(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4, %struct._getopt_data* %5) {
%7 = tail call i32 @_getopt_internal_r(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4, i32 1, %struct._getopt_data* %5, i32 0)
ret i32 %7
}
/* Variables and functions */
int __b_search(int *, int /*<<< orphan*/, int, int);
int binary_search(int *a, int n, int key) {
  return __b_search(a, 0, n - 1, key);
}


x86 assembly (clang, -O0):
<binary_search>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
mov    -0x10(%rbp),%ecx
xor    %esi,%esi
call   1030 <__b_search@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<binary_search>:
mov    %edx,%ecx
lea    -0x1(%rsi),%edx
xor    %esi,%esi
jmp    1030 <__b_search@plt>

LLVM IR (-O0):
define i32 @binary_search(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = sub nsw i32 %8, 1
%10 = load i32, i32* %6
%11 = call i32 @__b_search(i32* %7, i32 0, i32 %9, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @binary_search(i32* %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, -1
%5 = tail call i32 @__b_search(i32* %0, i32 0, i32 %4, i32 %2)
ret i32 %5
}
unsigned int rotate_right(unsigned int d) {
  unsigned int carry = d % 3;
  d /= 3;
  d += 19683 * carry;
  return d;
}


x86 assembly (clang, -O0):
<rotate_right>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x4(%rbp)
imul   $0x4ce3,-0x8(%rbp),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotate_right>:
mov    %edi,%eax
mov    $0xaaaaaaab,%ecx
imul   %rax,%rcx
shr    $0x21,%rcx
lea    (%rcx,%rcx,2),%eax
sub    %eax,%edi
imul   $0x4ce3,%edi,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @rotate_right(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = urem i32 %4, 3
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = udiv i32 %6, 3
store i32 %7, i32* %2
%8 = load i32, i32* %3
%9 = mul i32 19683, %8
%10 = load i32, i32* %2
%11 = add i32 %10, %9
store i32 %11, i32* %2
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @rotate_right(i32 %0) {
%2 = urem i32 %0, 3
%3 = udiv i32 %0, 3
%4 = mul nuw nsw i32 %2, 19683
%5 = add nuw nsw i32 %4, %3
ret i32 %5
}
int fac(int n) {
  static int f = 1;
  f = f * n;
  return (f);
}


x86 assembly (clang, -O0):
<fac>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0x2f13(%rip),%eax
imul   -0x4(%rbp),%eax
mov    %eax,0x2f09(%rip)
mov    0x2f03(%rip),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fac>:
mov    %edi,%eax
imul   0x2f17(%rip),%eax
mov    %eax,0x2f11(%rip)
ret

LLVM IR (-O0):
@fac.f = internal global i32 1
define i32 @fac(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @fac.f
%4 = load i32, i32* %2
%5 = mul nsw i32 %3, %4
store i32 %5, i32* @fac.f
%6 = load i32, i32* @fac.f
ret i32 %6
}

LLVM IR (-O2):
@fac.f = internal unnamed_addr global i32 1
define i32 @fac(i32 %0) {
%2 = load i32, i32* @fac.f
%3 = mul nsw i32 %2, %0
store i32 %3, i32* @fac.f
ret i32 %3
}
/* Type definitions */
struct current {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ refreshMultiLine(char const *, struct current *);
void refreshLine(const char *prompt, struct current *current) {
  refreshMultiLine(prompt, current);
}


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

x86 assembly (clang, -O2):
<refreshLine>:
jmp    1030 <refreshMultiLine@plt>

LLVM IR (-O0):
%struct.current = type { i32 }
define void @refreshLine(i8* %0, %struct.current* %1) {
%3 = alloca i8*
%4 = alloca %struct.current*
store i8* %0, i8** %3
store %struct.current* %1, %struct.current** %4
%5 = load i8*, i8** %3
%6 = load %struct.current*, %struct.current** %4
%7 = call i32 @refreshMultiLine(i8* %5, %struct.current* %6)
ret void
}

LLVM IR (-O2):
%struct.current = type { i32 }
define void @refreshLine(i8* %0, %struct.current* %1) {
%3 = tail call i32 @refreshMultiLine(i8* %0, %struct.current* %1)
ret void
}
int getID(int *context) { return *(context + 2); }


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

x86 assembly (clang, -O2):
<getID>:
mov    0x8(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @getID(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 2
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @getID(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 2
%3 = load i32, i32* %2
ret i32 %3
}
void XcmsCIEuvYToTekHVC() {}


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

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

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

LLVM IR (-O2):
define void @XcmsCIEuvYToTekHVC() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  assert((1 ? "foo" : "bar")[0] == 'f');
  assert((0 ? "foo" : "bar")[0] == 'b');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movsbl 0xeda(%rip),%eax
cmp    $0x66,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsbl 0xec7(%rip),%eax
cmp    $0x62,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"foo\00"
@.str.1 = [4 x i8] c"bar\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
%3 = sext i8 %2 to i32
%4 = icmp eq i32 %3, 102
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load i8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 98
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
%2 = tail call i32 @assert(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ system(char *);
void printTTYS(char *message) {
  printf("§ %s\n", message);
  printf("=============================\n");
  system("ls -l /dev/ttys00*");
}


x86 assembly (clang, -O0):
<printTTYS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
call   1030 <system@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printTTYS>:
push   %rax
mov    %rdi,%rsi
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb2(%rip),%rdi
pop    %rax
jmp    1040 <system@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"\C2\A7 %s\0A\00"
@.str.1 = [31 x i8] c"=============================\0A\00"
@.str.2 = [19 x i8] c"ls -l /dev/ttys00*\00"
define void @printTTYS(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"\C2\A7 %s\0A\00"
@.str.2 = [19 x i8] c"ls -l /dev/ttys00*\00"
@str = [30 x i8] c"=============================\00"
define void @printTTYS(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Type definitions */
struct group {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
struct group *getgrent(void) {
  assert(!"NYI");
  return NULL;
}


x86 assembly (clang, -O0):
<getgrent>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.group = type { i32 }
@.str = [4 x i8] c"NYI\00"
define %struct.group* @getgrent() {
%1 = call i32 @assert(i32 0)
ret %struct.group* null
}

LLVM IR (-O2):
%struct.group = type { i32 }
define noalias %struct.group* @getgrent() {
%1 = tail call i32 @assert(i32 0)
ret %struct.group* null
}
void f3(short a) {}


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @f3(i16 signext %0) {
ret void
}
int test_imm_8Bint8_reg(signed char val) {
  return ((val) & (-0x8B << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_8Bint8_reg>:
test   $0xffffff75,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_8Bint8_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, -139
%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_8Bint8_reg(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = and i32 %2, -139
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int test1(int a, int b) { return ~a == ~b; }


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

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

LLVM IR (-O0):
define i32 @test1(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 = xor i32 %5, -1
%7 = load i32, i32* %4
%8 = xor i32 %7, -1
%9 = icmp eq i32 %6, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @test1(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int);
void lcd_set_type_command() {
  printf("%s:%d\n",
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/beerriot/blockgame/refs/heads/master/test/"
         "mock/lcd.c",
         28);
}


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

x86 assembly (clang, -O2):
<lcd_set_type_command>:
lea    0xee9(%rip),%rdi
lea    0xee9(%rip),%rsi
mov    $0x1c,%edx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%s:%d\0A\00"
@.str.1 = [143 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/beerriot/blockgame/refs/heads/master/test/mock/lcd.c\00"
define void @lcd_set_type_command() {
%1 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.1, i64 0, i64 0), i32 28)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s:%d\0A\00"
@.str.1 = [143 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/beerriot/blockgame/refs/heads/master/test/mock/lcd.c\00"
define void @lcd_set_type_command() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.1, i64 0, i64 0), i32 28)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
void EthernetInitExpClk(unsigned long ulBase, unsigned long ulEthClk) {
  unsigned long ulDiv;
  DEBUG_ASSERT(ulBase == 0x40048000);
  ulDiv = (ulEthClk / 2) / 2500000;
  (*((volatile unsigned long *)(ulBase + 0x00000024))) = (ulDiv & 0x000000FF);
}


x86 assembly (clang, -O0):
<EthernetInitExpClk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x40048000,-0x8(%rbp)
40
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x10(%rbp),%rax
shr    $0x1,%rax
mov    $0x2625a0,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
and    $0xff,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x24(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EthernetInitExpClk>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
cmp    $0x40048000,%rbx
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
movabs $0xd6bf94d5e57a42bd,%rcx
94 bf d6
mov    %r14,%rax
mul    %rcx
shr    $0x16,%edx
movzbl %dl,%eax
mov    %rax,0x24(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @EthernetInitExpClk(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = icmp eq i64 %6, 1074036736
%8 = zext i1 %7 to i32
%9 = call i32 @DEBUG_ASSERT(i32 %8)
%10 = load i64, i64* %4
%11 = udiv i64 %10, 2
%12 = udiv i64 %11, 2500000
store i64 %12, i64* %5
%13 = load i64, i64* %5
%14 = and i64 %13, 255
%15 = load i64, i64* %3
%16 = add i64 %15, 36
%17 = inttoptr i64 %16 to i64*
store volatile i64 %14, i64* %17
ret void
}

LLVM IR (-O2):
define void @EthernetInitExpClk(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, 1074036736
%4 = zext i1 %3 to i32
%5 = tail call i32 @DEBUG_ASSERT(i32 %4)
%6 = udiv i64 %1, 5000000
%7 = and i64 %6, 255
%8 = add i64 %0, 36
%9 = inttoptr i64 %8 to i64*
store volatile i64 %7, i64* %9
ret void
}
int d_ble_rr2(double a1, double a2) { return !(__builtin_islessequal(a1, a2)); }


x86 assembly (clang, -O0):
<d_ble_rr2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @d_ble_rr2(double %0, double %1) {
%3 = fcmp ugt double %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}