xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ SetScl(int /*<<< orphan*/);
int /*<<< orphan*/ SetSda(int /*<<< orphan*/);
void StartCond(void) {
  SetSda(0);
  SetScl(0);
}


x86 assembly (clang, -O0):
<StartCond>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <SetSda@plt>
xor    %edi,%edi
call   1040 <SetScl@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<StartCond>:
push   %rax
xor    %edi,%edi
call   1030 <SetSda@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <SetScl@plt>

LLVM IR (-O0):
define void @StartCond() {
%1 = call i32 @SetSda(i32 0)
%2 = call i32 @SetScl(i32 0)
ret void
}

LLVM IR (-O2):
define void @StartCond() {
%1 = tail call i32 @SetSda(i32 0)
%2 = tail call i32 @SetScl(i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void routine() { puts("This is ROUTINE\n"); }


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"This is ROUTINE\0A\00"
define void @routine() {
%1 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"This is ROUTINE\0A\00"
define void @routine() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}
void view_exit(void) {}


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

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

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

LLVM IR (-O2):
define void @view_exit() {
ret void
}
void *data_to_pointer(const unsigned char const *data) {
  void *result;
  result = (void *)(*(unsigned long *)data);
  return result;
}


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

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

LLVM IR (-O0):
define i8* @data_to_pointer(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i64*
%6 = load i64, i64* %5
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %3
%8 = load i8*, i8** %3
ret i8* %8
}

LLVM IR (-O2):
define i8* @data_to_pointer(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
int C_InitSettings(const char *name) {}


x86 assembly (clang, -O0):
<C_InitSettings>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @C_InitSettings(i8* nocapture readnone %0) {
ret i32 undef
}
/* Variables and functions */
scalar_t__ sqr(double);
double sqrt(scalar_t__);
double calc_hypotenuse(double base, double height) {
  return sqrt(sqr(base) + sqr(height));
}


x86 assembly (clang, -O0):
<calc_hypotenuse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sqr@plt>
mov    %rax,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <sqr@plt>
mov    -0x18(%rbp),%rdi
add    %rax,%rdi
call   1040 <sqrt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_hypotenuse>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm1,0x8(%rsp)
call   1030 <sqr@plt>
mov    %rax,%rbx
movsd  0x8(%rsp),%xmm0
call   1030 <sqr@plt>
add    %rax,%rbx
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1040 <sqrt@plt>

LLVM IR (-O0):
define double @calc_hypotenuse(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 = call i64 @sqr(double %5)
%7 = load double, double* %4
%8 = call i64 @sqr(double %7)
%9 = add nsw i64 %6, %8
%10 = call double @sqrt(i64 %9)
ret double %10
}

LLVM IR (-O2):
define double @calc_hypotenuse(double %0, double %1) {
%3 = tail call i64 @sqr(double %0)
%4 = tail call i64 @sqr(double %1)
%5 = add nsw i64 %4, %3
%6 = tail call double @sqrt(i64 %5)
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int soma_alga(int);
int main(void) {
  int num;
  printf("Informe o número: ");
  scanf("%d", &num);
  printf("O resultado da soma dos algarismos é %d\n", soma_alga(num));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1030 <soma_alga@plt>
mov    %eax,%esi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xece(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1030 <soma_alga@plt>
lea    0xeb7(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Informe o n\C3\BAmero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [42 x i8] c"O resultado da soma dos algarismos \C3\A9 %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = call i32 @soma_alga(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Informe o n\C3\BAmero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [42 x i8] c"O resultado da soma dos algarismos \C3\A9 %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @soma_alga(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}
void foo713(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo713(i32 %0) {
ret void
}
void dummy_func(void) {
  __asm__(".ifndef main\n.global main\n.set main, _main\n.endif");
  __asm__(".ifndef used_func\n.global used_func\n.set used_func, "
          "_used_func\n.endif");
}


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

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

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

LLVM IR (-O2):
define void @dummy_func() {
tail call void asm sideeffect ".ifndef main\0A.global main\0A.set main, _main\0A.endif", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect ".ifndef used_func\0A.global used_func\0A.set used_func, _used_func\0A.endif", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Ptngc_comp_huff_compress_verbose(unsigned int *, int const,
                                                    unsigned char *, int *,
                                                    int *, int *, int *,
                                                    int /*<<< orphan*/);
void Ptngc_comp_huff_compress(unsigned int *vals, const int nvals,
                              unsigned char *huffman, int *huffman_len) {
  int huffman_lengths[3];
  int algo = -1;
  int huffdatalen;
  Ptngc_comp_huff_compress_verbose(vals, nvals, huffman, huffman_len,
                                   &huffdatalen, huffman_lengths, &algo, 0);
}


x86 assembly (clang, -O0):
<Ptngc_comp_huff_compress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0xffffffff,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    -0x2c(%rbp),%r9
lea    -0x34(%rbp),%r8
lea    -0x30(%rbp),%rax
xor    %r10d,%r10d
mov    %rax,(%rsp)
movl   $0x0,0x8(%rsp)
call   1030 <Ptngc_comp_huff_compress_verbose@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Ptngc_comp_huff_compress>:
sub    $0x18,%rsp
movl   $0xffffffff,0x4(%rsp)
ff
lea    0x4(%rsp),%rax
lea    0x8(%rsp),%r8
lea    0xc(%rsp),%r9
push   $0x0
push   %rax
call   1030 <Ptngc_comp_huff_compress_verbose@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define void @Ptngc_comp_huff_compress(i32* %0, i32 %1, i8* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca [3 x i32]
%10 = alloca i32
%11 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32* %3, i32** %8
store i32 -1, i32* %10
%12 = load i32*, i32** %5
%13 = load i32, i32* %6
%14 = load i8*, i8** %7
%15 = load i32*, i32** %8
%16 = getelementptr inbounds [3 x i32], [3 x i32]* %9, i64 0, i64 0
%17 = call i32 @Ptngc_comp_huff_compress_verbose(i32* %12, i32 %13, i8* %14, i32* %15, i32* %11, i32* %16, i32* %10, i32 0)
ret void
}

LLVM IR (-O2):
define void @Ptngc_comp_huff_compress(i32* %0, i32 %1, i8* %2, i32* %3) {
%5 = alloca [3 x i32]
%6 = alloca i32
%7 = alloca i32
%8 = bitcast [3 x i32]* %5 to i8*
%9 = bitcast i32* %6 to i8*
store i32 -1, i32* %6
%10 = bitcast i32* %7 to i8*
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
%12 = call i32 @Ptngc_comp_huff_compress_verbose(i32* %0, i32 %1, i8* %2, i32* %3, i32* %7, i32* %11, i32* %6, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ puts(char const *);
void die(const char *message) {
  puts(message);
  exit(1);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @die(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @puts(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @die(i8* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ scanf(char *, char *);
void Reverse() {
  char c;
  scanf("%c", &c);
  if (c != '\n') {
    Reverse();
    printf("%c", c);
  }
}


x86 assembly (clang, -O0):
<Reverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
je     116a <Reverse+0x3a>
call   1050 <Reverse@plt>
lea    0xe9f(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Reverse>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <scanf@plt>
cmpb   $0xa,0x7(%rsp)
je     115f <Reverse+0x2f>
call   1050 <Reverse@plt>
movsbl 0x7(%rsp),%esi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
pop    %rax
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @Reverse() {
%1 = alloca i8
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 10
br i1 %4, label %8, label %5
5: ; preds = %0
%6 = load i8, i8* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %6)
br label %8
8: ; preds = %5, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void help() {
  printf("  -b x    Write x bytes (default 1024)\n");
  printf("  -n f    Write to file f (default \"testfile\")\n");
  printf("  -d      Delete the created file(s)\n");
  printf("  -q      Suppress info messages\n");
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
lea    0xf01(%rip),%rdi
call   1030 <printf@plt>
lea    0xf25(%rip),%rdi
call   1030 <printf@plt>
lea    0xf3f(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf03(%rip),%rdi
call   1030 <puts@plt>
lea    0xf26(%rip),%rdi
call   1030 <puts@plt>
lea    0xf3f(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [40 x i8] c" -b x Write x bytes (default 1024)\0A\00"
@.str.1 = [48 x i8] c" -n f Write to file f (default \22testfile\22)\0A\00"
@.str.2 = [38 x i8] c" -d Delete the created file(s)\0A\00"
@.str.3 = [34 x i8] c" -q Suppress info messages\0A\00"
define void @help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [39 x i8] c" -b x Write x bytes (default 1024)\00"
@str.4 = [47 x i8] c" -n f Write to file f (default \22testfile\22)\00"
@str.5 = [37 x i8] c" -d Delete the created file(s)\00"
@str.6 = [33 x i8] c" -q Suppress info messages\00"
define void @help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.6, i64 0, i64 0))
ret void
}
void fb_hSoftCursor_code_end(void) {}


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

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

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

LLVM IR (-O2):
define void @fb_hSoftCursor_code_end() {
ret void
}
long *IncomePlus(long *pPay) {
  *pPay += 10000L;
  return pPay;
}


x86 assembly (clang, -O0):
<IncomePlus>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x2710,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IncomePlus>:
mov    %rdi,%rax
addq   $0x2710,(%rdi)
ret

LLVM IR (-O0):
define i64* @IncomePlus(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = add nsw i64 %4, 10000
store i64 %5, i64* %3
%6 = load i64*, i64** %2
ret i64* %6
}

LLVM IR (-O2):
define i64* @IncomePlus(i64* returned %0) {
%2 = load i64, i64* %0
%3 = add nsw i64 %2, 10000
store i64 %3, i64* %0
ret i64* %0
}
/* Type definitions */
struct variable {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ isroot(struct variable *);
int getrank(struct variable *v) {
  assert(isroot(v));
  return (int)(uintptr_t)v;
}


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

x86 assembly (clang, -O2):
<getrank>:
push   %rbx
mov    %rdi,%rbx
call   1040 <isroot@plt>
mov    %eax,%edi
call   1030 <assert@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.variable = type { i32 }
define i32 @getrank(%struct.variable* %0) {
%2 = alloca %struct.variable*
store %struct.variable* %0, %struct.variable** %2
%3 = load %struct.variable*, %struct.variable** %2
%4 = call i32 @isroot(%struct.variable* %3)
%5 = call i32 @assert(i32 %4)
%6 = load %struct.variable*, %struct.variable** %2
%7 = ptrtoint %struct.variable* %6 to i64
%8 = trunc i64 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
%struct.variable = type { i32 }
define i32 @getrank(%struct.variable* %0) {
%2 = tail call i32 @isroot(%struct.variable* %0)
%3 = tail call i32 @assert(i32 %2)
%4 = ptrtoint %struct.variable* %0 to i64
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Variables and functions */
int RAND_MAX;
int rand();
int irand(int n) { return rand() / (RAND_MAX / n + 1); }


x86 assembly (clang, -O0):
<irand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ebc(%rip),%rax
mov    (%rax),%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    $0x1,%ecx
cltd
idiv   %ecx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irand>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%ecx
mov    0x2ec5(%rip),%rax
mov    (%rax),%eax
cltd
idiv   %ebx
mov    %eax,%esi
add    $0x1,%esi
mov    %ecx,%eax
cltd
idiv   %esi
pop    %rbx
ret

LLVM IR (-O0):
@RAND_MAX = global i32 0
define i32 @irand(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rand()
%4 = load i32, i32* @RAND_MAX
%5 = load i32, i32* %2
%6 = sdiv i32 %4, %5
%7 = add nsw i32 %6, 1
%8 = sdiv i32 %3, %7
ret i32 %8
}

LLVM IR (-O2):
@RAND_MAX = global i32 0
define i32 @irand(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = load i32, i32* @RAND_MAX
%4 = sdiv i32 %3, %0
%5 = add nsw i32 %4, 1
%6 = sdiv i32 %2, %5
ret i32 %6
}
int num_default_datadir() { return 3 - 1; }


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

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

LLVM IR (-O0):
define i32 @num_default_datadir() {
ret i32 2
}

LLVM IR (-O2):
define i32 @num_default_datadir() {
ret i32 2
}
/* Variables and functions */
size_t __attribute__((pure)) string_hash(const char *str) {
  size_t hash = 0;
  if (str)
    while (*str != '\0')
      hash = hash * 31 + (size_t)(unsigned char)*str++;
  return hash;
}


x86 assembly (clang, -O0):
<string_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1158 <string_hash+0x58>
jmp    1120 <string_hash+0x20>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1153 <string_hash+0x53>
imul   $0x1f,-0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movzbl (%rcx),%ecx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1120 <string_hash+0x20>
jmp    1158 <string_hash+0x58>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_hash>:
test   %rdi,%rdi
je     113c <string_hash+0x3c>
mov    (%rdi),%cl
test   %cl,%cl
je     113c <string_hash+0x3c>
add    $0x1,%rdi
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rax,%rdx
shl    $0x5,%rdx
sub    %rax,%rdx
movzbl %cl,%eax
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1120 <string_hash+0x20>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @string_hash(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %16, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %3, %6
%7 = phi i8 [ %14, %6 ], [ %4, %3 ]
%8 = phi i64 [ %13, %6 ], [ 0, %3 ]
%9 = phi i8* [ %11, %6 ], [ %0, %3 ]
%10 = mul i64 %8, 31
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = zext i8 %7 to i64
%13 = add i64 %10, %12
%14 = load i8, i8* %11
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %6
16: ; preds = %6, %3, %1
%17 = phi i64 [ 0, %1 ], [ 0, %3 ], [ %13, %6 ]
ret i64 %17
}
int isdigit(int c) { return (unsigned)c - '0' < 10; }


x86 assembly (clang, -O0):
<isdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x30,%eax
cmp    $0xa,%eax
setb   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isdigit>:
add    $0xffffffd0,%edi
xor    %eax,%eax
cmp    $0xa,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @isdigit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub i32 %3, 48
%5 = icmp ult i32 %4, 10
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @isdigit(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
int sys_lstat64(tcp)
struct tcb *tcp;
{
  return printargs(tcp);
}


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

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

LLVM IR (-O0):
%struct.tcb = type opaque
define i32 @sys_lstat64(%struct.tcb* %0) {
%2 = alloca %struct.tcb*
store %struct.tcb* %0, %struct.tcb** %2
%3 = load %struct.tcb*, %struct.tcb** %2
%4 = call i32 (%struct.tcb*, ...) bitcast (i32 (...)* @printargs to i32 (%struct.tcb*, ...)*)(%struct.tcb* %3)
ret i32 %4
}

LLVM IR (-O2):
%struct.tcb = type opaque
define i32 @sys_lstat64(%struct.tcb* %0) {
%2 = tail call i32 (%struct.tcb*, ...) bitcast (i32 (...)* @printargs to i32 (%struct.tcb*, ...)*)(%struct.tcb* %0)
ret i32 %2
}
/* Variables and functions */
double clock();
double Sys_DoubleTime(void) { return clock() / 1000.0; }


x86 assembly (clang, -O0):
<Sys_DoubleTime>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <clock@plt>
movsd  0xedd(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sys_DoubleTime>:
push   %rax
xor    %eax,%eax
call   1030 <clock@plt>
divsd  0xee0(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @Sys_DoubleTime() {
%1 = call double (...) @clock()
%2 = fdiv double %1, 1.000000e+03
ret double %2
}

LLVM IR (-O2):
define double @Sys_DoubleTime() {
%1 = tail call double (...) @clock()
%2 = fdiv double %1, 1.000000e+03
ret double %2
}
int sub4(unsigned long long i) {
  if (i > 0x7FFFFFFF)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<sub4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x7fffffff,-0x10(%rbp)
7f
jbe    1122 <sub4+0x22>
movl   $0x0,-0x4(%rbp)
jmp    1129 <sub4+0x29>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub4>:
xor    %eax,%eax
test   $0xffffffff80000000,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @sub4(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp ugt i64 %4, 2147483647
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %8
7: ; preds = %1
store i32 1, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @sub4(i64 %0) {
%2 = icmp ult i64 %0, 2147483648
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_message() { printf(" How do you do! \n"); }


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

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

LLVM IR (-O0):
@.str = [18 x i8] c" How do you do! \0A\00"
define void @print_message() {
%1 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [17 x i8] c" How do you do! \00"
define void @print_message() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
ret void
}
int Media_SetMute(int mute) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @Media_SetMute(i32 %0) {
ret i32 1
}
/* Variables and functions */
scalar_t__ is_abf_able(int);
int find_first_abfable(void) {
  int i = 0;
  for (i = 0; i < 81; i++) {
    if (is_abf_able(i)) {
      return (i);
    }
  }
  return (-1);
}


x86 assembly (clang, -O0):
<find_first_abfable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x51,-0x8(%rbp)
jge    1160 <find_first_abfable+0x50>
mov    -0x8(%rbp),%edi
call   1030 <is_abf_able@plt>
cmp    $0x0,%rax
je     114d <find_first_abfable+0x3d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1167 <find_first_abfable+0x57>
jmp    1152 <find_first_abfable+0x42>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <find_first_abfable+0x16>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_first_abfable>:
push   %rbx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1030 <is_abf_able@plt>
test   %rax,%rax
jne    1139 <find_first_abfable+0x29>
add    $0x1,%ebx
cmp    $0x51,%ebx
jne    1120 <find_first_abfable+0x10>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @find_first_abfable() {
br label %1
1: ; preds = %0, %5
%2 = phi i32 [ 0, %0 ], [ %6, %5 ]
%3 = tail call i64 @is_abf_able(i32 %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = add nuw nsw i32 %2, 1
%7 = icmp eq i32 %6, 81
br i1 %7, label %8, label %1
8: ; preds = %5, %1
%9 = phi i32 [ %2, %1 ], [ -1, %5 ]
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ PTRACE_SYSCALL;
int /*<<< orphan*/ ptrace(int /*<<< orphan*/, int /*<<< orphan*/,
                          int /*<<< orphan*/, int /*<<< orphan*/);
int wait_for_syscall(pid_t child) {
  while (1) {
    ptrace(PTRACE_SYSCALL, child, 0, 0);
  }
}


x86 assembly (clang, -O0):
<wait_for_syscall>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eb6(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <ptrace@plt>
jmp    111b <wait_for_syscall+0xb>

x86 assembly (clang, -O2):
<wait_for_syscall>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    0x2ebb(%rip),%r14
nopl   (%rax)
mov    (%r14),%edi
mov    %ebx,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <ptrace@plt>
jmp    1120 <wait_for_syscall+0x10>

LLVM IR (-O0):
@PTRACE_SYSCALL = global i32 0
define i32 @wait_for_syscall(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %1, %3
%4 = load i32, i32* @PTRACE_SYSCALL
%5 = load i32, i32* %2
%6 = call i32 @ptrace(i32 %4, i32 %5, i32 0, i32 0)
br label %3
}

LLVM IR (-O2):
@PTRACE_SYSCALL = global i32 0
define i32 @wait_for_syscall(i32 %0) {
br label %2
2: ; preds = %1, %2
%3 = load i32, i32* @PTRACE_SYSCALL
%4 = tail call i32 @ptrace(i32 %3, i32 %0, i32 0, i32 0)
br label %2
}
long read_size_integer(char bytes[]) {
  long total = 0;
  for (int i = 0; i < 4; ++i) {
    total += (bytes[i] & 0xFF) << (3 - i) * 8;
  }
  return total;
}


x86 assembly (clang, -O0):
<read_size_integer>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1157 <read_size_integer+0x57>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
and    $0xff,%eax
mov    $0x3,%ecx
sub    -0x14(%rbp),%ecx
shl    $0x3,%ecx
shl    %cl,%eax
cltq
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1117 <read_size_integer+0x17>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_size_integer>:
movzbl (%rdi),%eax
shl    $0x18,%eax
cltq
movzbl 0x1(%rdi),%ecx
shl    $0x10,%rcx
or     %rax,%rcx
movzbl 0x2(%rdi),%edx
shl    $0x8,%rdx
or     %rcx,%rdx
movzbl 0x3(%rdi),%eax
or     %rdx,%rax
ret

LLVM IR (-O0):
define i64 @read_size_integer(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
store i8* %0, i8** %2
store i64 0, i64* %3
store i32 0, i32* %4
br label %5
5: ; preds = %23, %1
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 4
br i1 %7, label %8, label %26
8: ; preds = %5
%9 = load i8*, i8** %2
%10 = load i32, i32* %4
%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 = and i32 %14, 255
%16 = load i32, i32* %4
%17 = sub nsw i32 3, %16
%18 = mul nsw i32 %17, 8
%19 = shl i32 %15, %18
%20 = sext i32 %19 to i64
%21 = load i64, i64* %3
%22 = add nsw i64 %21, %20
store i64 %22, i64* %3
br label %23
23: ; preds = %8
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %5
26: ; preds = %5
%27 = load i64, i64* %3
ret i64 %27
}

LLVM IR (-O2):
define i64 @read_size_integer(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = shl nuw i32 %3, 24
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = zext i8 %7 to i64
%9 = shl nuw nsw i64 %8, 16
%10 = or i64 %9, %5
%11 = getelementptr inbounds i8, i8* %0, i64 2
%12 = load i8, i8* %11
%13 = zext i8 %12 to i64
%14 = shl nuw nsw i64 %13, 8
%15 = or i64 %10, %14
%16 = getelementptr inbounds i8, i8* %0, i64 3
%17 = load i8, i8* %16
%18 = zext i8 %17 to i64
%19 = or i64 %15, %18
ret i64 %19
}
/* Type definitions */
struct stopwatch {
  int dummy;
};

/* Variables and functions */
int stopwatch_duration_usecs(struct stopwatch *);
long stopwatch_duration_msecs(struct stopwatch *sw) {
  return stopwatch_duration_usecs(sw) / (1000000 / 1000);
}


x86 assembly (clang, -O0):
<stopwatch_duration_msecs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <stopwatch_duration_usecs@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stopwatch_duration_msecs>:
push   %rax
call   1030 <stopwatch_duration_usecs@plt>
cltq
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
cltq
pop    %rcx
ret

LLVM IR (-O0):
%struct.stopwatch = type { i32 }
define i64 @stopwatch_duration_msecs(%struct.stopwatch* %0) {
%2 = alloca %struct.stopwatch*
store %struct.stopwatch* %0, %struct.stopwatch** %2
%3 = load %struct.stopwatch*, %struct.stopwatch** %2
%4 = call i32 @stopwatch_duration_usecs(%struct.stopwatch* %3)
%5 = sdiv i32 %4, 1000
%6 = sext i32 %5 to i64
ret i64 %6
}

LLVM IR (-O2):
%struct.stopwatch = type { i32 }
define i64 @stopwatch_duration_msecs(%struct.stopwatch* %0) {
%2 = tail call i32 @stopwatch_duration_usecs(%struct.stopwatch* %0)
%3 = sdiv i32 %2, 1000
%4 = sext i32 %3 to i64
ret i64 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int /*<<< orphan*/ ENOENT;
int /*<<< orphan*/ errno;
int mkfifo(const char *pathname, mode_t mode) {
  errno = ENOENT;
  return -1;
}


x86 assembly (clang, -O0):
<mkfifo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec5(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkfifo>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
@ENOENT = global i32 0
@errno = global i32 0
define i32 @mkfifo(i8* nocapture readnone %0, i32 %1) {
%3 = load i32, i32* @ENOENT
store i32 %3, i32* @errno
ret i32 -1
}
void RTAvlroIOPortInsert(void) {}


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

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

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

LLVM IR (-O2):
define void @RTAvlroIOPortInsert() {
ret void
}
/* Type definitions */
struct fb_fix_screeninfo {
  int /*<<< orphan*/ smem_len;
};

/* Variables and functions */
int munmap(void *, int /*<<< orphan*/);
int fb_munmap(void *buf, struct fb_fix_screeninfo *scinfo) {
  return munmap(buf, scinfo->smem_len);
}


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

x86 assembly (clang, -O2):
<fb_munmap>:
mov    (%rsi),%esi
jmp    1030 <munmap@plt>

LLVM IR (-O0):
%struct.fb_fix_screeninfo = type { i32 }
define i32 @fb_munmap(i8* %0, %struct.fb_fix_screeninfo* %1) {
%3 = alloca i8*
%4 = alloca %struct.fb_fix_screeninfo*
store i8* %0, i8** %3
store %struct.fb_fix_screeninfo* %1, %struct.fb_fix_screeninfo** %4
%5 = load i8*, i8** %3
%6 = load %struct.fb_fix_screeninfo*, %struct.fb_fix_screeninfo** %4
%7 = getelementptr inbounds %struct.fb_fix_screeninfo, %struct.fb_fix_screeninfo* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = call i32 @munmap(i8* %5, i32 %8)
ret i32 %9
}

LLVM IR (-O2):
%struct.fb_fix_screeninfo = type { i32 }
define i32 @fb_munmap(i8* %0, %struct.fb_fix_screeninfo* nocapture %1) {
%3 = getelementptr inbounds %struct.fb_fix_screeninfo, %struct.fb_fix_screeninfo* %1, i64 0, i32 0
%4 = load i32, i32* %3
%5 = tail call i32 @munmap(i8* %0, i32 %4)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, int /*<<< orphan*/);
main() {
  char *arr = "This is to test";
  printf("\n%c %c ", *(arr), *(arr++));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%edx
lea    0xece(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str.1 = [8 x i8] c"\0A%c %c \00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8 signext 84, i32 84)
ret i32 0
}
/* Variables and functions */
bool nrf52_errata_72(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf52_errata_72() {
ret i32 0
}
int load_config(void) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @load_config() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ lcdInit();
int /*<<< orphan*/ ledInit();
int /*<<< orphan*/ pinInit();
int /*<<< orphan*/ swInit();
void ioInit() {
  lcdInit();
  ledInit();
  swInit();
  pinInit();
}


x86 assembly (clang, -O0):
<ioInit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <lcdInit@plt>
mov    $0x0,%al
call   1060 <ledInit@plt>
mov    $0x0,%al
call   1040 <swInit@plt>
mov    $0x0,%al
call   1030 <pinInit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ioInit>:
push   %rax
xor    %eax,%eax
call   1050 <lcdInit@plt>
xor    %eax,%eax
call   1060 <ledInit@plt>
xor    %eax,%eax
call   1040 <swInit@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <pinInit@plt>

LLVM IR (-O0):
define void @ioInit() {
%1 = call i32 (...) @lcdInit()
%2 = call i32 (...) @ledInit()
%3 = call i32 (...) @swInit()
%4 = call i32 (...) @pinInit()
ret void
}

LLVM IR (-O2):
define void @ioInit() {
%1 = tail call i32 (...) @lcdInit()
%2 = tail call i32 (...) @ledInit()
%3 = tail call i32 (...) @swInit()
%4 = tail call i32 (...) @pinInit()
ret void
}
/* Variables and functions */
int RAND_MAX;
int /*<<< orphan*/ assert(int);
int rand();
int random_int(int n) {
  assert(n > 0);
  int cutoff = RAND_MAX % n;
  int ret;
  do
    ret = rand();
  while (ret <= cutoff);
  return ret % n;
}


x86 assembly (clang, -O0):
<random_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    0x2ea5(%rip),%rax
mov    (%rax),%eax
cltd
idivl  -0x4(%rbp)
mov    %edx,-0x8(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    114c <random_int+0x2c>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_int>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %edi,%edi
test   %ebx,%ebx
setg   %dil
call   1030 <assert@plt>
mov    0x2eaf(%rip),%rax
mov    (%rax),%eax
cltd
idiv   %ebx
mov    %edx,%ebp
xor    %eax,%eax
call   1040 <rand@plt>
cmp    %ebp,%eax
jle    1140 <random_int+0x20>
cltd
idiv   %ebx
mov    %edx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@RAND_MAX = global i32 0
define i32 @random_int(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32, i32* @RAND_MAX
%10 = load i32, i32* %2
%11 = srem i32 %9, %10
store i32 %11, i32* %3
br label %12
12: ; preds = %14, %1
%13 = call i32 (...) @rand()
store i32 %13, i32* %4
br label %14
14: ; preds = %12
%15 = load i32, i32* %4
%16 = load i32, i32* %3
%17 = icmp sle i32 %15, %16
br i1 %17, label %12, label %18
18: ; preds = %14
%19 = load i32, i32* %4
%20 = load i32, i32* %2
%21 = srem i32 %19, %20
ret i32 %21
}

LLVM IR (-O2):
@RAND_MAX = global i32 0
define i32 @random_int(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = load i32, i32* @RAND_MAX
%6 = srem i32 %5, %0
br label %7
7: ; preds = %7, %1
%8 = tail call i32 (...) @rand()
%9 = icmp sgt i32 %8, %6
br i1 %9, label %10, label %7
10: ; preds = %7
%11 = srem i32 %8, %0
ret i32 %11
}
unsigned int iumod(unsigned int a, unsigned int b) { return a % b; }


x86 assembly (clang, -O0):
<iumod>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    %edx,%edx
divl   -0x8(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iumod>:
mov    %edi,%eax
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @iumod(i32 %0, i32 %1) {
%3 = urem i32 %0, %1
ret i32 %3
}
/* Variables and functions */
int num_reader(char *);
int /*<<< orphan*/ printf(char *);
int options(void) {
  printf(":=============================================================:\n"
         "| 1: Show available flights                                   :\n"
         "| 2: Select a fligth and travel                               :\n"
         "| 3: Show current airport                                     :\n"
         "| 0: exit                                                     :\n"
         ":=============================================================:\n");
  printf("$ ");
  return num_reader("Type an option: ");
}


x86 assembly (clang, -O0):
<options>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0x104a(%rip),%rdi
call   1030 <printf@plt>
lea    0x1041(%rip),%rdi
call   1040 <num_reader@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<options>:
push   %rax
lea    0xedc(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
pop    %rax
jmp    1050 <num_reader@plt>

LLVM IR (-O0):
@.str = [385 x i8] c":=============================================================:\0A| 1: Show available flights :\0A| 2: Select a fligth and travel :\0A| 3: Show current airport :\0A| 0: exit :\0A:=============================================================:\0A\00"
@.str.1 = [3 x i8] c"$ \00"
@.str.2 = [17 x i8] c"Type an option: \00"
define i32 @options() {
%1 = call i32 @printf(i8* getelementptr inbounds ([385 x i8], [385 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @num_reader(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
ret i32 %3
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"$ \00"
@.str.2 = [17 x i8] c"Type an option: \00"
@str = [384 x i8] c":=============================================================:\0A| 1: Show available flights :\0A| 2: Select a fligth and travel :\0A| 3: Show current airport :\0A| 0: exit :\0A:=============================================================:\00"
define i32 @options() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([384 x i8], [384 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @num_reader(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ OTHERNAME;
typedef int /*<<< orphan*/ ASN1_VALUE;

/* Variables and functions */
int ASN1_item_i2d(int /*<<< orphan*/ *, unsigned char **, int /*<<< orphan*/ *);
int /*<<< orphan*/ OTHERNAME_it;
int i2d_OTHERNAME(OTHERNAME *a, unsigned char **out) {
  return ASN1_item_i2d((ASN1_VALUE *)a, out, &OTHERNAME_it);
}


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

x86 assembly (clang, -O2):
<i2d_OTHERNAME>:
mov    0x2ec9(%rip),%rdx
jmp    1030 <ASN1_item_i2d@plt>

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

LLVM IR (-O2):
@OTHERNAME_it = global i32 0
define i32 @i2d_OTHERNAME(i32* %0, i8** %1) {
%3 = tail call i32 @ASN1_item_i2d(i32* %0, i8** %1, i32* @OTHERNAME_it)
ret i32 %3
}
long long rebuildLongParam(int i1, int i2) {
  return ((long long)i1 << 32) | ((long long)i2 & 0xFFFFFFFF);
}


x86 assembly (clang, -O0):
<rebuildLongParam>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x20,%rax
movslq -0x8(%rbp),%rcx
movabs $0xffffffff,%rdx
and    %rdx,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rebuildLongParam>:
shl    $0x20,%rdi
mov    %esi,%eax
or     %rdi,%rax
ret

LLVM IR (-O0):
define i64 @rebuildLongParam(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 = sext i32 %5 to i64
%7 = shl i64 %6, 32
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = and i64 %9, 4294967295
%11 = or i64 %7, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @rebuildLongParam(i32 %0, i32 %1) {
%3 = zext i32 %0 to i64
%4 = shl nuw i64 %3, 32
%5 = zext i32 %1 to i64
%6 = or i64 %4, %5
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void finish() {
  endwin();
  exit(0);
}


x86 assembly (clang, -O0):
<finish>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <endwin@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<finish>:
push   %rax
xor    %eax,%eax
call   1030 <endwin@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @finish() {
%1 = call i32 (...) @endwin()
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @finish() {
%1 = tail call i32 (...) @endwin()
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
double cos(double);
double func4(double i) { return cos(i); }


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

x86 assembly (clang, -O2):
<func4>:
jmp    1030 <cos@plt>

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

LLVM IR (-O2):
define double @func4(double %0) {
%2 = tail call double @cos(double %0)
ret double %2
}