xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ gen_size(int /*<<< orphan*/ *, int);
void gen_scan_flat_bloop_start(FILE *outfile, int num) {
  fprintf(outfile, "for (_i=0;_i<");
  gen_size(outfile, num);
  fprintf(outfile, ";_i++) {\n");
}


x86 assembly (clang, -O0):
<gen_scan_flat_bloop_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec6(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <gen_size@plt>
mov    -0x8(%rbp),%rdi
lea    0xeb8(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_scan_flat_bloop_start>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xed1(%rip),%rdi
mov    $0xd,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <gen_size@plt>
lea    0xebc(%rip),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"for (_i=0;_i<\00"
@.str.1 = [10 x i8] c";_i++) {\0A\00"
define void @gen_scan_flat_bloop_start(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 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = load i32*, i32** %3
%8 = load i32, i32* %4
%9 = call i32 @gen_size(i32* %7, i32 %8)
%10 = load i32*, i32** %3
%11 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"for (_i=0;_i<\00"
@.str.1 = [10 x i8] c";_i++) {\0A\00"
define void @gen_scan_flat_bloop_start(i32* %0, i32 %1) {
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 13, i64 1, i32* %0)
%4 = tail call i32 @gen_size(i32* %0, i32 %1)
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64 9, i64 1, i32* %0)
ret void
}
/* Type definitions */
struct tcb {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printfd(struct tcb *, int);
int /*<<< orphan*/ tprints(char *);
void print_dirfd(struct tcb *tcp, int fd) {
  if (fd == -100)
    tprints("AT_FDCWD, ");
  else {
    printfd(tcp, fd);
    tprints(", ");
  }
}


x86 assembly (clang, -O0):
<print_dirfd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0xffffff9c,-0xc(%rbp)
jne    114a <print_dirfd+0x2a>
lea    0xec0(%rip),%rdi
call   1040 <tprints@plt>
jmp    1162 <print_dirfd+0x42>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <printfd@plt>
lea    0xeab(%rip),%rdi
call   1040 <tprints@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_dirfd>:
cmp    $0xffffff9c,%esi
jne    1131 <print_dirfd+0x11>
lea    0xed4(%rip),%rdi
jmp    1040 <tprints@plt>
push   %rax
call   1030 <printfd@plt>
lea    0xeca(%rip),%rdi
add    $0x8,%rsp
jmp    1040 <tprints@plt>

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

LLVM IR (-O2):
%struct.tcb = type { i32 }
@.str = [11 x i8] c"AT_FDCWD, \00"
@.str.1 = [3 x i8] c", \00"
define void @print_dirfd(%struct.tcb* %0, i32 %1) {
%3 = icmp eq i32 %1, -100
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @printfd(%struct.tcb* %0, i32 %1)
br label %6
6: ; preds = %2, %4
%7 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %2 ]
%8 = tail call i32 @tprints(i8* %7)
ret void
}
void int2Arr(int inNum, int outArr[], int size) {
  while (inNum > 0) {
    outArr[size - 1] = inNum % 10;
    size--;
    inNum /= 10;
  }
}


x86 assembly (clang, -O0):
<int2Arr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    114f <int2Arr+0x4f>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    110e <int2Arr+0xe>
pop    %rbp
ret

x86 assembly (clang, -O2):
<int2Arr>:
test   %edi,%edi
jle    1141 <int2Arr+0x41>
movslq %edx,%rax
lea    (%rsi,%rax,4),%rax
add    $0xfffffffffffffffc,%rax
mov    $0xcccccccd,%r8d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %edi,%edx
imul   %r8,%rdx
shr    $0x23,%rdx
lea    (%rdx,%rdx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edi,%ecx
sub    %esi,%ecx
mov    %ecx,(%rax)
add    $0xfffffffffffffffc,%rax
cmp    $0x9,%edi
mov    %edx,%edi
ja     1120 <int2Arr+0x20>
ret

LLVM IR (-O0):
define void @int2Arr(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
br label %7
7: ; preds = %10, %3
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = load i32, i32* %4
%12 = srem i32 %11, 10
%13 = load i32*, i32** %5
%14 = load i32, i32* %6
%15 = sub nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %13, i64 %16
store i32 %12, i32* %17
%18 = load i32, i32* %6
%19 = add nsw i32 %18, -1
store i32 %19, i32* %6
%20 = load i32, i32* %4
%21 = sdiv i32 %20, 10
store i32 %21, i32* %4
br label %7
22: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @int2Arr(i32 %0, i32* nocapture writeonly %1, i32 %2) {
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %15
5: ; preds = %3
%6 = sext i32 %2 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ %6, %5 ], [ %11, %7 ]
%9 = phi i32 [ %0, %5 ], [ %13, %7 ]
%10 = urem i32 %9, 10
%11 = add i64 %8, -1
%12 = getelementptr inbounds i32, i32* %1, i64 %11
store i32 %10, i32* %12
%13 = udiv i32 %9, 10
%14 = icmp ult i32 %9, 10
br i1 %14, label %15, label %7
15: ; preds = %7, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void cooked_mode(void) { system("/bin/stty cooked"); }


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"/bin/stty cooked\00"
define void @cooked_mode() {
%1 = call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"/bin/stty cooked\00"
define void @cooked_mode() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *strrchr(char const *, char);
const char *vohttpd_file_extend(const char *path) {
  const char *p = strrchr(path, '.');
  return p == NULL ? p : (p + 1);
}


x86 assembly (clang, -O0):
<vohttpd_file_extend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1146 <vohttpd_file_extend+0x36>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1152 <vohttpd_file_extend+0x42>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vohttpd_file_extend>:
push   %rax
mov    $0x2e,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmovne %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @vohttpd_file_extend(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strrchr(i8* %4, i8 signext 46)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i8*, i8** %3
br label %13
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 1
br label %13
13: ; preds = %10, %8
%14 = phi i8* [ %9, %8 ], [ %12, %10 ]
ret i8* %14
}

LLVM IR (-O2):
define i8* @vohttpd_file_extend(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 46)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* null, i8* %4
ret i8* %5
}
char *icalloc(nelem, elsize) {
  if (nelem == 0 || elsize == 0)
    nelem = elsize = 1;
  return calloc((unsigned)nelem, (unsigned)elsize);
}


x86 assembly (clang, -O0):
<icalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1132 <icalloc+0x22>
cmpl   $0x0,-0x8(%rbp)
jne    1140 <icalloc+0x30>
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%edi
mov    -0x8(%rbp),%eax
mov    %eax,%esi
call   1030 <calloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<icalloc>:
test   %edi,%edi
sete   %al
test   %esi,%esi
sete   %cl
or     %al,%cl
mov    %edi,%edi
mov    $0x1,%eax
cmovne %rax,%rdi
mov    %esi,%esi
cmovne %rax,%rsi
jmp    1030 <calloc@plt>

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

LLVM IR (-O2):
define noalias i8* @icalloc(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
%4 = icmp eq i32 %1, 0
%5 = or i1 %3, %4
%6 = zext i32 %0 to i64
%7 = select i1 %5, i64 1, i64 %6
%8 = zext i32 %1 to i64
%9 = select i1 %5, i64 1, i64 %8
%10 = tail call i8* @calloc(i64 %7, i64 %9)
ret i8* %10
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
scalar_t__ pthread_mutex_destroy(int /*<<< orphan*/ *);
void std_pthread_mutex_destroy(pthread_mutex_t *mutex) {
  if (pthread_mutex_destroy(mutex) != 0) {
    perror("pthread_mutex_destroy");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<std_pthread_mutex_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <pthread_mutex_destroy@plt>
cmp    $0x0,%rax
je     1165 <std_pthread_mutex_destroy+0x35>
lea    0xeaa(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<std_pthread_mutex_destroy>:
push   %rax
call   1030 <pthread_mutex_destroy@plt>
test   %rax,%rax
jne    113d <std_pthread_mutex_destroy+0xd>
pop    %rax
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [22 x i8] c"pthread_mutex_destroy\00"
define void @std_pthread_mutex_destroy(i32* %0) {
%2 = tail call i64 @pthread_mutex_destroy(i32* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
ret void
}
void cleanup0(void *arg) { *(int *)arg = 1; }


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

x86 assembly (clang, -O2):
<cleanup0>:
movl   $0x1,(%rdi)
ret

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

LLVM IR (-O2):
define void @cleanup0(i8* nocapture writeonly %0) {
%2 = bitcast i8* %0 to i32*
store i32 1, i32* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(int **, int **, int);
int /*<<< orphan*/ test_assert(int);
int main(void) {
  int a = 0;
  int *array[10];
  int *array2[10];
  array[3] = &a;
  memcpy(array2, array + 3, sizeof(int *));
  *array2[0] = 13;
  test_assert(13 == a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0xb0(%rbp),%rdi
lea    -0x60(%rbp),%rsi
add    $0x18,%rsi
mov    $0x8,%edx
call   1030 <memcpy@plt>
mov    -0xb0(%rbp),%rax
movl   $0xd,(%rax)
mov    $0xd,%eax
cmp    -0x8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <test_assert@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xb8,%rsp
movl   $0x0,0xc(%rsp)
lea    0x78(%rsp),%rsi
lea    0xc(%rsp),%rax
mov    %rax,0x78(%rsp)
lea    0x10(%rsp),%rdi
mov    $0x8,%edx
call   1030 <memcpy@plt>
mov    0x10(%rsp),%rax
movl   $0xd,(%rax)
xor    %edi,%edi
cmpl   $0xd,0xc(%rsp)
sete   %dil
call   1040 <test_assert@plt>
xor    %eax,%eax
add    $0xb8,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i32*]
%4 = alloca [10 x i32*]
store i32 0, i32* %1
store i32 0, i32* %2
%5 = getelementptr inbounds [10 x i32*], [10 x i32*]* %3, i64 0, i64 3
store i32* %2, i32** %5
%6 = getelementptr inbounds [10 x i32*], [10 x i32*]* %4, i64 0, i64 0
%7 = getelementptr inbounds [10 x i32*], [10 x i32*]* %3, i64 0, i64 0
%8 = getelementptr inbounds i32*, i32** %7, i64 3
%9 = call i32 @memcpy(i32** %6, i32** %8, i32 8)
%10 = getelementptr inbounds [10 x i32*], [10 x i32*]* %4, i64 0, i64 0
%11 = load i32*, i32** %10
store i32 13, i32* %11
%12 = load i32, i32* %2
%13 = icmp eq i32 13, %12
%14 = zext i1 %13 to i32
%15 = call i32 @test_assert(i32 %14)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32*]
%3 = alloca [10 x i32*]
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = bitcast [10 x i32*]* %2 to i8*
%6 = bitcast [10 x i32*]* %3 to i8*
%7 = getelementptr inbounds [10 x i32*], [10 x i32*]* %2, i64 0, i64 3
store i32* %1, i32** %7
%8 = getelementptr inbounds [10 x i32*], [10 x i32*]* %3, i64 0, i64 0
%9 = call i32 @memcpy(i32** %8, i32** %7, i32 8)
%10 = load i32*, i32** %8
store i32 13, i32* %10
%11 = load i32, i32* %1
%12 = icmp eq i32 %11, 13
%13 = zext i1 %12 to i32
%14 = call i32 @test_assert(i32 %13)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint32_t;

/* Variables and functions */
void store32_le(uint8_t dst[4], uint32_t w) {
  dst[0] = (uint8_t)w;
  w >>= 8;
  dst[1] = (uint8_t)w;
  w >>= 8;
  dst[2] = (uint8_t)w;
  w >>= 8;
  dst[3] = (uint8_t)w;
}


x86 assembly (clang, -O0):
<store32_le>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movslq -0xc(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x18(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<store32_le>:
movslq %esi,%rax
mov    %rax,(%rdi)
mov    %eax,%ecx
sar    $0x8,%ecx
movslq %ecx,%rcx
mov    %rcx,0x8(%rdi)
mov    %eax,%ecx
sar    $0x10,%ecx
movslq %ecx,%rcx
mov    %rcx,0x10(%rdi)
sar    $0x18,%eax
cltq
mov    %rax,0x18(%rdi)
ret

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

LLVM IR (-O2):
define void @store32_le(i64* nocapture writeonly %0, i32 %1) {
%3 = sext i32 %1 to i64
store i64 %3, i64* %0
%4 = ashr i32 %1, 8
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i64, i64* %0, i64 1
store i64 %5, i64* %6
%7 = ashr i32 %1, 16
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i64, i64* %0, i64 2
store i64 %8, i64* %9
%10 = ashr i32 %1, 24
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i64, i64* %0, i64 3
store i64 %11, i64* %12
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
void erase_file(FILE *f) {}


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

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

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

LLVM IR (-O2):
define void @erase_file(i32* nocapture %0) {
ret void
}
void show_5() { printf("%s\n", __func__); }


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

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

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

LLVM IR (-O2):
@__func__.show_5 = [7 x i8] c"show_5\00"
define void @show_5() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @__func__.show_5, i64 0, i64 0))
ret void
}
/* Variables and functions */
void Q1_ResetMapLoading(void) {}


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

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

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

LLVM IR (-O2):
define void @Q1_ResetMapLoading() {
ret void
}
void lm_dump_sample(int channel, float val) {}


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

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

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

LLVM IR (-O2):
define void @lm_dump_sample(i32 %0, float %1) {
ret void
}
float test_2(float x) { return __builtin_fabs(x); }


x86 assembly (clang, -O0):
<test_2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movaps 0xee7(%rip),%xmm1
pand   %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_2>:
andps  0xef9(%rip),%xmm0
ret

LLVM IR (-O0):
define float @test_2(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = call double @llvm.fabs.f64(double %4)
%6 = fptrunc double %5 to float
ret float %6
}

LLVM IR (-O2):
define float @test_2(float %0) {
%2 = tail call float @llvm.fabs.f32(float %0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void five(const int x, const int y) {
  if (x == y)
    printf("x and y are equal.\n");
  else
    printf("x and y are different.\n");
}


x86 assembly (clang, -O0):
<five>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    113b <five+0x2b>
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
jmp    1147 <five+0x37>
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<five>:
cmp    %esi,%edi
lea    0xefe(%rip),%rax
lea    0xee0(%rip),%rdi
cmove  %rax,%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"x and y are equal.\0A\00"
@.str.1 = [24 x i8] c"x and y are different.\0A\00"
define void @five(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 = icmp eq i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %12
10: ; preds = %2
%11 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
ret void
}

LLVM IR (-O2):
@str = [23 x i8] c"x and y are different.\00"
@str.2 = [19 x i8] c"x and y are equal.\00"
define void @five(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
%4 = select i1 %3, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0)
%5 = tail call i32 @puts(i8* dereferenceable(1) %4)
ret void
}
/* Variables and functions */
int rdv40_spiffs_mount();
int /*<<< orphan*/ rdv40_spiffs_mounted();
int rdv40_spiffs_lazy_mount(void) {
  int changed = 0;
  if (!rdv40_spiffs_mounted()) {
    changed = rdv40_spiffs_mount();
    changed = !changed;
  }
  return changed;
}


x86 assembly (clang, -O0):
<rdv40_spiffs_lazy_mount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rdv40_spiffs_mounted@plt>
cmp    $0x0,%eax
jne    115a <rdv40_spiffs_lazy_mount+0x3a>
mov    $0x0,%al
call   1040 <rdv40_spiffs_mount@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdv40_spiffs_lazy_mount>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <rdv40_spiffs_mounted@plt>
test   %eax,%eax
jne    113c <rdv40_spiffs_lazy_mount+0x1c>
xor    %eax,%eax
call   1040 <rdv40_spiffs_mount@plt>
xor    %ebx,%ebx
test   %eax,%eax
sete   %bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @rdv40_spiffs_lazy_mount() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @rdv40_spiffs_mounted()
%3 = icmp ne i32 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %0
%5 = call i32 (...) @rdv40_spiffs_mount()
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
%9 = zext i1 %8 to i32
store i32 %9, i32* %1
br label %10
10: ; preds = %4, %0
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
define i32 @rdv40_spiffs_lazy_mount() {
%1 = tail call i32 (...) @rdv40_spiffs_mounted()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = tail call i32 (...) @rdv40_spiffs_mount()
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %0
%8 = phi i32 [ 0, %0 ], [ %6, %3 ]
ret i32 %8
}
int main() {
  unsigned long value = 0;
  __asm__("movq $0x123456789ABCDEF, %%rax; pushq %%rax; popq %0"
          : "=r"(value)
          :
          : "%rax");
  return value == 0x123456789ABCDEF;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movabs $0x123456789abcdef,%rax
45 23 01
push   %rax
pop    %rcx
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
movabs $0x123456789abcdef,%rax
45 23 01
cmp    %rax,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
movabs $0x123456789abcdef,%rax
45 23 01
push   %rax
pop    %rcx
movabs $0x123456789abcdef,%rdx
45 23 01
xor    %eax,%eax
cmp    %rdx,%rcx
sete   %al
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
store i64 0, i64* %2
%3 = call i64 asm "movq $$0x123456789ABCDEF, %rax; pushq %rax; popq $0", "=r,~{rax},~{dirflag},~{fpsr},~{flags}"()
store i64 %3, i64* %2
%4 = load i64, i64* %2
%5 = icmp eq i64 %4, 81985529216486895
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 asm "movq $$0x123456789ABCDEF, %rax; pushq %rax; popq $0", "=r,~{rax},~{dirflag},~{fpsr},~{flags}"()
%2 = icmp eq i64 %1, 81985529216486895
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ op_write1(int);
void op_enc_push_af(void) { op_write1(0xf5); }


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

x86 assembly (clang, -O2):
<op_enc_push_af>:
mov    $0xf5,%edi
jmp    1030 <op_write1@plt>

LLVM IR (-O0):
define void @op_enc_push_af() {
%1 = call i32 @op_write1(i32 245)
ret void
}

LLVM IR (-O2):
define void @op_enc_push_af() {
%1 = tail call i32 @op_write1(i32 245)
ret void
}
int is_escape(char *str, int idx) {
  int i;
  for (i = idx; i >= 0 && str[i] == '@'; i--)
    ;
  return (idx - i) & 1;
}


x86 assembly (clang, -O0):
<is_escape>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
jl     1135 <is_escape+0x35>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x40,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1145 <is_escape+0x45>
jmp    1158 <is_escape+0x58>
jmp    114a <is_escape+0x4a>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1111 <is_escape+0x11>
mov    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_escape>:
mov    %esi,%eax
mov    %esi,%ecx
test   %esi,%esi
js     1126 <is_escape+0x26>
mov    %eax,%ecx
nopw   0x0(%rax,%rax,1)
mov    %ecx,%edx
cmpb   $0x40,(%rdi,%rdx,1)
jne    1126 <is_escape+0x26>
lea    -0x1(%rcx),%edx
test   %ecx,%ecx
mov    %edx,%ecx
jg     1110 <is_escape+0x10>
mov    $0xffffffff,%ecx
sub    %ecx,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @is_escape(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
store i32 %6, i32* %5
br label %7
7: ; preds = %21, %2
%8 = load i32, i32* %5
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = load i8*, i8** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 64
br label %18
18: ; preds = %10, %7
%19 = phi i1 [ false, %7 ], [ %17, %10 ]
br i1 %19, label %20, label %24
20: ; preds = %18
br label %21
21: ; preds = %20
%22 = load i32, i32* %5
%23 = add nsw i32 %22, -1
store i32 %23, i32* %5
br label %7
24: ; preds = %18
%25 = load i32, i32* %4
%26 = load i32, i32* %5
%27 = sub nsw i32 %25, %26
%28 = and i32 %27, 1
ret i32 %28
}

LLVM IR (-O2):
define i32 @is_escape(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, -1
br i1 %3, label %4, label %13
4: ; preds = %2, %10
%5 = phi i32 [ %11, %10 ], [ %1, %2 ]
%6 = zext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 64
br i1 %9, label %10, label %13
10: ; preds = %4
%11 = add nsw i32 %5, -1
%12 = icmp sgt i32 %5, 0
br i1 %12, label %4, label %13
13: ; preds = %4, %10, %2
%14 = phi i32 [ %1, %2 ], [ -1, %10 ], [ %5, %4 ]
%15 = sub nsw i32 %1, %14
%16 = and i32 %15, 1
ret i32 %16
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ putc(char, int /*<<< orphan*/ *);
int hputc(int ch, FILE *out) {
  static char *hex = "0123456789abcdef";
  putc(hex[ch >> 4], out);
  putc(hex[ch & 0xf], out);
  return 0;
}


x86 assembly (clang, -O0):
<hputc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2f02(%rip),%rax
mov    -0x4(%rbp),%ecx
sar    $0x4,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1030 <putc@plt>
mov    0x2ee3(%rip),%rax
mov    -0x4(%rbp),%ecx
and    $0xf,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1030 <putc@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hputc>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebx
mov    %edi,%eax
sar    $0x4,%eax
cltq
lea    0xed8(%rip),%r15
movsbl (%rax,%r15,1),%edi
call   1030 <putc@plt>
and    $0xf,%ebx
movsbl (%rbx,%r15,1),%edi
mov    %r14,%rsi
call   1030 <putc@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@hputc.hex = internal global i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i32 0, i32 0)
@.str = [17 x i8] c"0123456789abcdef\00"
define i32 @hputc(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i8*, i8** @hputc.hex
%6 = load i32, i32* %3
%7 = ashr i32 %6, 4
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %5, i64 %8
%10 = load i8, i8* %9
%11 = load i32*, i32** %4
%12 = call i32 @putc(i8 signext %10, i32* %11)
%13 = load i8*, i8** @hputc.hex
%14 = load i32, i32* %3
%15 = and i32 %14, 15
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %13, i64 %16
%18 = load i8, i8* %17
%19 = load i32*, i32** %4
%20 = call i32 @putc(i8 signext %18, i32* %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"0123456789abcdef\00"
define i32 @hputc(i32 %0, i32* nocapture %1) {
%3 = ashr i32 %0, 4
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %4
%6 = load i8, i8* %5
%7 = tail call i32 @putc(i8 signext %6, i32* %1)
%8 = and i32 %0, 15
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %9
%11 = load i8, i8* %10
%12 = tail call i32 @putc(i8 signext %11, i32* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ basicHorizontalIntake(int);
int /*<<< orphan*/ basicVerticalIntake(int);
void basicBothIntakes(int power) {
  basicHorizontalIntake(power);
  basicVerticalIntake(power);
}


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

x86 assembly (clang, -O2):
<basicBothIntakes>:
push   %rbx
mov    %edi,%ebx
call   1030 <basicHorizontalIntake@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <basicVerticalIntake@plt>

LLVM IR (-O0):
define void @basicBothIntakes(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @basicHorizontalIntake(i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @basicVerticalIntake(i32 %5)
ret void
}

LLVM IR (-O2):
define void @basicBothIntakes(i32 %0) {
%2 = tail call i32 @basicHorizontalIntake(i32 %0)
%3 = tail call i32 @basicVerticalIntake(i32 %0)
ret void
}
/* Variables and functions */
char *strerror(int);
char *mmbackend_socket_strerror(int err_no) { return strerror(err_no); }


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

x86 assembly (clang, -O2):
<mmbackend_socket_strerror>:
jmp    1030 <strerror@plt>

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

LLVM IR (-O2):
define i8* @mmbackend_socket_strerror(i32 %0) {
%2 = tail call i8* @strerror(i32 %0)
ret i8* %2
}
/* Variables and functions */
int add2(int, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  printf("The result is: %d\n", add2(1, 2));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [19 x i8] c"The result is: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @add2(i32 1, i32 2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
int unix_start_timer(struct qemu_alarm_timer *t) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.qemu_alarm_timer = type opaque
define i32 @unix_start_timer(%struct.qemu_alarm_timer* nocapture readnone %0) {
ret i32 0
}
int f1(int x) {
  x &= 0xff;
  x += 0x400;
  x &= 0x7ff;
  return x;
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x400,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7ff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
movzbl %dil,%eax
or     $0x400,%eax
ret

LLVM IR (-O0):
define i32 @f1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1024
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = and i32 %7, 2047
store i32 %8, i32* %2
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @f1(i32 %0) {
%2 = and i32 %0, 255
%3 = or i32 %2, 1024
ret i32 %3
}
int test_imm_D8uint8_mem(unsigned char *val) {
  return ((*val) & (-0xD8 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_D8uint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, -216
%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_D8uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 40
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ block128_f;
typedef int /*<<< orphan*/ AES_KEY;

/* Variables and functions */
scalar_t__ AES_encrypt;
int /*<<< orphan*/ CRYPTO_cfb128_1_encrypt(unsigned char const *,
                                           unsigned char *, size_t,
                                           int /*<<< orphan*/ const *,
                                           unsigned char *, int *, int const,
                                           int /*<<< orphan*/);
void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
                      size_t length, const AES_KEY *key, unsigned char *ivec,
                      int *num, const int enc) {
  CRYPTO_cfb128_1_encrypt(in, out, length, key, ivec, num, enc,
                          (block128_f)AES_encrypt);
}


x86 assembly (clang, -O0):
<AES_cfb1_encrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    0x10(%rbp),%r10d
mov    0x2e92(%rip),%rax
mov    (%rax),%rax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <CRYPTO_cfb128_1_encrypt@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AES_cfb1_encrypt>:
push   %rax
mov    0x10(%rsp),%r10d
mov    0x2ecb(%rip),%rax
mov    (%rax),%eax
push   %rax
push   %r10
call   1030 <CRYPTO_cfb128_1_encrypt@plt>
add    $0x10,%rsp
pop    %rax
ret

LLVM IR (-O0):
@AES_encrypt = global i64 0
define void @AES_cfb1_encrypt(i8* %0, i8* %1, i64 %2, i32* %3, i8* %4, i32* %5, i32 %6) {
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32*
%12 = alloca i8*
%13 = alloca i32*
%14 = alloca i32
store i8* %0, i8** %8
store i8* %1, i8** %9
store i64 %2, i64* %10
store i32* %3, i32** %11
store i8* %4, i8** %12
store i32* %5, i32** %13
store i32 %6, i32* %14
%15 = load i8*, i8** %8
%16 = load i8*, i8** %9
%17 = load i64, i64* %10
%18 = load i32*, i32** %11
%19 = load i8*, i8** %12
%20 = load i32*, i32** %13
%21 = load i32, i32* %14
%22 = load i64, i64* @AES_encrypt
%23 = trunc i64 %22 to i32
%24 = call i32 @CRYPTO_cfb128_1_encrypt(i8* %15, i8* %16, i64 %17, i32* %18, i8* %19, i32* %20, i32 %21, i32 %23)
ret void
}

LLVM IR (-O2):
@AES_encrypt = global i64 0
define void @AES_cfb1_encrypt(i8* %0, i8* %1, i64 %2, i32* %3, i8* %4, i32* %5, i32 %6) {
%8 = load i64, i64* @AES_encrypt
%9 = trunc i64 %8 to i32
%10 = tail call i32 @CRYPTO_cfb128_1_encrypt(i8* %0, i8* %1, i64 %2, i32* %3, i8* %4, i32* %5, i32 %6, i32 %9)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ recursion(int);
int main() {
  int x, acumulator;
  x = 0;
  while (x < 10) {
    x = x + 1;
  }
  recursion(x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    113e <main+0x2e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
mov    -0x8(%rbp),%edi
call   1030 <recursion@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @recursion(i32 10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ clear_io_bit(int, int);
void TOSH_MAKE_UART_TXD0_INPUT() { clear_io_bit(0x72, 1); }


x86 assembly (clang, -O0):
<TOSH_MAKE_UART_TXD0_INPUT>:
push   %rbp
mov    %rsp,%rbp
mov    $0x72,%edi
mov    $0x1,%esi
call   1030 <clear_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_MAKE_UART_TXD0_INPUT>:
mov    $0x72,%edi
mov    $0x1,%esi
jmp    1030 <clear_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_MAKE_UART_TXD0_INPUT() {
%1 = call i32 @clear_io_bit(i32 114, i32 1)
ret void
}

LLVM IR (-O2):
define void @TOSH_MAKE_UART_TXD0_INPUT() {
%1 = tail call i32 @clear_io_bit(i32 114, i32 1)
ret void
}
int test_imm_86uint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x86 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_86uint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 134
%6 = icmp ne i64 %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_86uint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 134
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ LOCK_UN;
int /*<<< orphan*/ flock(int, int /*<<< orphan*/);
void suspend_allow(int handle) { flock(handle, LOCK_UN); }


x86 assembly (clang, -O0):
<suspend_allow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
call   1030 <flock@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<suspend_allow>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
jmp    1030 <flock@plt>

LLVM IR (-O0):
@LOCK_UN = global i32 0
define void @suspend_allow(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @LOCK_UN
%5 = call i32 @flock(i32 %3, i32 %4)
ret void
}

LLVM IR (-O2):
@LOCK_UN = global i32 0
define void @suspend_allow(i32 %0) {
%2 = load i32, i32* @LOCK_UN
%3 = tail call i32 @flock(i32 %0, i32 %2)
ret void
}
int _is_string_empty(char *string) { return *string == '\0' ? 1 : 0; }


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

x86 assembly (clang, -O2):
<_is_string_empty>:
xor    %eax,%eax
cmpb   $0x0,(%rdi)
sete   %al
ret

LLVM IR (-O0):
define i32 @_is_string_empty(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 1, i32 0
ret i32 %8
}

LLVM IR (-O2):
define i32 @_is_string_empty(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_header(const char *title) {
  printf("====================================================================="
         "===========\n");
  printf(" %s\n", title);
  printf("====================================================================="
         "===========\n");
}


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

x86 assembly (clang, -O2):
<print_header>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed7(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xec3(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@.str.1 = [5 x i8] c" %s\0A\00"
@str.2 = [81 x i8] c"================================================================================\00"
define void @print_header(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str.2, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
unsigned long long __normal___udivdi3(unsigned long long, unsigned long long);
unsigned long long __attribute__((no_instrument_function))
__wrap___udivdi3(unsigned long long a, unsigned long long b) {
  return __normal___udivdi3(a, b);
}


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

x86 assembly (clang, -O2):
<__wrap___udivdi3>:
jmp    1030 <__normal___udivdi3@plt>

LLVM IR (-O0):
define i64 @__wrap___udivdi3(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = call i64 @__normal___udivdi3(i64 %5, i64 %6)
ret i64 %7
}

LLVM IR (-O2):
define i64 @__wrap___udivdi3(i64 %0, i64 %1) {
%3 = tail call i64 @__normal___udivdi3(i64 %0, i64 %1)
ret i64 %3
}