xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("BPF Program Snapshot (bps):\n"
         "List of all BPF programs loaded into the system.\n\n");
  printf("Usage: bps [bpf-prog-id]\n");
  printf("    [bpf-prog-id] If specified, it shows the details info of the "
         "bpf-prog\n");
  printf("\n");
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <puts@plt>
lea    0xf1a(%rip),%rdi
call   1040 <puts@plt>
lea    0xf27(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [79 x i8] c"BPF Program Snapshot (bps):\0AList of all BPF programs loaded into the system.\0A\0A\00"
@.str.1 = [26 x i8] c"Usage: bps [bpf-prog-id]\0A\00"
@.str.2 = [75 x i8] c" [bpf-prog-id] If specified, it shows the details info of the bpf-prog\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [78 x i8] c"BPF Program Snapshot (bps):\0AList of all BPF programs loaded into the system.\0A\00"
@str.4 = [25 x i8] c"Usage: bps [bpf-prog-id]\00"
@str.5 = [74 x i8] c" [bpf-prog-id] If specified, it shows the details info of the bpf-prog\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
unsigned char toupper(unsigned char);
char *strupr(char *s) {
  unsigned char *us = s;
  while (*us) {
    *us = toupper(*us);
    us++;
  }
  return s;
}


x86 assembly (clang, -O0):
<strupr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1156 <strupr+0x46>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <strupr+0x14>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strupr>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%al
test   %al,%al
je     1146 <strupr+0x36>
lea    0x1(%r14),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl %al,%edi
call   1030 <toupper@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <strupr+0x20>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strupr(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %9, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = call zeroext i8 @toupper(i8 zeroext %11)
%13 = load i8*, i8** %3
store i8 %12, i8* %13
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %3
br label %5
16: ; preds = %5
%17 = load i8*, i8** %2
ret i8* %17
}

LLVM IR (-O2):
define i8* @strupr(i8* returned %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call zeroext i8 @toupper(i8 zeroext %5)
store i8 %7, i8* %6
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ lecture_contenu(char *);
int main(int argc, char *argv[]) {
  int i;
  for (i = 1; i < argc; i++)
    lecture_contenu(argv[i]);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1158 <main+0x48>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <lecture_contenu@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x2,%edi
jl     1142 <main+0x32>
mov    %rsi,%r14
mov    %edi,%r15d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r14,%rbx,8),%rdi
call   1030 <lecture_contenu@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 1, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @lecture_contenu(i8* %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ F_OK;
int access(char const *, int /*<<< orphan*/);
int verify_testfile(const char *testfile_name) {
  return (access(testfile_name, F_OK));
}


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

x86 assembly (clang, -O2):
<verify_testfile>:
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
jmp    1030 <access@plt>

LLVM IR (-O0):
@F_OK = global i32 0
define i32 @verify_testfile(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @F_OK
%5 = call i32 @access(i8* %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
@F_OK = global i32 0
define i32 @verify_testfile(i8* nocapture %0) {
%2 = load i32, i32* @F_OK
%3 = tail call i32 @access(i8* %0, i32 %2)
ret i32 %3
}
int gdc_change_data_type(void *param) {
  unsigned int *syscall_bc = (unsigned int *)0x8c0000bc;
  int (*syscall)() = (int (*)())(*syscall_bc);
  return syscall((param), (0), 0, (10));
  ;
}


x86 assembly (clang, -O0):
<gdc_change_data_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x8c0000bc,%eax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%r8
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
mov    $0xa,%ecx
mov    %edx,%esi
mov    $0x0,%al
call   *%r8
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gdc_change_data_type>:
mov    $0x8c0000bc,%eax
mov    (%rax),%r8d
xor    %esi,%esi
xor    %edx,%edx
mov    $0xa,%ecx
xor    %eax,%eax
jmp    *%r8

LLVM IR (-O0):
define i32 @gdc_change_data_type(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32 (...)*
store i8* %0, i8** %2
store i32* inttoptr (i64 2348810428 to i32*), i32** %3
%5 = load i32*, i32** %3
%6 = load i32, i32* %5
%7 = zext i32 %6 to i64
%8 = inttoptr i64 %7 to i32 (...)*
store i32 (...)* %8, i32 (...)** %4
%9 = load i32 (...)*, i32 (...)** %4
%10 = load i8*, i8** %2
%11 = bitcast i32 (...)* %9 to i32 (i8*, i32, i32, i32, ...)*
%12 = call i32 (i8*, i32, i32, i32, ...) %11(i8* %10, i32 0, i32 0, i32 10)
ret i32 %12
}

LLVM IR (-O2):
define i32 @gdc_change_data_type(i8* %0) {
%2 = load i32, i32* inttoptr (i64 2348810428 to i32*)
%3 = zext i32 %2 to i64
%4 = inttoptr i64 %3 to i32 (i8*, i32, i32, i32, ...)*
%5 = tail call i32 (i8*, i32, i32, i32, ...) %4(i8* %0, i32 0, i32 0, i32 10)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ __NR_setns;
scalar_t__ syscall(int /*<<< orphan*/, int, int);
int xsetns(int fd, int nstype) {
  int ret = (int)syscall(__NR_setns, fd, nstype);
  if (ret == -1) {
    ;
  }
  return ret;
}


x86 assembly (clang, -O0):
<xsetns>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2ebb(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1030 <syscall@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1144 <xsetns+0x34>
jmp    1144 <xsetns+0x34>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xsetns>:
mov    %esi,%edx
mov    %edi,%esi
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
@__NR_setns = global i32 0
define i32 @xsetns(i32 %0, i32 %1) {
%3 = load i32, i32* @__NR_setns
%4 = tail call i64 @syscall(i32 %3, i32 %0, i32 %1)
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Type definitions */
struct aFILE {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _get_actual_fp(struct aFILE *);
int feof(int /*<<< orphan*/);
int my_feof(struct aFILE *fp) { return feof(_get_actual_fp(fp)); }


x86 assembly (clang, -O0):
<my_feof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <_get_actual_fp@plt>
mov    %eax,%edi
call   1040 <feof@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_feof>:
push   %rax
call   1030 <_get_actual_fp@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <feof@plt>

LLVM IR (-O0):
%struct.aFILE = type { i32 }
define i32 @my_feof(%struct.aFILE* %0) {
%2 = alloca %struct.aFILE*
store %struct.aFILE* %0, %struct.aFILE** %2
%3 = load %struct.aFILE*, %struct.aFILE** %2
%4 = call i32 @_get_actual_fp(%struct.aFILE* %3)
%5 = call i32 @feof(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
%struct.aFILE = type { i32 }
define i32 @my_feof(%struct.aFILE* %0) {
%2 = tail call i32 @_get_actual_fp(%struct.aFILE* %0)
%3 = tail call i32 @feof(i32 %2)
ret i32 %3
}
/* Variables and functions */
double fmod(double, double);
double _mod(double a1, double a2) { return fmod(a1, a2); }


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

x86 assembly (clang, -O2):
<_mod>:
jmp    1030 <fmod@plt>

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

LLVM IR (-O2):
define double @_mod(double %0, double %1) {
%3 = tail call double @fmod(double %0, double %1)
ret double %3
}
int roundUpToPowerOf2(int n) {
  int k = (sizeof(int) * 8 - 1) - __builtin_clz(n);
  if ((n & (n - 1)) != 0)
    ++k;
  return 1 << k;
}


x86 assembly (clang, -O0):
<roundUpToPowerOf2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
bsr    %eax,%eax
xor    $0x1f,%eax
movslq %eax,%rcx
mov    $0x1f,%eax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     113b <roundUpToPowerOf2+0x3b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<roundUpToPowerOf2>:
bsr    %edi,%eax
mov    %eax,%ecx
xor    $0x1f,%ecx
lea    -0x1(%rdi),%esi
mov    $0x20,%dl
sub    %cl,%dl
test   %esi,%edi
movzbl %dl,%ecx
cmove  %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
ret

LLVM IR (-O0):
define i32 @roundUpToPowerOf2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @llvm.ctlz.i32(i32 %4, i1 true)
%6 = sext i32 %5 to i64
%7 = sub i64 31, %6
%8 = trunc i64 %7 to i32
store i32 %8, i32* %3
%9 = load i32, i32* %2
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 1
%12 = and i32 %9, %11
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %1
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %17
17: ; preds = %14, %1
%18 = load i32, i32* %3
%19 = shl i32 1, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @roundUpToPowerOf2(i32 %0) {
%2 = tail call i32 @llvm.ctlz.i32(i32 %0, i1 true)
%3 = xor i32 %2, 31
%4 = tail call i32 @llvm.ctpop.i32(i32 %0)
%5 = icmp ult i32 %4, 2
%6 = sub nuw nsw i32 32, %2
%7 = select i1 %5, i32 %3, i32 %6
%8 = shl nuw i32 1, %7
ret i32 %8
}
void posix_class2P_WORD() {}


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

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

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

LLVM IR (-O2):
define void @posix_class2P_WORD() {
ret void
}
int unice68_ice_version(void) { return 240; }


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

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

LLVM IR (-O0):
define i32 @unice68_ice_version() {
ret i32 240
}

LLVM IR (-O2):
define i32 @unice68_ice_version() {
ret i32 240
}
void NCONF_load_bio(void) {}


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

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

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

LLVM IR (-O2):
define void @NCONF_load_bio() {
ret void
}
/* Variables and functions */
char *malloc(size_t);
size_t strlen(char const *);
int /*<<< orphan*/ strncpy(char *, char const *, size_t);
char *strucpy(const char *str) {
  size_t len = strlen(str);
  char *copy = malloc(len + 1);
  strncpy(copy, str, len + 1);
  return copy;
}


x86 assembly (clang, -O0):
<strucpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
add    $0x1,%rdx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strucpy>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%r15
mov    %r15,%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <strncpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strucpy(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = add i64 %7, 1
%9 = call i8* @malloc(i64 %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = load i8*, i8** %2
%12 = load i64, i64* %3
%13 = add i64 %12, 1
%14 = call i32 @strncpy(i8* %10, i8* %11, i64 %13)
%15 = load i8*, i8** %4
ret i8* %15
}

LLVM IR (-O2):
define i8* @strucpy(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = tail call i32 @strncpy(i8* %4, i8* %0, i64 %3)
ret i8* %4
}
void ff_hevc_put_hevc_uni_w_epel_h48_10_sse4() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ cpu_to_le64(int /*<<< orphan*/);
__u64 le64_to_cpu(__u64 val) { return cpu_to_le64(val); }


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

x86 assembly (clang, -O2):
<le64_to_cpu>:
jmp    1030 <cpu_to_le64@plt>

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

LLVM IR (-O2):
define i32 @le64_to_cpu(i32 %0) {
%2 = tail call i32 @cpu_to_le64(i32 %0)
ret i32 %2
}
unsigned long gidz_cube(int k, int j, int i, unsigned ext) {
  return ext * ext * k + ext * j + i;
}


x86 assembly (clang, -O0):
<gidz_cube>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
imul   -0x4(%rbp),%eax
mov    -0x10(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    %ecx,%eax
add    -0xc(%rbp),%eax
mov    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gidz_cube>:
imul   %ecx,%edi
lea    (%rdi,%rsi,1),%eax
imul   %ecx,%eax
add    %edx,%eax
ret

LLVM IR (-O0):
define i64 @gidz_cube(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %8
%10 = load i32, i32* %8
%11 = mul i32 %9, %10
%12 = load i32, i32* %5
%13 = mul i32 %11, %12
%14 = load i32, i32* %8
%15 = load i32, i32* %6
%16 = mul i32 %14, %15
%17 = add i32 %13, %16
%18 = load i32, i32* %7
%19 = add i32 %17, %18
%20 = zext i32 %19 to i64
ret i64 %20
}

LLVM IR (-O2):
define i64 @gidz_cube(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = mul i32 %3, %0
%6 = add i32 %5, %1
%7 = mul i32 %6, %3
%8 = add i32 %7, %2
%9 = zext i32 %8 to i64
ret i64 %9
}
/* Variables and functions */
int /*<<< orphan*/ capush(char);
void ungetch(char ch) { capush(ch); }


x86 assembly (clang, -O0):
<ungetch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <capush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ungetch>:
jmp    1030 <capush@plt>

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

LLVM IR (-O2):
define void @ungetch(i8 signext %0) {
%2 = tail call i32 @capush(i8 signext %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _SC_PAGE_SIZE;
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ sysconf(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  printf("_SC_PAGE_SIZE is  %ld.\n", sysconf(_SC_PAGE_SIZE));
  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    0x2ea3(%rip),%rax
mov    (%rax),%edi
call   1040 <sysconf@plt>
mov    %eax,%esi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [24 x i8] c"_SC_PAGE_SIZE is %ld.\0A\00"
@_SC_PAGE_SIZE = global i32 0
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 = load i32, i32* @_SC_PAGE_SIZE
%7 = call i32 @sysconf(i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"_SC_PAGE_SIZE is %ld.\0A\00"
@_SC_PAGE_SIZE = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @_SC_PAGE_SIZE
%4 = tail call i32 @sysconf(i32 %3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int a, b;
  int *foo;
  foo = &a;
  *foo = 20;
  foo = &b;
  *foo = 30;
  printf("%d %d\n", a, b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x14,(%rax)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x1e,(%rax)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 20, i32 30)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int print_tree(const void *data) {
  puts((char *)data);
  return 1;
}


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

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

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

LLVM IR (-O2):
define i32 @print_tree(i8* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) %0)
ret i32 1
}
/* Variables and functions */
int O_CLOEXEC;
int O_CREAT;
int O_NOCTTY;
int O_WRONLY;
int /*<<< orphan*/ close(int);
int open(char *, int, int);
void touch_run_ostree(void) {
  int fd = open("/run/ostree-booted", O_CREAT | O_WRONLY | O_NOCTTY | O_CLOEXEC,
                0640);
  if (fd == -1)
    return;
  (void)close(fd);
}


x86 assembly (clang, -O0):
<touch_run_ostree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
mov    0x2e90(%rip),%rax
or     (%rax),%esi
mov    0x2e97(%rip),%rax
or     (%rax),%esi
mov    0x2e76(%rip),%rax
or     (%rax),%esi
lea    0xead(%rip),%rdi
mov    $0x1a0,%edx
call   1040 <open@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    116f <touch_run_ostree+0x4f>
jmp    1177 <touch_run_ostree+0x57>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<touch_run_ostree>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    0x2e99(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2e9e(%rip),%rax
or     (%rax),%esi
mov    0x2e7d(%rip),%rax
or     (%rax),%esi
lea    0xeb4(%rip),%rdi
mov    $0x1a0,%edx
call   1040 <open@plt>
cmp    $0xffffffff,%eax
je     1163 <touch_run_ostree+0x43>
mov    %eax,%edi
pop    %rax
jmp    1030 <close@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [19 x i8] c"/run/ostree-booted\00"
@O_CREAT = global i32 0
@O_WRONLY = global i32 0
@O_NOCTTY = global i32 0
@O_CLOEXEC = global i32 0
define void @touch_run_ostree() {
%1 = alloca i32
%2 = load i32, i32* @O_CREAT
%3 = load i32, i32* @O_WRONLY
%4 = or i32 %2, %3
%5 = load i32, i32* @O_NOCTTY
%6 = or i32 %4, %5
%7 = load i32, i32* @O_CLOEXEC
%8 = or i32 %6, %7
%9 = call i32 @open(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %8, i32 416)
store i32 %9, i32* %1
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %13
12: ; preds = %0
br label %16
13: ; preds = %0
%14 = load i32, i32* %1
%15 = call i32 @close(i32 %14)
br label %16
16: ; preds = %13, %12
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"/run/ostree-booted\00"
@O_CREAT = global i32 0
@O_WRONLY = global i32 0
@O_NOCTTY = global i32 0
@O_CLOEXEC = global i32 0
define void @touch_run_ostree() {
%1 = load i32, i32* @O_CREAT
%2 = load i32, i32* @O_WRONLY
%3 = or i32 %2, %1
%4 = load i32, i32* @O_NOCTTY
%5 = or i32 %3, %4
%6 = load i32, i32* @O_CLOEXEC
%7 = or i32 %5, %6
%8 = tail call i32 @open(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %7, i32 416)
%9 = icmp eq i32 %8, -1
br i1 %9, label %12, label %10
10: ; preds = %0
%11 = tail call i32 @close(i32 %8)
br label %12
12: ; preds = %0, %10
ret void
}
char FindMax(char sz[]) {
  int i = 0;
  char iMax;
  iMax = sz[0];
  for (i = 1; sz[i] != '\0'; ++i) {
    if (sz[i] > iMax) {
      iMax = sz[i];
    }
  }
  return iMax;
}


x86 assembly (clang, -O0):
<FindMax>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0xd(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     116d <FindMax+0x6d>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0xd(%rbp),%ecx
cmp    %ecx,%eax
jle    115a <FindMax+0x5a>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0xd(%rbp)
jmp    115f <FindMax+0x5f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    111f <FindMax+0x1f>
movsbl -0xd(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FindMax>:
mov    (%rdi),%al
mov    0x1(%rdi),%cl
test   %cl,%cl
je     1126 <FindMax+0x26>
add    $0x2,%rdi
nopl   (%rax)
cmp    %al,%cl
movzbl %cl,%ecx
movzbl %al,%eax
cmovg  %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <FindMax+0x10>
ret

LLVM IR (-O0):
define signext i8 @FindMax(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8
store i8* %0, i8** %2
store i32 0, i32* %3
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
store i8 %7, i8* %4
store i32 1, i32* %3
br label %8
8: ; preds = %33, %1
%9 = load i8*, i8** %2
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %36
16: ; preds = %8
%17 = load i8*, i8** %2
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = load i8, i8* %4
%24 = sext i8 %23 to i32
%25 = icmp sgt i32 %22, %24
br i1 %25, label %26, label %32
26: ; preds = %16
%27 = load i8*, i8** %2
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
%31 = load i8, i8* %30
store i8 %31, i8* %4
br label %32
32: ; preds = %26, %16
br label %33
33: ; preds = %32
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %8
36: ; preds = %8
%37 = load i8, i8* %4
ret i8 %37
}

LLVM IR (-O2):
define signext i8 @FindMax(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %1, %6
%7 = phi i64 [ %12, %6 ], [ 1, %1 ]
%8 = phi i8 [ %14, %6 ], [ %4, %1 ]
%9 = phi i8 [ %11, %6 ], [ %2, %1 ]
%10 = icmp sgt i8 %8, %9
%11 = select i1 %10, i8 %8, i8 %9
%12 = add nuw nsw i64 %7, 1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %6
16: ; preds = %6, %1
%17 = phi i8 [ %2, %1 ], [ %11, %6 ]
ret i8 %17
}
int MemAddrHash32(void *addr) {
  struct uptr_addr {
    unsigned long val1 : 16;
    unsigned long val2 : 16;
  } *uladdr = (struct uptr_addr *)&addr;
  return (uladdr->val1 ^ uladdr->val2) & (1024 - 1);
}


x86 assembly (clang, -O0):
<MemAddrHash32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0xffff,%eax
mov    %eax,%eax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
shr    $0x10,%ecx
mov    %ecx,%ecx
xor    %ecx,%eax
and    $0x3ff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<MemAddrHash32>:
mov    %edi,%eax
shr    $0x10,%eax
xor    %edi,%eax
and    $0x3ff,%eax
ret

LLVM IR (-O0):
%struct.uptr_addr = type { i32, [4 x i8] }
define i32 @MemAddrHash32(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.uptr_addr*
store i8* %0, i8** %2
%4 = bitcast i8** %2 to %struct.uptr_addr*
store %struct.uptr_addr* %4, %struct.uptr_addr** %3
%5 = load %struct.uptr_addr*, %struct.uptr_addr** %3
%6 = bitcast %struct.uptr_addr* %5 to i32*
%7 = load i32, i32* %6
%8 = and i32 %7, 65535
%9 = zext i32 %8 to i64
%10 = trunc i64 %9 to i32
%11 = load %struct.uptr_addr*, %struct.uptr_addr** %3
%12 = bitcast %struct.uptr_addr* %11 to i32*
%13 = load i32, i32* %12
%14 = lshr i32 %13, 16
%15 = zext i32 %14 to i64
%16 = trunc i64 %15 to i32
%17 = xor i32 %10, %16
%18 = and i32 %17, 1023
ret i32 %18
}

LLVM IR (-O2):
%struct.uptr_addr = type { i32, [4 x i8] }
define i32 @MemAddrHash32(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = lshr i32 %3, 16
%5 = xor i32 %4, %3
%6 = and i32 %5, 1023
ret i32 %6
}
int leftChild(int *array, int i, int n) {
  if (2 * i + 1 < n) {
    return 2 * i + 1;
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<leftChild>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cmp    -0x18(%rbp),%eax
jge    1131 <leftChild+0x31>
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1138 <leftChild+0x38>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<leftChild>:
lea    (%rsi,%rsi,1),%ecx
add    $0x1,%ecx
cmp    %edx,%ecx
mov    $0xffffffff,%eax
cmovl  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @leftChild(i32* nocapture readnone %0, i32 %1, i32 %2) {
%4 = shl nsw i32 %1, 1
%5 = or i32 %4, 1
%6 = icmp slt i32 %5, %2
%7 = select i1 %6, i32 %5, i32 -1
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ toupper(char);
char *strtoupper(char *dest, const char *src) {
  char ch;
  char *begin = dest;
  while ((ch = *src)) {
    *dest++ = toupper(ch);
    src++;
  }
  *dest = 0;
  return begin;
}


x86 assembly (clang, -O0):
<strtoupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
cmp    $0x0,%al
je     1166 <strtoupper+0x56>
movsbl -0x11(%rbp),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1128 <strtoupper+0x18>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtoupper>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    (%rsi),%al
mov    %rdi,%rbx
test   %al,%al
je     114a <strtoupper+0x3a>
mov    %rsi,%r15
add    $0x1,%r15
mov    %r14,%rbx
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %al,(%rbx)
add    $0x1,%rbx
movzbl (%r15),%eax
add    $0x1,%r15
test   %al,%al
jne    1130 <strtoupper+0x20>
movb   $0x0,(%rbx)
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @strtoupper(i8* returned writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i8* [ %11, %5 ], [ %0, %2 ]
%8 = phi i8* [ %12, %5 ], [ %1, %2 ]
%9 = tail call i32 @toupper(i8 signext %6)
%10 = trunc i32 %9 to i8
%11 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %10, i8* %7
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i8* [ %0, %2 ], [ %11, %5 ]
store i8 0, i8* %16
ret i8* %0
}
void INT_Excep_MTU5_TGIW5(void) {}


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

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

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

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

/* Variables and functions */
int safe_atoi(char const *, int *);
int safe_atoi32(const char *s, int32_t *ret_i) {
  struct _assert_struct_9 {
    char x[(sizeof(int32_t) == sizeof(int)) ? 0 : -1];
  };
  return safe_atoi(s, (int *)ret_i);
}


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

x86 assembly (clang, -O2):
<safe_atoi32>:
jmp    1030 <safe_atoi@plt>

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

LLVM IR (-O2):
define i32 @safe_atoi32(i8* %0, i32* %1) {
%3 = tail call i32 @safe_atoi(i8* %0, i32* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ myfree(int *);
int *mymalloc(int);
int /*<<< orphan*/ printf(char *);
int main() {
  int *p = mymalloc(32);
  printf("=============\n");
  myfree(p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x20,%edi
call   1040 <mymalloc@plt>
mov    %rax,-0x10(%rbp)
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <myfree@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x20,%edi
call   1040 <mymalloc@plt>
mov    %rax,%rbx
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <myfree@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@str = [14 x i8] c"=============\00"
define i32 @main() {
%1 = tail call i32* @mymalloc(i32 32)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @myfree(i32* %1)
ret i32 0
}
void setdir(void) {}


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

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

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

LLVM IR (-O2):
define void @setdir() {
ret void
}
/* Variables and functions */
double exp(double);
double log(double);
double ascender(double tx) {
  double oct = tx / 16.0;
  if (oct < 10.0)
    return exp(oct * log(2.0));
  else
    return 0.0;
}


x86 assembly (clang, -O0):
<ascender>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xece(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xeb5(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1188 <ascender+0x68>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xea8(%rip),%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1190 <ascender+0x70>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ascender>:
mulsd  0xee8(%rip),%xmm0
movsd  0xee8(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1133 <ascender+0x23>
mulsd  0xee2(%rip),%xmm0
jmp    1030 <exp@plt>
xorpd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @ascender(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %3
%5 = load double, double* %3
%6 = fdiv double %5, 1.600000e+01
store double %6, double* %4
%7 = load double, double* %4
%8 = fcmp olt double %7, 1.000000e+01
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load double, double* %4
%11 = call double @log(double 2.000000e+00)
%12 = fmul double %10, %11
%13 = call double @exp(double %12)
store double %13, double* %2
br label %15
14: ; preds = %1
store double 0.000000e+00, double* %2
br label %15
15: ; preds = %14, %9
%16 = load double, double* %2
ret double %16
}

LLVM IR (-O2):
define double @ascender(double %0) {
%2 = fmul double %0, 6.250000e-02
%3 = fcmp olt double %2, 1.000000e+01
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = fmul double %2, 0x3FE62E42FEFA39EF
%6 = tail call double @exp(double %5)
br label %7
7: ; preds = %1, %4
%8 = phi double [ %6, %4 ], [ 0.000000e+00, %1 ]
ret double %8
}
char *Getstr(id, cpp)
char *id, **cpp;
{ return (0); }


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

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

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

LLVM IR (-O2):
define noalias i8* @Getstr(i8* nocapture readnone %0, i8** nocapture readnone %1) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char const *const, int);
void ft_putendl(const char *const str) {
  unsigned int len;
  len = 0;
  while (str[len] != '\0')
    len++;
  write(1, str, len);
  write(1, "\n", 1);
}


x86 assembly (clang, -O0):
<ft_putendl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1145 <ft_putendl+0x35>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <ft_putendl+0x13>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    $0x1,%edi
call   1030 <write@plt>
mov    $0x1,%edx
lea    0xe9e(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putendl>:
push   %rax
mov    %rdi,%rsi
mov    $0xffffffff,%edx
nopl   0x0(%rax)
add    $0x1,%edx
cmpb   $0x0,(%rsi,%rdx,1)
jne    1120 <ft_putendl+0x10>
mov    $0x1,%edi
call   1030 <write@plt>
lea    0xec6(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
pop    %rax
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @ft_putendl(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %1
%5 = load i8*, i8** %2
%6 = load i32, i32* %3
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %4
%13 = load i32, i32* %3
%14 = add i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
%16 = load i8*, i8** %2
%17 = load i32, i32* %3
%18 = call i32 @write(i32 1, i8* %16, i32 %17)
%19 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define void @ft_putendl(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 0, %1 ], [ %8, %2 ]
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = add i32 %3, 1
br i1 %7, label %9, label %2
9: ; preds = %2
%10 = tail call i32 @write(i32 1, i8* %0, i32 %3)
%11 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
/* Variables and functions */
int SEGGER_RTT_WaitKey();
int __getchar() { return SEGGER_RTT_WaitKey(); }


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

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

LLVM IR (-O0):
define i32 @__getchar() {
%1 = call i32 (...) @SEGGER_RTT_WaitKey()
ret i32 %1
}

LLVM IR (-O2):
define i32 @__getchar() {
%1 = tail call i32 (...) @SEGGER_RTT_WaitKey()
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ ReadWord(char *, int /*<<< orphan*/ *);
int SearchVocab(char *);
scalar_t__ feof(int /*<<< orphan*/ *);
int ReadWordIndex(FILE *fin) {
  char word[100];
  ReadWord(word, fin);
  if (feof(fin)) {
    return -1;
  }
  return SearchVocab(word);
}


x86 assembly (clang, -O0):
<ReadWordIndex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <ReadWord@plt>
mov    -0x10(%rbp),%rdi
call   1030 <feof@plt>
cmp    $0x0,%rax
je     116b <ReadWordIndex+0x3b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1177 <ReadWordIndex+0x47>
lea    -0x80(%rbp),%rdi
call   1050 <SearchVocab@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadWordIndex>:
push   %rbx
sub    $0x70,%rsp
mov    %rdi,%rbx
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1040 <ReadWord@plt>
mov    %rbx,%rdi
call   1030 <feof@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    1160 <ReadWordIndex+0x30>
mov    %rsp,%rdi
call   1050 <SearchVocab@plt>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ReadWordIndex(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca [100 x i8]
store i32* %0, i32** %3
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%6 = load i32*, i32** %3
%7 = call i32 @ReadWord(i8* %5, i32* %6)
%8 = load i32*, i32** %3
%9 = call i64 @feof(i32* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 -1, i32* %2
br label %15
12: ; preds = %1
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%14 = call i32 @SearchVocab(i8* %13)
store i32 %14, i32* %2
br label %15
15: ; preds = %12, %11
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @ReadWordIndex(i32* %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = call i32 @ReadWord(i8* %3, i32* %0)
%5 = call i64 @feof(i32* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @SearchVocab(i8* %3)
br label %9
9: ; preds = %1, %7
%10 = phi i32 [ %8, %7 ], [ -1, %1 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ SV_Shutdown(char *);
void SV_KillServer_f(void) { SV_Shutdown("killserver"); }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"killserver\00"
define void @SV_KillServer_f() {
%1 = call i32 @SV_Shutdown(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"killserver\00"
define void @SV_KillServer_f() {
%1 = tail call i32 @SV_Shutdown(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free_movelist();
void free_resources(void) { free_movelist(); }


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

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

LLVM IR (-O0):
define void @free_resources() {
%1 = call i32 (...) @free_movelist()
ret void
}

LLVM IR (-O2):
define void @free_resources() {
%1 = tail call i32 (...) @free_movelist()
ret void
}
/* Variables and functions */
bool direction_is_valid(unsigned direction) {
  return direction < 360 && 0 == direction % 45;
}


x86 assembly (clang, -O0):
<direction_is_valid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x168,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jae    112f <direction_is_valid+0x2f>
mov    -0x4(%rbp),%eax
mov    $0x2d,%ecx
xor    %edx,%edx
div    %ecx
xor    %eax,%eax
cmp    %edx,%eax
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<direction_is_valid>:
xor    %eax,%eax
cmp    $0x167,%edi
ja     111e <direction_is_valid+0x1e>
imul   $0x4fa5,%edi,%eax
movzwl %ax,%ecx
xor    %eax,%eax
cmp    $0x5b1,%ecx
setb   %al
ret

LLVM IR (-O0):
define i32 @direction_is_valid(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ult i32 %3, 360
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i32, i32* %2
%7 = urem i32 %6, 45
%8 = icmp eq i32 0, %7
br label %9
9: ; preds = %5, %1
%10 = phi i1 [ false, %1 ], [ %8, %5 ]
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @direction_is_valid(i32 %0) {
%2 = icmp ult i32 %0, 360
br i1 %2, label %3, label %8
3: ; preds = %1
%4 = trunc i32 %0 to i16
%5 = urem i16 %4, 45
%6 = icmp eq i16 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %3, %1
%9 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %9
}