xunge/DecIR huggingface dataset:
unsigned hash(char *s, int hashsize) {
  unsigned hashval;
  for (hashval = 0; *s != '\0'; s++)
    hashval = *s + 31 * hashval;
  return hashval % hashsize;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1143 <hash+0x43>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
imul   $0x1f,-0x10(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1112 <hash+0x12>
mov    -0x10(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1129 <hash+0x29>
add    $0x1,%rdi
xor    %edx,%edx
mov    %edx,%eax
xchg   %ax,%ax
movsbl %cl,%ecx
shl    $0x5,%eax
sub    %edx,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
mov    %eax,%edx
test   %cl,%cl
jne    1110 <hash+0x10>
jmp    112b <hash+0x2b>
xor    %eax,%eax
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%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 i32 [ %11, %5 ], [ 0, %2 ]
%8 = phi i8* [ %12, %5 ], [ %0, %2 ]
%9 = sext i8 %6 to i32
%10 = mul i32 %7, 31
%11 = add i32 %10, %9
%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 i32 [ 0, %2 ], [ %11, %5 ]
%17 = urem i32 %16, %1
ret i32 %17
}
void efx_fini_debugfs(void) {}


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

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

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

LLVM IR (-O2):
define void @efx_fini_debugfs() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ doA();
int /*<<< orphan*/ doB();
int /*<<< orphan*/ doC();
int /*<<< orphan*/ undoA();
int /*<<< orphan*/ undoB();
void foo(void) {
  if (!doA())
    goto exit;
  if (!doB())
    goto revertA;
  if (!doC())
    goto revertB;
  return;
revertB:
  undoB();
revertA:
  undoA();
exit:
  return;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <doA@plt>
cmp    $0x0,%eax
jne    1169 <foo+0x19>
jmp    11a6 <foo+0x56>
mov    $0x0,%al
call   1070 <doB@plt>
cmp    $0x0,%eax
jne    117e <foo+0x2e>
jmp    119f <foo+0x4f>
mov    $0x0,%al
call   1040 <doC@plt>
cmp    $0x0,%eax
jne    1193 <foo+0x43>
jmp    1198 <foo+0x48>
jmp    11ab <foo+0x5b>
mov    $0x0,%al
call   1030 <undoB@plt>
mov    $0x0,%al
call   1060 <undoA@plt>
jmp    11ab <foo+0x5b>
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
xor    %eax,%eax
call   1050 <doA@plt>
test   %eax,%eax
je     1172 <foo+0x22>
xor    %eax,%eax
call   1070 <doB@plt>
test   %eax,%eax
je     117b <foo+0x2b>
xor    %eax,%eax
call   1040 <doC@plt>
test   %eax,%eax
je     1174 <foo+0x24>
pop    %rax
ret
xor    %eax,%eax
call   1030 <undoB@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <undoA@plt>

LLVM IR (-O0):
define void @foo() {
%1 = call i32 (...) @doA()
%2 = icmp ne i32 %1, 0
br i1 %2, label %4, label %3
3: ; preds = %0
br label %17
4: ; preds = %0
%5 = call i32 (...) @doB()
%6 = icmp ne i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %4
br label %15
8: ; preds = %4
%9 = call i32 (...) @doC()
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %8
br label %13
12: ; preds = %8
br label %18
13: ; preds = %11
%14 = call i32 (...) @undoB()
br label %15
15: ; preds = %13, %7
%16 = call i32 (...) @undoA()
br label %17
17: ; preds = %15, %3
br label %18
18: ; preds = %17, %12
ret void
}

LLVM IR (-O2):
define void @foo() {
%1 = tail call i32 (...) @doA()
%2 = icmp eq i32 %1, 0
br i1 %2, label %13, label %3
3: ; preds = %0
%4 = tail call i32 (...) @doB()
%5 = icmp eq i32 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = tail call i32 (...) @doC()
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = tail call i32 (...) @undoB()
br label %11
11: ; preds = %3, %9
%12 = tail call i32 (...) @undoA()
br label %13
13: ; preds = %11, %0, %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
unsigned int setbits(unsigned int, int, int, unsigned int);
int main(int argc, char **argv) {
  unsigned x = 255;
  unsigned y = 205;
  unsigned r;
  r = setbits(x, 5, 2, y);
  printf("%u\n", r);
  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   $0xff,-0x14(%rbp)
movl   $0xcd,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%ecx
mov    $0x5,%esi
mov    $0x2,%edx
call   1040 <setbits@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xff,%edi
mov    $0x5,%esi
mov    $0x2,%edx
mov    $0xcd,%ecx
call   1040 <setbits@plt>
lea    0xebf(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%u\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @setbits(i32 255, i32 5, i32 2, i32 205)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
int cairo_code_draw_lushbg_get_width() { return 630; }


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

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

LLVM IR (-O0):
define i32 @cairo_code_draw_lushbg_get_width() {
ret i32 630
}

LLVM IR (-O2):
define i32 @cairo_code_draw_lushbg_get_width() {
ret i32 630
}
/* Type definitions */
struct stat {
  int st_mode;
};

/* Variables and functions */
int S_IFBLK;
int S_IFMT;
int file_blockspecial(const struct stat *stat) {
  return (stat->st_mode & S_IFMT) != S_IFBLK;
}


x86 assembly (clang, -O0):
<file_blockspecial>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    0x2ecb(%rip),%rcx
and    (%rcx),%eax
mov    0x2eba(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_blockspecial>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%ecx
and    (%rdi),%ecx
mov    0x2ec6(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%ecx
setne  %al
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@S_IFMT = global i32 0
@S_IFBLK = global i32 0
define i32 @file_blockspecial(%struct.stat* %0) {
%2 = alloca %struct.stat*
store %struct.stat* %0, %struct.stat** %2
%3 = load %struct.stat*, %struct.stat** %2
%4 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = load i32, i32* @S_IFMT
%7 = and i32 %5, %6
%8 = load i32, i32* @S_IFBLK
%9 = icmp ne i32 %7, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@S_IFMT = global i32 0
@S_IFBLK = global i32 0
define i32 @file_blockspecial(%struct.stat* nocapture %0) {
%2 = getelementptr inbounds %struct.stat, %struct.stat* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = load i32, i32* @S_IFMT
%5 = and i32 %4, %3
%6 = load i32, i32* @S_IFBLK
%7 = icmp ne i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Type definitions */
typedef char *uint64_t;

/* Variables and functions */
uint64_t ROL64_46(uint64_t x) {
  __asm__("rolq $46, %0" : "=r"(x) : "0"(x));
  return x;
}


x86 assembly (clang, -O0):
<ROL64_46>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
rol    $0x2e,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ROL64_46>:
mov    %rdi,%rax
rol    $0x2e,%rax
ret

LLVM IR (-O0):
define i8* @ROL64_46(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* asm "rolq $$46, $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i8* %3)
store i8* %4, i8** %2
%5 = load i8*, i8** %2
ret i8* %5
}

LLVM IR (-O2):
define i8* @ROL64_46(i8* readnone %0) {
%2 = tail call i8* asm "rolq $$46, $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void main() {
  int a = 10;
  printf("%d   %p\n", a, &a);
  int *b;
  *(&(b)) = &a;
  printf("%p\n", b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed7(%rip),%rdi
lea    -0x4(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0xa,0xc(%rsp)
lea    0xedc(%rip),%rdi
lea    0xc(%rsp),%rbx
mov    $0xa,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"%d %p\0A\00"
@.str.1 = [4 x i8] c"%p\0A\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 10, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 10, i32* %1)
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %1)
ret void
}
/* Type definitions */
struct in_addr {
  int dummy;
};
typedef int /*<<< orphan*/ in_addr_t;

/* Variables and functions */
char *inet_ntoa(struct in_addr);
int /*<<< orphan*/ printf(char *, char *);
int __attribute__((__unused__)) print_in_addr_t(const in_addr_t *ip) {
  printf("%s", inet_ntoa(*(struct in_addr *)ip));
  return 0;
}


x86 assembly (clang, -O0):
<print_in_addr_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xebf(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_in_addr_t>:
push   %rax
mov    (%rdi),%edi
call   1030 <inet_ntoa@plt>
lea    0xed1(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.in_addr = type { i32 }
@.str = [3 x i8] c"%s\00"
define i32 @print_in_addr_t(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = bitcast i32* %3 to %struct.in_addr*
%5 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %4, i32 0, i32 0
%6 = load i32, i32* %5
%7 = call i8* @inet_ntoa(i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @print_in_addr_t(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i8* @inet_ntoa(i32 %2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 0
}
const char *ccnxPortalServerAbout_MiniNotice(void) {
  return "Copyright (c) 2016, Xerox Corporation (Xerox)and Palo Alto Research "
         "Center (PARC)\nAll rights reserved.\n";
}


x86 assembly (clang, -O0):
<ccnxPortalServerAbout_MiniNotice>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ccnxPortalServerAbout_MiniNotice>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [104 x i8] c"Copyright (c) 2016, Xerox Corporation (Xerox)and Palo Alto Research Center (PARC)\0AAll rights reserved.\0A\00"
define i8* @ccnxPortalServerAbout_MiniNotice() {
ret i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [104 x i8] c"Copyright (c) 2016, Xerox Corporation (Xerox)and Palo Alto Research Center (PARC)\0AAll rights reserved.\0A\00"
define i8* @ccnxPortalServerAbout_MiniNotice() {
ret i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0)
}
int hash(const char *name) {
  int h = 0;
  while (*name) {
    h <<= 2;
    h += *name++;
  }
  if (h < 0 && (h = -h) < 0)
    h = 0;
  return (h % 59);
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1142 <hash+0x42>
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    110f <hash+0xf>
cmpl   $0x0,-0xc(%rbp)
jge    1164 <hash+0x64>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jge    1164 <hash+0x64>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3b,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%al
test   %al,%al
je     1140 <hash+0x40>
add    $0x1,%rdi
xor    %ecx,%ecx
nopl   0x0(%rax)
movsbl %al,%eax
lea    (%rax,%rcx,4),%ecx
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <hash+0x10>
xor    %edx,%edx
mov    %ecx,%eax
neg    %eax
cmovs  %edx,%eax
test   %ecx,%ecx
cmovns %ecx,%eax
imul   $0x22b63cbf,%rax,%rcx
shr    $0x23,%rcx
imul   $0x3b,%ecx,%ecx
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %21, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %9, %4 ], [ %0, %1 ]
%8 = shl i32 %6, 2
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = sext i8 %5 to i32
%11 = add nsw i32 %8, %10
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = icmp slt i32 %11, 0
%16 = sub nsw i32 0, %11
%17 = icmp sgt i32 %16, 0
%18 = select i1 %17, i32 %16, i32 0
%19 = select i1 %15, i32 %18, i32 %11
%20 = urem i32 %19, 59
br label %21
21: ; preds = %14, %1
%22 = phi i32 [ 0, %1 ], [ %20, %14 ]
ret i32 %22
}
/* Variables and functions */
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ error(char *);
int read(int, char *, int);
int read_file(int fp_file, char *buffer) {
  int n = 0;
  bzero(buffer, 1024);
  n = read(fp_file, buffer, 1024);
  if (n < 0) {
    error("reading from file\r\n");
    return -1;
  }
  return n;
}


x86 assembly (clang, -O0):
<read_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x400,%esi
call   1050 <bzero@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x400,%edx
call   1030 <read@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    118a <read_file+0x5a>
lea    0xe87(%rip),%rdi
call   1040 <error@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1190 <read_file+0x60>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_file>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
mov    $0x400,%esi
call   1050 <bzero@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1030 <read@plt>
test   %eax,%eax
jns    1169 <read_file+0x39>
lea    0xea1(%rip),%rdi
call   1040 <error@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"reading from file\0D\0A\00"
define i32 @read_file(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 0, i32* %6
%7 = load i8*, i8** %5
%8 = call i32 @bzero(i8* %7, i32 1024)
%9 = load i32, i32* %4
%10 = load i8*, i8** %5
%11 = call i32 @read(i32 %9, i8* %10, i32 1024)
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %18
16: ; preds = %2
%17 = load i32, i32* %6
store i32 %17, i32* %3
br label %18
18: ; preds = %16, %14
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@.str = [20 x i8] c"reading from file\0D\0A\00"
define i32 @read_file(i32 %0, i8* nocapture %1) {
%3 = tail call i32 @bzero(i8* %1, i32 1024)
%4 = tail call i32 @read(i32 %0, i8* %1, i32 1024)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ -1, %6 ], [ %4, %2 ]
ret i32 %9
}
/* Type definitions */
typedef scalar_t__ clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
scalar_t__ clock();
int second_(double *t) {
  clock_t sample = clock();
  *t = (double)sample / CLOCKS_PER_SEC;
  return 0;
}


x86 assembly (clang, -O0):
<second_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x10(%rbp)
cvtsi2sdq -0x10(%rbp),%xmm0
mov    0x2eb4(%rip),%rax
divsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<second_>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <clock@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec1(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@CLOCKS_PER_SEC = global double 0.000000e+00
define i32 @second_(double* %0) {
%2 = alloca double*
%3 = alloca i64
store double* %0, double** %2
%4 = call i64 (...) @clock()
store i64 %4, i64* %3
%5 = load i64, i64* %3
%6 = sitofp i64 %5 to double
%7 = load double, double* @CLOCKS_PER_SEC
%8 = fdiv double %6, %7
%9 = load double*, double** %2
store double %8, double* %9
ret i32 0
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global double 0.000000e+00
define i32 @second_(double* nocapture writeonly %0) {
%2 = tail call i64 (...) @clock()
%3 = sitofp i64 %2 to double
%4 = load double, double* @CLOCKS_PER_SEC
%5 = fdiv double %3, %4
store double %5, double* %0
ret i32 0
}
void ar_dma_with_ack(int my_cid, int src_bid, int src_cid, unsigned int src_adr,
                     int dst_bid, int dst_cid, unsigned int dst_adr,
                     int ack_bid, int ack_cid, int ack_cnt, int size,
                     int ignore_dirty_on_src, int clean_on_dst,
                     int write_through_on_dst) {}


x86 assembly (clang, -O0):
<ar_dma_with_ack>:
push   %rbp
mov    %rsp,%rbp
mov    0x48(%rbp),%eax
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @ar_dma_with_ack(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13) {
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
store i32 %0, i32* %15
store i32 %1, i32* %16
store i32 %2, i32* %17
store i32 %3, i32* %18
store i32 %4, i32* %19
store i32 %5, i32* %20
store i32 %6, i32* %21
store i32 %7, i32* %22
store i32 %8, i32* %23
store i32 %9, i32* %24
store i32 %10, i32* %25
store i32 %11, i32* %26
store i32 %12, i32* %27
store i32 %13, i32* %28
ret void
}

LLVM IR (-O2):
define void @ar_dma_with_ack(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ pp0_node_to_cpu(int /*<<< orphan*/);
int set_balance_policy(int /*<<< orphan*/, int, int /*<<< orphan*/);
int set_pp0_balance_policy(uint64_t node, uint64_t priority_level) {
  uint64_t cpu = pp0_node_to_cpu(node);
  return set_balance_policy(cpu, 0x63a, priority_level);
}


x86 assembly (clang, -O0):
<set_pp0_balance_policy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <pp0_node_to_cpu@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    $0x63a,%esi
call   1030 <set_balance_policy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_pp0_balance_policy>:
push   %rbx
mov    %esi,%ebx
call   1040 <pp0_node_to_cpu@plt>
mov    %eax,%edi
mov    $0x63a,%esi
mov    %ebx,%edx
pop    %rbx
jmp    1030 <set_balance_policy@plt>

LLVM IR (-O0):
define i32 @set_pp0_balance_policy(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* %3
%7 = call i32 @pp0_node_to_cpu(i32 %6)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = call i32 @set_balance_policy(i32 %8, i32 1594, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @set_pp0_balance_policy(i32 %0, i32 %1) {
%3 = tail call i32 @pp0_node_to_cpu(i32 %0)
%4 = tail call i32 @set_balance_policy(i32 %3, i32 1594, i32 %1)
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
scalar_t__ clock();
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ program1();
int /*<<< orphan*/ program3();
main() {
  clock_t begin, end;
  double time_spent;
  begin = clock();
  program1();
  program3();
  end = clock();
  time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
  printf("Time Spent: %fs", time_spent);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <program1@plt>
mov    $0x0,%al
call   1040 <program3@plt>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2e68(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe6b(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <program1@plt>
xor    %eax,%eax
call   1040 <program3@plt>
xor    %eax,%eax
call   1050 <clock@plt>
sub    %rbx,%rax
cvtsi2sd %rax,%xmm0
mov    0x2e79(%rip),%rax
divsd  (%rax),%xmm0
lea    0xe86(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str = [16 x i8] c"Time Spent: %fs\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca double
%4 = call i64 (...) @clock()
store i64 %4, i64* %1
%5 = call i32 (...) @program1()
%6 = call i32 (...) @program3()
%7 = call i64 (...) @clock()
store i64 %7, i64* %2
%8 = load i64, i64* %2
%9 = load i64, i64* %1
%10 = sub nsw i64 %8, %9
%11 = sitofp i64 %10 to double
%12 = load double, double* @CLOCKS_PER_SEC
%13 = fdiv double %11, %12
store double %13, double* %3
%14 = load double, double* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %14)
ret i32 0
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str = [16 x i8] c"Time Spent: %fs\00"
define i32 @main() {
%1 = tail call i64 (...) @clock()
%2 = tail call i32 (...) @program1()
%3 = tail call i32 (...) @program3()
%4 = tail call i64 (...) @clock()
%5 = sub nsw i64 %4, %1
%6 = sitofp i64 %5 to double
%7 = load double, double* @CLOCKS_PER_SEC
%8 = fdiv double %6, %7
%9 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %8)
ret i32 0
}
double max(double a, double b) { return a >= b ? a : b; }


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     112d <max+0x2d>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1137 <max+0x37>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
movapd %xmm1,%xmm2
cmplesd %xmm0,%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @max(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp oge double %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load double, double* %3
br label %12
10: ; preds = %2
%11 = load double, double* %4
br label %12
12: ; preds = %10, %8
%13 = phi double [ %9, %8 ], [ %11, %10 ]
ret double %13
}

LLVM IR (-O2):
define double @max(double %0, double %1) {
%3 = fcmp oge double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
int all_lower(str)
char *str;
{
  while (*str) {
    if (!(((unsigned char)*str) <= 0177) || !islower(*str))
      return 0;
    ++str;
  }
  return 1;
}


x86 assembly (clang, -O0):
<all_lower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     116b <all_lower+0x5b>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x7f,%eax
jg     114e <all_lower+0x3e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <islower@plt>
cmp    $0x0,%eax
jne    115a <all_lower+0x4a>
movl   $0x0,-0x4(%rbp)
jmp    1172 <all_lower+0x62>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <all_lower+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<all_lower>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     114b <all_lower+0x3b>
mov    %rdi,%rbx
add    $0x1,%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   %al,%al
js     1150 <all_lower+0x40>
movzbl %al,%edi
call   1030 <islower@plt>
test   %eax,%eax
je     1150 <all_lower+0x40>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <all_lower+0x20>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @all_lower(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %7
4: ; preds = %11
%5 = load i8, i8* %15
%6 = icmp eq i8 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %15, %4 ], [ %0, %1 ]
%10 = icmp sgt i8 %8, -1
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = zext i8 %8 to i32
%13 = tail call i32 @islower(i32 %12)
%14 = icmp eq i32 %13, 0
%15 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %14, label %16, label %4
16: ; preds = %11, %7, %4, %1
%17 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %7 ], [ 0, %11 ]
ret i32 %17
}
/* Type definitions */
struct dirent {
  int dummy;
};
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
struct dirent *readdir(int /*<<< orphan*/ *);
struct dirent *outside_readdir(DIR *dir) {
  return readdir(dir);
}


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

x86 assembly (clang, -O2):
<outside_readdir>:
jmp    1030 <readdir@plt>

LLVM IR (-O0):
%struct.dirent = type { i32 }
define %struct.dirent* @outside_readdir(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call %struct.dirent* @readdir(i32* %3)
ret %struct.dirent* %4
}

LLVM IR (-O2):
%struct.dirent = type { i32 }
define %struct.dirent* @outside_readdir(i32* %0) {
%2 = tail call %struct.dirent* @readdir(i32* %0)
ret %struct.dirent* %2
}
int my_execlp() {
  const char *file, *arg;
  __asm__ __volatile__("movl %%eax, %0\n"
                       "movl %%ebx, %1"
                       : "=m"(file), "=m"(arg));
  return execlp(file, arg);
}


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

x86 assembly (clang, -O2):
<my_execlp>:
sub    $0x18,%rsp
mov    %eax,0x10(%rsp)
mov    %ebx,0x8(%rsp)
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
xor    %eax,%eax
call   1030 <execlp@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @my_execlp() {
%1 = alloca i8*
%2 = alloca i8*
%3 = load i8*, i8** %1
%4 = load i8*, i8** %2
%5 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @execlp to i32 (i8*, i8*, ...)*)(i8* %3, i8* %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @my_execlp() {
%1 = alloca i8*
%2 = alloca i8*
%3 = bitcast i8** %1 to i8*
%4 = bitcast i8** %2 to i8*
%5 = load i8*, i8** %1
%6 = load i8*, i8** %2
%7 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @execlp to i32 (i8*, i8*, ...)*)(i8* %5, i8* %6)
ret i32 %7
}
/* Variables and functions */
int mblen(const char *s, size_t n) {
  if (s == 0)
    return 0;
  if (n == 0)
    return -1;
  if (*s == 0)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<mblen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1123 <mblen+0x23>
movl   $0x0,-0x4(%rbp)
jmp    115d <mblen+0x5d>
cmpq   $0x0,-0x18(%rbp)
jne    113a <mblen+0x3a>
movl   $0xffffffff,-0x4(%rbp)
jmp    115d <mblen+0x5d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1156 <mblen+0x56>
movl   $0x0,-0x4(%rbp)
jmp    115d <mblen+0x5d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mblen>:
test   %rdi,%rdi
je     1113 <mblen+0x13>
test   %rsi,%rsi
je     1116 <mblen+0x16>
xor    %eax,%eax
cmpb   $0x0,(%rdi)
setne  %al
ret
xor    %eax,%eax
ret
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @mblen(i8* %0, i64 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = icmp eq i64 %1, 0
br i1 %5, label %10, label %6
6: ; preds = %4
%7 = load i8, i8* %0
%8 = icmp ne i8 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %4, %2
%11 = phi i32 [ 0, %2 ], [ -1, %4 ], [ %9, %6 ]
ret i32 %11
}
char *addr_type_str(int addr_type) {
  switch (addr_type) {
  case 1:
    return "IPv4";
  case 2:
    return "IPv6";
  case 3:
    return "SVC";
  default:
    return "UNKNOWN";
  }
}


x86 assembly (clang, -O0):
<addr_type_str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     113d <addr_type_str+0x3d>
jmp    111b <addr_type_str+0x1b>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     114d <addr_type_str+0x4d>
jmp    112c <addr_type_str+0x2c>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
je     115d <addr_type_str+0x5d>
jmp    116d <addr_type_str+0x6d>
lea    0xebc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <addr_type_str+0x78>
lea    0xeb1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <addr_type_str+0x78>
lea    0xea6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <addr_type_str+0x78>
lea    0xe9a(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<addr_type_str>:
add    $0xffffffff,%edi
cmp    $0x2,%edi
ja     111a <addr_type_str+0x1a>
movslq %edi,%rax
lea    0xf06(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
lea    0xeed(%rip),%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"IPv4\00"
@.str.1 = [5 x i8] c"IPv6\00"
@.str.2 = [4 x i8] c"SVC\00"
@.str.3 = [8 x i8] c"UNKNOWN\00"
define i8* @addr_type_str(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 1, label %5
i32 2, label %6
i32 3, label %7
]
5: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
br label %9
6: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %9
7: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %9
8: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %9
9: ; preds = %8, %7, %6, %5
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [5 x i8] c"IPv4\00"
@.str.1 = [5 x i8] c"IPv6\00"
@.str.2 = [4 x i8] c"SVC\00"
@.str.3 = [8 x i8] c"UNKNOWN\00"
@reltable.addr_type_str = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.addr_type_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.addr_type_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.addr_type_str to i64)) to i32)]
define i8* @addr_type_str(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 3
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.addr_type_str to i8*), i64 %6)
br label %8
8: ; preds = %1, %4
%9 = phi i8* [ %7, %4 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %1 ]
ret i8* %9
}
void swap_bytes_in_array(char *array, int byte1, int byte2) {
  char temp;
  temp = array[byte1];
  array[byte1] = array[byte2];
  array[byte2] = temp;
}


x86 assembly (clang, -O0):
<swap_bytes_in_array>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x11(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_bytes_in_array>:
movslq %esi,%rax
mov    (%rdi,%rax,1),%sil
movslq %edx,%rdx
mov    (%rdi,%rdx,1),%cl
mov    %cl,(%rdi,%rax,1)
mov    %sil,(%rdi,%rdx,1)
ret

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

LLVM IR (-O2):
define void @swap_bytes_in_array(i8* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
store i8 %9, i8* %5
store i8 %6, i8* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug_break();
int fib(int n) {
  int r;
  if (n == 0 || n == 1)
    return 1;
  r = fib(n - 1) + fib(n - 2);
  if (r == 89) {
    debug_break();
  }
  return r;
}


x86 assembly (clang, -O0):
<fib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     113f <fib+0x1f>
cmpl   $0x1,-0x8(%rbp)
jne    114b <fib+0x2b>
movl   $0x1,-0x4(%rbp)
jmp    1185 <fib+0x65>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1040 <fib@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1040 <fib@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x59,-0xc(%rbp)
jne    117f <fib+0x5f>
mov    $0x0,%al
call   1030 <debug_break@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%eax
cmp    $0x2,%edi
jb     1156 <fib+0x36>
mov    %edi,%ebx
lea    -0x1(%rbx),%edi
call   1040 <fib@plt>
mov    %eax,%ebp
add    $0xfffffffe,%ebx
mov    %ebx,%edi
call   1040 <fib@plt>
add    %ebp,%eax
cmp    $0x59,%eax
jne    1156 <fib+0x36>
xor    %eax,%eax
call   1030 <debug_break@plt>
mov    $0x59,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @fib(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %7, %1
store i32 1, i32* %2
br label %25
11: ; preds = %7
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, 1
%14 = call i32 @fib(i32 %13)
%15 = load i32, i32* %3
%16 = sub nsw i32 %15, 2
%17 = call i32 @fib(i32 %16)
%18 = add nsw i32 %14, %17
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 89
br i1 %20, label %21, label %23
21: ; preds = %11
%22 = call i32 (...) @debug_break()
br label %23
23: ; preds = %21, %11
%24 = load i32, i32* %4
store i32 %24, i32* %2
br label %25
25: ; preds = %23, %10
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
define i32 @fib(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = add nsw i32 %0, -1
%5 = tail call i32 @fib(i32 %4)
%6 = add nsw i32 %0, -2
%7 = tail call i32 @fib(i32 %6)
%8 = add nsw i32 %7, %5
%9 = icmp eq i32 %8, 89
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = tail call i32 (...) @debug_break()
br label %12
12: ; preds = %3, %10, %1
%13 = phi i32 [ 1, %1 ], [ 89, %10 ], [ %8, %3 ]
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ GLint;
typedef int /*<<< orphan*/ GLenum;

/* Variables and functions */
int /*<<< orphan*/ __glGetTexEnvfv_size(int /*<<< orphan*/);
GLint __glGetTexEnviv_size(GLenum pname) { return __glGetTexEnvfv_size(pname); }


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

x86 assembly (clang, -O2):
<__glGetTexEnviv_size>:
jmp    1030 <__glGetTexEnvfv_size@plt>

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

LLVM IR (-O2):
define i32 @__glGetTexEnviv_size(i32 %0) {
%2 = tail call i32 @__glGetTexEnvfv_size(i32 %0)
ret i32 %2
}
int *factorial(int n) {
  int *factorial;
  return factorial;
}


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

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

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

LLVM IR (-O2):
define noalias i32* @factorial(i32 %0) {
ret i32* undef
}
/* Variables and functions */
char *malloc(size_t);
char *rpl_malloc(size_t n) {
  if (n == 0)
    n = 1;
  return malloc(n);
}


x86 assembly (clang, -O0):
<rpl_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112f <rpl_malloc+0x1f>
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rpl_malloc>:
test   %rdi,%rdi
mov    $0x1,%eax
cmove  %rax,%rdi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @rpl_malloc(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
store i64 1, i64* %2
br label %6
6: ; preds = %5, %1
%7 = load i64, i64* %2
%8 = call i8* @malloc(i64 %7)
ret i8* %8
}

LLVM IR (-O2):
define noalias i8* @rpl_malloc(i64 %0) {
%2 = icmp eq i64 %0, 0
%3 = select i1 %2, i64 1, i64 %0
%4 = tail call i8* @malloc(i64 %3)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ cluster_kmeans(double *, double *, int, int, int, int *);
int /*<<< orphan*/ kmpp_init_centroids(double *, double *, int, int, int);
void cluster_kmpp(double *centroids, double *samples, int dims, int n_centroids,
                  int n_samples, int *labels) {
  kmpp_init_centroids(centroids, samples, dims, n_centroids, n_samples);
  cluster_kmeans(centroids, samples, dims, n_centroids, n_samples, labels);
}


x86 assembly (clang, -O0):
<cluster_kmpp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
call   1030 <kmpp_init_centroids@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x28(%rbp),%r9
call   1040 <cluster_kmeans@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cluster_kmpp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8d,%r15d
mov    %ecx,%r12d
mov    %edx,%r13d
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1030 <kmpp_init_centroids@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r13d,%edx
mov    %r12d,%ecx
mov    %r15d,%r8d
mov    %r14,%r9
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <cluster_kmeans@plt>

LLVM IR (-O0):
define void @cluster_kmpp(double* %0, double* %1, i32 %2, i32 %3, i32 %4, i32* %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
store double* %0, double** %7
store double* %1, double** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32* %5, i32** %12
%13 = load double*, double** %7
%14 = load double*, double** %8
%15 = load i32, i32* %9
%16 = load i32, i32* %10
%17 = load i32, i32* %11
%18 = call i32 @kmpp_init_centroids(double* %13, double* %14, i32 %15, i32 %16, i32 %17)
%19 = load double*, double** %7
%20 = load double*, double** %8
%21 = load i32, i32* %9
%22 = load i32, i32* %10
%23 = load i32, i32* %11
%24 = load i32*, i32** %12
%25 = call i32 @cluster_kmeans(double* %19, double* %20, i32 %21, i32 %22, i32 %23, i32* %24)
ret void
}

LLVM IR (-O2):
define void @cluster_kmpp(double* %0, double* %1, i32 %2, i32 %3, i32 %4, i32* %5) {
%7 = tail call i32 @kmpp_init_centroids(double* %0, double* %1, i32 %2, i32 %3, i32 %4)
%8 = tail call i32 @cluster_kmeans(double* %0, double* %1, i32 %2, i32 %3, i32 %4, i32* %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CheckArguments(int, char **);
int main(int argc, char **argv) {
  CheckArguments(argc, argv);
  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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <CheckArguments@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
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* %4
%7 = load i8**, i8*** %5
%8 = call i32 @CheckArguments(i32 %6, i8** %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @CheckArguments(i32 %0, i8** %1)
ret i32 0
}