xunge/DecIR huggingface dataset:
/* Variables and functions */
int strcmp(void const *, void const *);
int mcxStrCmp(const void *a, const void *b) { return strcmp(a, b); }


x86 assembly (clang, -O0):
<mcxStrCmp>:
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 <strcmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mcxStrCmp>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @mcxStrCmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
void free_buffer() {}


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

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

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

LLVM IR (-O2):
define void @free_buffer() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clear();
int /*<<< orphan*/ refresh();
ClrScreen() {
  clear();
  refresh();
}


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

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

LLVM IR (-O0):
define i32 @ClrScreen() {
%1 = alloca i32
%2 = call i32 (...) @clear()
%3 = call i32 (...) @refresh()
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
define i32 @ClrScreen() {
%1 = tail call i32 (...) @clear()
%2 = tail call i32 (...) @refresh()
ret i32 undef
}
/* Variables and functions */
int execv(char const *, char *const *);
int _execv(const char *path, char *const argv[]) { return execv(path, argv); }


x86 assembly (clang, -O0):
<_execv>:
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 <execv@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_execv>:
jmp    1030 <execv@plt>

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

LLVM IR (-O2):
define i32 @_execv(i8* %0, i8** %1) {
%3 = tail call i32 @execv(i8* %0, i8** %1)
ret i32 %3
}
int hash_plugin_is_special(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @hash_plugin_is_special() {
ret i32 0
}
/* Variables and functions */
int ls_cost_nm8_f0(double const **, double **, int *, double *, int);
int ls_cost_nm8(const double **arg, double **res, int *iw, double *w, int mem) {
  return ls_cost_nm8_f0(arg, res, iw, w, mem);
}


x86 assembly (clang, -O0):
<ls_cost_nm8>:
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    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
call   1030 <ls_cost_nm8_f0@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_cost_nm8>:
jmp    1030 <ls_cost_nm8_f0@plt>

LLVM IR (-O0):
define i32 @ls_cost_nm8(double** %0, double** %1, i32* %2, double* %3, i32 %4) {
%6 = alloca double**
%7 = alloca double**
%8 = alloca i32*
%9 = alloca double*
%10 = alloca i32
store double** %0, double*** %6
store double** %1, double*** %7
store i32* %2, i32** %8
store double* %3, double** %9
store i32 %4, i32* %10
%11 = load double**, double*** %6
%12 = load double**, double*** %7
%13 = load i32*, i32** %8
%14 = load double*, double** %9
%15 = load i32, i32* %10
%16 = call i32 @ls_cost_nm8_f0(double** %11, double** %12, i32* %13, double* %14, i32 %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @ls_cost_nm8(double** %0, double** %1, i32* %2, double* %3, i32 %4) {
%6 = tail call i32 @ls_cost_nm8_f0(double** %0, double** %1, i32* %2, double* %3, i32 %4)
ret i32 %6
}
A0AR1(r0, r1, x0, x1, p0, p1) unsigned int r0, r1;
unsigned int *p0, *p1;
{
  if ((*((unsigned int *)10000000)) <= (p1[1111111 / 4]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<A0AR1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    $0x989680,%eax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    0x10f444(%rcx),%eax
ja     113b <A0AR1+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    1142 <A0AR1+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<A0AR1>:
mov    0x989680,%ecx
xor    %eax,%eax
cmp    0x10f444(%r9),%ecx
setbe  %al
ret

LLVM IR (-O0):
define i32 @A0AR1(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4, i32* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32*
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32* %4, i32** %12
store i32* %5, i32** %13
%14 = load i32, i32* inttoptr (i64 10000000 to i32*)
%15 = load i32*, i32** %13
%16 = getelementptr inbounds i32, i32* %15, i64 277777
%17 = load i32, i32* %16
%18 = icmp ule i32 %14, %17
br i1 %18, label %19, label %20
19: ; preds = %6
store i32 1, i32* %7
br label %21
20: ; preds = %6
store i32 0, i32* %7
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
define i32 @A0AR1(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture readnone %4, i32* nocapture %5) {
%7 = load i32, i32* inttoptr (i64 10000000 to i32*)
%8 = getelementptr inbounds i32, i32* %5, i64 277777
%9 = load i32, i32* %8
%10 = icmp ule i32 %7, %9
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isgraph(int);
void t_isgraph_0x41() {
  Assert_real((isgraph(65)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isgraph.c",
              330, ("isgraph should be 1 for A"));
}


x86 assembly (clang, -O0):
<t_isgraph_0x41>:
push   %rbp
mov    %rsp,%rbp
mov    $0x41,%edi
call   1040 <isgraph@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x14a,%edx
lea    0xf65(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isgraph_0x41>:
push   %rax
mov    $0x41,%edi
call   1040 <isgraph@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x14a,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [26 x i8] c"isgraph should be 1 for A\00"
define void @t_isgraph_0x41() {
%1 = call i32 @isgraph(i32 65)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 330, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [26 x i8] c"isgraph should be 1 for A\00"
define void @t_isgraph_0x41() {
%1 = tail call i32 @isgraph(i32 65)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 330, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int square(const int val) { return val * val; }


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

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

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

LLVM IR (-O2):
define i32 @square(i32 %0) {
%2 = mul nsw i32 %0, %0
ret i32 %2
}
/* Variables and functions */
int syscall(int);
int inotify_init() { return syscall(291); }


x86 assembly (clang, -O0):
<inotify_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x123,%edi
call   1030 <syscall@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<inotify_init>:
mov    $0x123,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
define i32 @inotify_init() {
%1 = call i32 @syscall(i32 291)
ret i32 %1
}

LLVM IR (-O2):
define i32 @inotify_init() {
%1 = tail call i32 @syscall(i32 291)
ret i32 %1
}
int snd_pcm_hw_constraint_step(struct snd_pcm_runtime *runtime, int b, int parm,
                               int val) {
  return 0;
}


x86 assembly (clang, -O0):
<snd_pcm_hw_constraint_step>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.snd_pcm_runtime = type opaque
define i32 @snd_pcm_hw_constraint_step(%struct.snd_pcm_runtime* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca %struct.snd_pcm_runtime*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store %struct.snd_pcm_runtime* %0, %struct.snd_pcm_runtime** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
ret i32 0
}

LLVM IR (-O2):
%struct.snd_pcm_runtime = type opaque
define i32 @snd_pcm_hw_constraint_step(%struct.snd_pcm_runtime* nocapture readnone %0, i32 %1, i32 %2, i32 %3) {
ret i32 0
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  extern int a;
  printf("a = %d\n", a);
  return EXIT_SUCCESS;
}


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

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"a = %d\0A\00"
@a = external global i32
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = load i32, i32* @a
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}
/* Variables and functions */
scalar_t__ COND_GE();
int /*<<< orphan*/ EA_AL_8();
int /*<<< orphan*/ m68ki_write_8(int /*<<< orphan*/, int);
void m68k_op_sge_8_al(void) { m68ki_write_8(EA_AL_8(), COND_GE() ? 0xff : 0); }


x86 assembly (clang, -O0):
<m68k_op_sge_8_al>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <EA_AL_8@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <COND_GE@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rcx
xor    %esi,%esi
mov    $0xff,%eax
cmp    $0x0,%rcx
cmovne %eax,%esi
call   1050 <m68ki_write_8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m68k_op_sge_8_al>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <EA_AL_8@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <COND_GE@plt>
test   %rax,%rax
mov    $0xff,%esi
cmove  %ebp,%esi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <m68ki_write_8@plt>

LLVM IR (-O0):
define void @m68k_op_sge_8_al() {
%1 = call i32 (...) @EA_AL_8()
%2 = call i64 (...) @COND_GE()
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i64
%5 = select i1 %3, i32 255, i32 0
%6 = call i32 @m68ki_write_8(i32 %1, i32 %5)
ret void
}

LLVM IR (-O2):
define void @m68k_op_sge_8_al() {
%1 = tail call i32 (...) @EA_AL_8()
%2 = tail call i64 (...) @COND_GE()
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 0, i32 255
%5 = tail call i32 @m68ki_write_8(i32 %1, i32 %4)
ret void
}
char GetLockForDevice(char device) {}


x86 assembly (clang, -O0):
<GetLockForDevice>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define signext i8 @GetLockForDevice(i8 signext %0) {
ret i8 undef
}
int nfibs(int n) { return (n < 2) ? 1 : nfibs(n - 1) + nfibs(n - 2) + 1; }


x86 assembly (clang, -O0):
<nfibs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x2,-0x4(%rbp)
jge    1132 <nfibs+0x22>
mov    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1158 <nfibs+0x48>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1030 <nfibs@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x2,%edi
call   1030 <nfibs@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nfibs>:
mov    $0x1,%eax
cmp    $0x1,%edi
jle    1142 <nfibs+0x32>
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    -0x1(%rbx),%edi
call   1030 <nfibs@plt>
mov    %eax,%r14d
add    $0xfffffffe,%ebx
mov    %ebx,%edi
call   1030 <nfibs@plt>
add    %r14d,%eax
add    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @nfibs(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %3, label %5
3: ; preds = %1, %5
%4 = phi i32 [ %11, %5 ], [ 1, %1 ]
ret i32 %4
5: ; preds = %1
%6 = add nsw i32 %0, -1
%7 = tail call i32 @nfibs(i32 %6)
%8 = add nsw i32 %0, -2
%9 = tail call i32 @nfibs(i32 %8)
%10 = add i32 %7, 1
%11 = add i32 %10, %9
br label %3
}
/* Variables and functions */
unsigned char PDCRead(int);
unsigned char PDCDIPRead(void) { return (PDCRead(0x4)); }


x86 assembly (clang, -O0):
<PDCDIPRead>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
call   1030 <PDCRead@plt>
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<PDCDIPRead>:
mov    $0x4,%edi
jmp    1030 <PDCRead@plt>

LLVM IR (-O0):
define zeroext i8 @PDCDIPRead() {
%1 = call zeroext i8 @PDCRead(i32 4)
ret i8 %1
}

LLVM IR (-O2):
define zeroext i8 @PDCDIPRead() {
%1 = tail call zeroext i8 @PDCRead(i32 4)
ret i8 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ key_t;

/* Variables and functions */
int semget(int /*<<< orphan*/, int, int);
int binary_semaphore_allocation(key_t key, int sem_flags) {
  return semget(key, 1, sem_flags);
}


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

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

LLVM IR (-O0):
define i32 @binary_semaphore_allocation(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 = call i32 @semget(i32 %5, i32 1, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @binary_semaphore_allocation(i32 %0, i32 %1) {
%3 = tail call i32 @semget(i32 %0, i32 1, i32 %1)
ret i32 %3
}
int test_imm_F7int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0xF7 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_F7int64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x20,%rdx
and    $0xf7,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_F7int64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 32
%6 = and i64 %5, 247
%7 = icmp ne i64 %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_F7int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 1060856922112
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void g_thread_pool_set_max_threads() {}


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

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

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

LLVM IR (-O2):
define void @g_thread_pool_set_max_threads() {
ret void
}
/* Variables and functions */
scalar_t__ pow(float, float);
float powf(float base, float exponent) { return (float)pow(base, exponent); }


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

x86 assembly (clang, -O2):
<powf>:
push   %rax
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @powf(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 = call i64 @pow(float %5, float %6)
%8 = sitofp i64 %7 to float
ret float %8
}

LLVM IR (-O2):
define float @powf(float %0, float %1) {
%3 = tail call i64 @pow(float %0, float %1)
%4 = sitofp i64 %3 to float
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void showErr(int id) {
  switch (id) {
  case 0: {
    printf("\nHey! The queue is full.\n");
    break;
  }
  case 1: {
    printf("\nOps, the queue is empty!\n");
    break;
  }
  }
  return;
}


x86 assembly (clang, -O0):
<showErr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
test   %eax,%eax
je     113f <showErr+0x2f>
jmp    112e <showErr+0x1e>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
je     1150 <showErr+0x40>
jmp    115c <showErr+0x4c>
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
jmp    115c <showErr+0x4c>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showErr>:
test   %edi,%edi
je     1125 <showErr+0x15>
cmp    $0x1,%edi
jne    1131 <showErr+0x21>
lea    0xee0(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xeee(%rip),%rdi
jmp    1030 <puts@plt>
ret

LLVM IR (-O0):
@.str = [26 x i8] c"\0AHey! The queue is full.\0A\00"
@.str.1 = [27 x i8] c"\0AOps, the queue is empty!\0A\00"
define void @showErr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %8 [
i32 0, label %4
i32 1, label %6
]
4: ; preds = %1
%5 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %8
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %1, %6, %4
ret void
}

LLVM IR (-O2):
@str = [26 x i8] c"\0AOps, the queue is empty!\00"
@str.2 = [25 x i8] c"\0AHey! The queue is full.\00"
define void @showErr(i32 %0) {
switch i32 %0, label %6 [
i32 0, label %3
i32 1, label %2
]
2: ; preds = %1
br label %3
3: ; preds = %1, %2
%4 = phi i8* [ getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @str.2, i64 0, i64 0), %1 ]
%5 = tail call i32 @puts(i8* dereferenceable(1) %4)
br label %6
6: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *);
int getLen(FILE *in) {
  int len;
  fscanf(in, "%d", &len);
  return len;
}


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

x86 assembly (clang, -O2):
<getLen>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <fscanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @getLen(i32* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
ret i32 %5
}
/* Type definitions */
typedef unsigned int uint32_t;

/* Variables and functions */
void bitmap_clear(uint32_t *bitmap, unsigned nr) {
  unsigned i = ((nr) / (32U));
  uint32_t mask = (1U << ((nr) % 32U));
  bitmap[i] &= ~mask;
}


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

x86 assembly (clang, -O2):
<bitmap_clear>:
mov    %esi,%ecx
mov    %esi,%eax
mov    $0xfffffffe,%edx
rol    %cl,%edx
shr    $0x5,%eax
and    %edx,(%rdi,%rax,4)
ret

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

LLVM IR (-O2):
define void @bitmap_clear(i32* nocapture %0, i32 %1) {
%3 = lshr i32 %1, 5
%4 = and i32 %1, 31
%5 = shl nuw i32 1, %4
%6 = xor i32 %5, -1
%7 = zext i32 %3 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = and i32 %9, %6
store i32 %10, i32* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int execv(const char *path, char *const argv[]) {
  ;
  errno = ENOSYS;
  return -1;
  ;
}


x86 assembly (clang, -O0):
<execv>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ed5(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebc(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<execv>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @execv(i8* nocapture readnone %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
store i32 %3, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void __attribute__((noreturn)) usage(const char *filepath) {
  fprintf(stderr,
          "\nUsage: %s [options] hostname\n"
          "\nwhere options are:\n"
          "  -4:   only IPv4\n"
          "  -6:   only IPv6\n"
          "  -h:   show this message\n"
          "  -I:   request PKTINFO\n"
          "  -l N: send N bytes at a time\n"
          "  -r:   use raw\n"
          "  -R:   use raw (IP_HDRINCL)\n"
          "  -p N: connect to port N\n"
          "  -u:   use udp\n"
          "  -x:   show payload (up to 70 bytes)\n",
          filepath);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [293 x i8] c"\0AUsage: %s [options] hostname\0A\0Awhere options are:\0A -4: only IPv4\0A -6: only IPv6\0A -h: show this message\0A -I: request PKTINFO\0A -l N: send N bytes at a time\0A -r: use raw\0A -R: use raw (IP_HDRINCL)\0A -p N: connect to port N\0A -u: use udp\0A -x: show payload (up to 70 bytes)\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([293 x i8], [293 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [293 x i8] c"\0AUsage: %s [options] hostname\0A\0Awhere options are:\0A -4: only IPv4\0A -6: only IPv6\0A -h: show this message\0A -I: request PKTINFO\0A -l N: send N bytes at a time\0A -r: use raw\0A -R: use raw (IP_HDRINCL)\0A -p N: connect to port N\0A -u: use udp\0A -x: show payload (up to 70 bytes)\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([293 x i8], [293 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, int);
int strlen(char const *);
void strmaxcpy(char *dest, const char *src, int Max) {
  int cnt = strlen(src);
  if (cnt > (Max - 1))
    cnt = Max - 1;
  memcpy(dest, src, cnt);
  dest[cnt] = '\0';
}


x86 assembly (clang, -O0):
<strmaxcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jle    1159 <strmaxcpy+0x39>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strmaxcpy>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
call   1030 <strlen@plt>
lea    -0x1(%rbx),%ebp
cmp    %ebx,%eax
cmovl  %eax,%ebp
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <memcpy@plt>
movslq %ebp,%rax
movb   $0x0,(%r15,%rax,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @strmaxcpy(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @strlen(i8* %1)
%5 = icmp slt i32 %4, %2
%6 = add nsw i32 %2, -1
%7 = select i1 %5, i32 %4, i32 %6
%8 = tail call i32 @memcpy(i8* %0, i8* %1, i32 %7)
%9 = sext i32 %7 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
store i8 0, i8* %10
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "Usage: health_check"
                  " -d debug"
                  " -I interface"
                  "\n");
  exit(2);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [43 x i8] c"Usage: health_check -d debug -I interface\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [43 x i8] c"Usage: health_check -d debug -I interface\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 2)
unreachable
}
int test_imm_7Cint16_reg(short val) {
  return ((val) & (0x7C << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_7Cint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0x7c,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_7Cint16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, 124
%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_7Cint16_reg(i16 signext %0) {
%2 = and i16 %0, 124
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ assem_debug(char *, int, int);
int /*<<< orphan*/ output_w32(int);
void emit_fnegs(int s, int d) {
  assem_debug("fnegs d%d,s%d", d, s);
  output_w32(0xeeb10a40 | ((d & 14) << 11) | ((d & 1) << 22) | ((s & 14) >> 1) |
             ((s & 1) << 5));
}


x86 assembly (clang, -O0):
<emit_fnegs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xec5(%rip),%rdi
call   1030 <assem_debug@plt>
mov    -0x8(%rbp),%edi
and    $0xe,%edi
shl    $0xb,%edi
or     $0xeeb10a40,%edi
mov    -0x8(%rbp),%eax
and    $0x1,%eax
shl    $0x16,%eax
or     %eax,%edi
mov    -0x4(%rbp),%eax
and    $0xe,%eax
sar    $0x1,%eax
or     %eax,%edi
mov    -0x4(%rbp),%eax
and    $0x1,%eax
shl    $0x5,%eax
or     %eax,%edi
call   1040 <output_w32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_fnegs>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xed2(%rip),%rdi
mov    %ebx,%edx
call   1030 <assem_debug@plt>
mov    %ebp,%eax
and    $0xe,%eax
shl    $0xb,%eax
and    $0x1,%ebp
shl    $0x16,%ebp
mov    %ebx,%ecx
shr    %ecx
and    $0x7,%ecx
shl    $0x5,%ebx
and    $0x20,%ebx
or     %ecx,%ebx
or     %ebp,%ebx
lea    (%rax,%rbx,1),%edi
add    $0xeeb10a40,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <output_w32@plt>

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

LLVM IR (-O2):
@.str = [14 x i8] c"fnegs d%d,s%d\00"
define void @emit_fnegs(i32 %0, i32 %1) {
%3 = tail call i32 @assem_debug(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %0)
%4 = shl i32 %1, 11
%5 = and i32 %4, 28672
%6 = shl i32 %1, 22
%7 = and i32 %6, 4194304
%8 = lshr i32 %0, 1
%9 = and i32 %8, 7
%10 = shl i32 %0, 5
%11 = and i32 %10, 32
%12 = or i32 %9, %11
%13 = or i32 %12, %7
%14 = or i32 %13, %5
%15 = or i32 %14, -290387392
%16 = tail call i32 @output_w32(i32 %15)
ret void
}
int c008(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @c008() {
ret i32 0
}
/* Variables and functions */
void *Malloc(size_t);
int /*<<< orphan*/ Mmove(void *, void const *, size_t);
int /*<<< orphan*/ assert(int);
void *Mdup(const void *s, size_t n) {
  void *retval;
  assert(s != NULL);
  assert(n > 0);
  retval = Malloc(n);
  Mmove(retval, s, n);
  return retval;
}


x86 assembly (clang, -O0):
<Mdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <Malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1050 <Mmove@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mdup>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1040 <assert@plt>
xor    %edi,%edi
test   %r15,%r15
setne  %dil
call   1040 <assert@plt>
mov    %r15,%rdi
call   1030 <Malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <Mmove@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @Mdup(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i64, i64* %4
%11 = icmp ugt i64 %10, 0
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i64, i64* %4
%15 = call i8* @Malloc(i64 %14)
store i8* %15, i8** %5
%16 = load i8*, i8** %5
%17 = load i8*, i8** %3
%18 = load i64, i64* %4
%19 = call i32 @Mmove(i8* %16, i8* %17, i64 %18)
%20 = load i8*, i8** %5
ret i8* %20
}

LLVM IR (-O2):
define i8* @Mdup(i8* %0, i64 %1) {
%3 = icmp ne i8* %0, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = icmp ne i64 %1, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i8* @Malloc(i64 %1)
%10 = tail call i32 @Mmove(i8* %9, i8* %0, i64 %1)
ret i8* %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void PrintUsage(const char *argv0) {
  printf("usage: %s [option]... [--] (FILE|-)...\n\n"
         "(- indicates standard input)\n",
         argv0);
}


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

x86 assembly (clang, -O2):
<PrintUsage>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [70 x i8] c"usage: %s [option]... [--] (FILE|-)...\0A\0A(- indicates standard input)\0A\00"
define void @PrintUsage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [70 x i8] c"usage: %s [option]... [--] (FILE|-)...\0A\0A(- indicates standard input)\0A\00"
define void @PrintUsage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
decode_i_s1(int a, int b) {
  b = (b >> 5) & 31;
  return a | 16 << b;
}


x86 assembly (clang, -O0):
<decode_i_s1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x5,%eax
and    $0x1f,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x10,%edx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_i_s1>:
mov    %esi,%ecx
shr    $0x5,%ecx
mov    $0x10,%eax
shl    %cl,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @decode_i_s1(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = ashr i32 %5, 5
%7 = and i32 %6, 31
store i32 %7, i32* %4
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = shl i32 16, %9
%11 = or i32 %8, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @decode_i_s1(i32 %0, i32 %1) {
%3 = lshr i32 %1, 5
%4 = and i32 %3, 31
%5 = shl i32 16, %4
%6 = or i32 %5, %0
ret i32 %6
}
void genxori() {}


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

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

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

LLVM IR (-O2):
define void @genxori() {
ret void
}
int *factorial(int *number) {
  int i, product = 1, *fact_ptr;
  for (i = 0; i < *number; i++) {
    product *= i + 1;
  }
  fact_ptr = &product;
  return fact_ptr;
}


x86 assembly (clang, -O0):
<factorial>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    (%rcx),%eax
jge    1140 <factorial+0x40>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <factorial+0x16>
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<factorial>:
lea    -0x4(%rsp),%rax
ret

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

LLVM IR (-O2):
define noalias i32* @factorial(i32* nocapture %0) {
%2 = alloca i32
ret i32* %2
}
/* Variables and functions */
void setDirection_dummy(bool direction) {}


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

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

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

LLVM IR (-O2):
define void @setDirection_dummy(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bfalgo(char *, int, int, int, int, int, int);
void equals2(int x, int y) { bfalgo("$[-$-$]+$[$-$[-]]", x, y, x, y, x, y); }


x86 assembly (clang, -O0):
<equals2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%r8d
mov    -0x4(%rbp),%r9d
mov    -0x8(%rbp),%eax
lea    0xec7(%rip),%rdi
mov    %eax,(%rsp)
call   1030 <bfalgo@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<equals2>:
push   %rax
mov    %esi,%edx
mov    %edi,%ecx
mov    %esi,(%rsp)
lea    0xee1(%rip),%rdi
mov    %ecx,%esi
mov    %edx,%r8d
mov    %ecx,%r9d
call   1030 <bfalgo@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [18 x i8] c"$[-$-$]+$[$-$[-]]\00"
define void @equals2(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 = load i32, i32* %4
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 @bfalgo(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"$[-$-$]+$[$-$[-]]\00"
define void @equals2(i32 %0, i32 %1) {
%3 = tail call i32 @bfalgo(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %0, i32 %1, i32 %0, i32 %1)
ret void
}
char *find(char *haystack, char needle) {
  int helper = 0;
  if (needle == *haystack) {
    helper = 1;
  }
  if (helper == 1)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<find>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
movsbl -0x11(%rbp),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    112f <find+0x2f>
movl   $0x1,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    1147 <find+0x47>
mov    $0x1,%eax
mov    %rax,-0x8(%rbp)
jmp    114f <find+0x4f>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find>:
xor    %eax,%eax
cmp    %sil,(%rdi)
sete   %al
ret

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

LLVM IR (-O2):
define i8* @find(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, %1
%5 = select i1 %4, i8* inttoptr (i64 1 to i8*), i8* null
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ displayArrayInt(int *, int);
int main(void) {
  int myarray[10] = {4, 45, 23, 23, 45, 40, 0, 0, 0, 0};
  displayArrayInt(myarray, 10);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movl   $0x4,-0x30(%rbp)
movl   $0x2d,-0x2c(%rbp)
movl   $0x17,-0x28(%rbp)
movl   $0x17,-0x24(%rbp)
movl   $0x2d,-0x20(%rbp)
movl   $0x28,-0x1c(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1030 <displayArrayInt@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
movaps 0xed4(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x280000002d,%rax
mov    %rax,0x10(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
call   1030 <displayArrayInt@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = bitcast i8* %2 to [10 x i32]*
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i32 0, i32 0
store i32 4, i32* %4
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i32 0, i32 1
store i32 45, i32* %5
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i32 0, i32 2
store i32 23, i32* %6
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i32 0, i32 3
store i32 23, i32* %7
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i32 0, i32 4
store i32 45, i32* %8
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i32 0, i32 5
store i32 40, i32* %9
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%11 = call i32 @displayArrayInt(i32* %10, i32 10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%4 = bitcast i32* %3 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%6 = bitcast [10 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 4, i32 45, i32 23, i32 23>, <4 x i32>* %6
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
store i32 45, i32* %7
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
store i32 40, i32* %8
%9 = call i32 @displayArrayInt(i32* %5, i32 10)
ret i32 0
}