xunge/DecIR huggingface dataset:
/* Variables and functions */
char **get_XDG_DIRS(size_t *, char *, char *, char *, char *);
char **get_XDG_CONFIG_DIRS(size_t *len) {
  return get_XDG_DIRS(len, "XDG_CONFIG_HOME", ".config", "XDG_CONFIG_DIRS",
                      "/etc/xdg");
}


x86 assembly (clang, -O0):
<get_XDG_CONFIG_DIRS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
lea    0xee2(%rip),%rdx
lea    0xee3(%rip),%rcx
lea    0xeec(%rip),%r8
call   1030 <get_XDG_DIRS@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_XDG_CONFIG_DIRS>:
lea    0xee9(%rip),%rsi
lea    0xef2(%rip),%rdx
lea    0xef3(%rip),%rcx
lea    0xefc(%rip),%r8
jmp    1030 <get_XDG_DIRS@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"XDG_CONFIG_HOME\00"
@.str.1 = [8 x i8] c".config\00"
@.str.2 = [16 x i8] c"XDG_CONFIG_DIRS\00"
@.str.3 = [9 x i8] c"/etc/xdg\00"
define i8** @get_XDG_CONFIG_DIRS(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = call i8** @get_XDG_DIRS(i64* %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
ret i8** %4
}

LLVM IR (-O2):
@.str = [16 x i8] c"XDG_CONFIG_HOME\00"
@.str.1 = [8 x i8] c".config\00"
@.str.2 = [16 x i8] c"XDG_CONFIG_DIRS\00"
@.str.3 = [9 x i8] c"/etc/xdg\00"
define i8** @get_XDG_CONFIG_DIRS(i64* %0) {
%2 = tail call i8** @get_XDG_DIRS(i64* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
ret i8** %2
}
int GSL_MIN_INT(int a, int b) { return ((a) < (b) ? (a) : (b)); }


x86 assembly (clang, -O0):
<GSL_MIN_INT>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1121 <GSL_MIN_INT+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <GSL_MIN_INT+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GSL_MIN_INT>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @GSL_MIN_INT(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isspace(int);
void t_isspace_0x23() {
  Assert_real((isspace(35) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isspace.c",
              180, ("isspace should be 0 for #"));
}


x86 assembly (clang, -O0):
<t_isspace_0x23>:
push   %rbp
mov    %rsp,%rbp
mov    $0x23,%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0xb4,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isspace_0x23>:
push   %rax
mov    $0x23,%edi
call   1030 <isspace@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0xb4,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [26 x i8] c"isspace should be 0 for #\00"
define void @t_isspace_0x23() {
%1 = call i64 @isspace(i32 35)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 180, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [26 x i8] c"isspace should be 0 for #\00"
define void @t_isspace_0x23() {
%1 = tail call i64 @isspace(i32 35)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 180, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int getpid();
int /*<<< orphan*/ srand(int);
int time(int /*<<< orphan*/ *);
void init_rand() { srand(time(NULL) ^ (getpid() << 16)); }


x86 assembly (clang, -O0):
<init_rand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x4(%rbp),%edi
shl    $0x10,%eax
xor    %eax,%edi
call   1040 <srand@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_rand>:
push   %rbx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <getpid@plt>
shl    $0x10,%eax
xor    %eax,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1040 <srand@plt>

LLVM IR (-O0):
define void @init_rand() {
%1 = call i32 @time(i32* null)
%2 = call i32 (...) @getpid()
%3 = shl i32 %2, 16
%4 = xor i32 %1, %3
%5 = call i32 @srand(i32 %4)
ret void
}

LLVM IR (-O2):
define void @init_rand() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 (...) @getpid()
%3 = shl i32 %2, 16
%4 = xor i32 %3, %1
%5 = tail call i32 @srand(i32 %4)
ret void
}
int validaNome(char *nome) {
  int count = 0;
  char ch = '0';
  for (count = 0; ((ch != '\0') && (count < 12)); count++) {
    ch = nome[count];
  }
  if (count >= 1 && count <= 10) {
    return 1;
  } else {
    return 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<validaNome>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movb   $0x30,-0x15(%rbp)
movl   $0x0,-0x14(%rbp)
movsbl -0x15(%rbp),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x16(%rbp)
je     1136 <validaNome+0x36>
cmpl   $0xc,-0x14(%rbp)
setl   %al
mov    %al,-0x16(%rbp)
mov    -0x16(%rbp),%al
test   $0x1,%al
jne    1146 <validaNome+0x46>
jmp    1162 <validaNome+0x62>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x15(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111a <validaNome+0x1a>
cmpl   $0x1,-0x14(%rbp)
jl     1182 <validaNome+0x82>
cmpl   $0xa,-0x14(%rbp)
jg     1182 <validaNome+0x82>
movl   $0x1,-0x4(%rbp)
jmp    1189 <validaNome+0x89>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<validaNome>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x1(%rax),%rcx
cmpb   $0x0,(%rdi,%rax,1)
je     1123 <validaNome+0x23>
cmp    $0xb,%rax
mov    %rcx,%rax
jb     1110 <validaNome+0x10>
add    $0xffffffff,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
setb   %al
ret

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

LLVM IR (-O2):
define i32 @validaNome(i8* nocapture %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 0, %1 ], [ %6, %2 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = add nuw nsw i64 %3, 1
%7 = icmp ne i8 %5, 0
%8 = icmp ult i64 %3, 11
%9 = select i1 %7, i1 %8, i1 false
br i1 %9, label %2, label %10
10: ; preds = %2
%11 = trunc i64 %3 to i32
%12 = icmp ult i32 %11, 10
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Variables and functions */
int check(char *);
int APending() { return check("SYMBOL"); }


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

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

LLVM IR (-O0):
@.str = [7 x i8] c"SYMBOL\00"
define i32 @APending() {
%1 = call i32 @check(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [7 x i8] c"SYMBOL\00"
define i32 @APending() {
%1 = tail call i32 @check(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
int get_iterator_step(int css1, int id1, int css2, int id2) {
  if (css1 == css2) {
    if (id1 < id2)
      return 1;
    else
      return -1;
  } else if (css1 < css2) {
    return 1;
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<get_iterator_step>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    1140 <get_iterator_step+0x40>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1134 <get_iterator_step+0x34>
movl   $0x1,-0x4(%rbp)
jmp    115f <get_iterator_step+0x5f>
movl   $0xffffffff,-0x4(%rbp)
jmp    115f <get_iterator_step+0x5f>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1158 <get_iterator_step+0x58>
movl   $0x1,-0x4(%rbp)
jmp    115f <get_iterator_step+0x5f>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_iterator_step>:
xor    %eax,%eax
cmp    %ecx,%esi
setl   %al
xor    %ecx,%ecx
cmp    %edx,%edi
setl   %cl
cmove  %eax,%ecx
lea    (%rcx,%rcx,1),%eax
add    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @get_iterator_step(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %0, %2
%6 = icmp slt i32 %1, %3
%7 = select i1 %6, i32 1, i32 -1
%8 = icmp slt i32 %0, %2
%9 = select i1 %8, i32 1, i32 -1
%10 = select i1 %5, i32 %7, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ practice_8();
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("hello world\n");
  practice_8();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <practice_8@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <practice_8@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"hello world\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @practice_8()
ret i32 0
}

LLVM IR (-O2):
@str = [12 x i8] c"hello world\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @practice_8()
ret i32 0
}
float fn3() { return 1.0; }


x86 assembly (clang, -O0):
<fn3>:
push   %rbp
mov    %rsp,%rbp
movss  0xef4(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn3>:
movss  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define float @fn3() {
ret float 1.000000e+00
}

LLVM IR (-O2):
define float @fn3() {
ret float 1.000000e+00
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
void _free(void *addr, int size) {
  if (size)
    memset(addr, 0, size);
  free(addr);
}


x86 assembly (clang, -O0):
<_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1147 <_free+0x27>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_free>:
push   %rbx
mov    %rdi,%rbx
test   %esi,%esi
je     1134 <_free+0x14>
mov    %esi,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @_free(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = call i32 @memset(i8* %8, i32 0, i32 %9)
br label %11
11: ; preds = %7, %2
%12 = load i8*, i8** %3
%13 = call i32 @free(i8* %12)
ret void
}

LLVM IR (-O2):
define void @_free(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @memset(i8* %0, i32 0, i32 %1)
br label %6
6: ; preds = %4, %2
%7 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
void WRITE_CHAR(char a, int w) { printf("%c", a); }


x86 assembly (clang, -O0):
<WRITE_CHAR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xed8(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WRITE_CHAR>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @WRITE_CHAR(i8 signext %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ arc4random_buf(void *, size_t);
void evutil_secure_rng_get_bytes(void *buf, size_t n) {
  arc4random_buf(buf, n);
}


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

x86 assembly (clang, -O2):
<evutil_secure_rng_get_bytes>:
jmp    1030 <arc4random_buf@plt>

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

LLVM IR (-O2):
define void @evutil_secure_rng_get_bytes(i8* %0, i64 %1) {
%3 = tail call i32 @arc4random_buf(i8* %0, i64 %1)
ret void
}
void *test_anti_range_142(long n) {
  extern void *alloc_anti_range_142(long) __attribute__((alloc_size(1)));
  if (-1 <= n && n <= 2)
    n = -1 - 1;
  return alloc_anti_range_142(n);
}


x86 assembly (clang, -O0):
<test_anti_range_142>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xffffffffffffffff,%rax
cmp    -0x8(%rbp),%rax
jg     1140 <test_anti_range_142+0x30>
cmpq   $0x2,-0x8(%rbp)
jg     1140 <test_anti_range_142+0x30>
movq   $0xfffffffffffffffe,-0x8(%rbp)
ff
mov    -0x8(%rbp),%rdi
call   1030 <alloc_anti_range_142@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_anti_range_142>:
lea    0x1(%rdi),%rax
cmp    $0x4,%rax
mov    $0xfffffffffffffffe,%rax
cmovb  %rax,%rdi
jmp    1030 <alloc_anti_range_142@plt>

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

LLVM IR (-O2):
define i8* @test_anti_range_142(i64 %0) {
%2 = add i64 %0, 1
%3 = icmp ult i64 %2, 4
%4 = select i1 %3, i64 -2, i64 %0
%5 = tail call i8* @alloc_anti_range_142(i64 %4)
ret i8* %5
}
/* Variables and functions */
size_t atoi(char *);
int /*<<< orphan*/ wrap(size_t, char *, char *);
int main(int argc, char *argv[]) {
  size_t len = atoi(argv[1]);
  wrap(len, "%s", "012345678901234567890");
  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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xeae(%rip),%rsi
lea    0xeaa(%rip),%rdx
call   1030 <wrap@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
lea    0xecf(%rip),%rsi
lea    0xecb(%rip),%rdx
mov    %rax,%rdi
call   1030 <wrap@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [22 x i8] c"012345678901234567890\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = call i64 @atoi(i8* %9)
store i64 %10, i64* %6
%11 = load i64, i64* %6
%12 = call i32 @wrap(i64 %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [22 x i8] c"012345678901234567890\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i64 @atoi(i8* %4)
%6 = tail call i32 @wrap(i64 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
int FLOOR(float x) { return ((int)(x) - ((int)(x) > (x) ? 1 : 0)); }


x86 assembly (clang, -O0):
<FLOOR>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
cvttss2si -0x4(%rbp),%eax
cvttss2si -0x4(%rbp),%ecx
cvtsi2ss %ecx,%xmm0
movss  -0x4(%rbp),%xmm1
xor    %ecx,%ecx
mov    $0x1,%edx
ucomiss %xmm1,%xmm0
cmova  %edx,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FLOOR>:
cvttss2si %xmm0,%eax
cvttps2dq %xmm0,%xmm1
cvtdq2ps %xmm1,%xmm1
xor    %ecx,%ecx
ucomiss %xmm0,%xmm1
seta   %cl
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @FLOOR(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fptosi float %3 to i32
%5 = load float, float* %2
%6 = fptosi float %5 to i32
%7 = sitofp i32 %6 to float
%8 = load float, float* %2
%9 = fcmp ogt float %7, %8
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 1, i32 0
%12 = sub nsw i32 %4, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @FLOOR(float %0) {
%2 = fptosi float %0 to i32
%3 = sitofp i32 %2 to float
%4 = fcmp ogt float %3, %0
%5 = sext i1 %4 to i32
%6 = add i32 %5, %2
ret i32 %6
}
int test10() { return __builtin_constant_p(&test10 != 0); }


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

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

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

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

/* Variables and functions */
int32_t ev3_touch_sensor_is_pressed(int32_t port) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @ev3_touch_sensor_is_pressed(i32 %0) {
ret i32 0
}
int test_imm_72int16_reg(short val) {
  return ((val) & (-0x72 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_72int16_reg>:
test   $0xff8e,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_72int16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, -114
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_72int16_reg(i16 signext %0) {
%2 = and i16 %0, -114
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
_Bool strict_sorted(int a[], int len, int s) {
  int i;
  for (i = s; i < len - 1; i++) {
    if (a[i] >= a[i + 1])
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<strict_sorted>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1162 <strict_sorted+0x62>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jl     114f <strict_sorted+0x4f>
movb   $0x0,-0x1(%rbp)
jmp    1166 <strict_sorted+0x66>
jmp    1154 <strict_sorted+0x54>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1114 <strict_sorted+0x14>
movb   $0x1,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strict_sorted>:
add    $0xffffffff,%esi
movslq %edx,%rdx
cmp    %esi,%edx
mov    %esi,%eax
cmovg  %edx,%eax
movslq %eax,%r8
mov    %rdx,%rcx
cmp    %rdx,%r8
je     1125 <strict_sorted+0x25>
mov    (%rdi,%rcx,4),%eax
lea    0x1(%rcx),%rdx
cmp    0x4(%rdi,%rcx,4),%eax
jl     1110 <strict_sorted+0x10>
movslq %esi,%rax
cmp    %rax,%rcx
setge  %al
ret

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

LLVM IR (-O2):
define zeroext i1 @strict_sorted(i32* nocapture %0, i32 %1, i32 %2) {
%4 = add i32 %1, -1
%5 = sext i32 %2 to i64
%6 = call i32 @llvm.smax.i32(i32 %2, i32 %4)
%7 = sext i32 %6 to i64
br label %8
8: ; preds = %11, %3
%9 = phi i64 [ %14, %11 ], [ %5, %3 ]
%10 = icmp eq i64 %9, %7
br i1 %10, label %18, label %11
11: ; preds = %8
%12 = getelementptr inbounds i32, i32* %0, i64 %9
%13 = load i32, i32* %12
%14 = add nsw i64 %9, 1
%15 = getelementptr inbounds i32, i32* %0, i64 %14
%16 = load i32, i32* %15
%17 = icmp slt i32 %13, %16
br i1 %17, label %8, label %18
18: ; preds = %8, %11
%19 = sext i32 %4 to i64
%20 = icmp sge i64 %9, %19
ret i1 %20
}
void assert_not_reached() {
  printf(
      "Code should not be reached at %s:%u, function %s(). Aborting.",
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/poljar/rtorrent-cli/refs/heads/master/util.c",
      90, __func__);
  abort();
}


x86 assembly (clang, -O0):
<assert_not_reached>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xf0c(%rip),%rsi
mov    $0x5a,%edx
lea    0xf87(%rip),%rcx
mov    $0x0,%al
call   1040 <printf@plt>
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<assert_not_reached>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xf0f(%rip),%rsi
lea    0xf8f(%rip),%rcx
mov    $0x5a,%edx
xor    %eax,%eax
call   1040 <printf@plt>
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [62 x i8] c"Code should not be reached at %s:%u, function %s(). Aborting.\00"
@.str.1 = [135 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/poljar/rtorrent-cli/refs/heads/master/util.c\00"
@__func__.assert_not_reached = [19 x i8] c"assert_not_reached\00"
define void @assert_not_reached() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0), i32 90, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__func__.assert_not_reached, i64 0, i64 0))
unreachable
}

LLVM IR (-O2):
@.str = [62 x i8] c"Code should not be reached at %s:%u, function %s(). Aborting.\00"
@.str.1 = [135 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/poljar/rtorrent-cli/refs/heads/master/util.c\00"
@__func__.assert_not_reached = [19 x i8] c"assert_not_reached\00"
define void @assert_not_reached() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0), i32 90, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__func__.assert_not_reached, i64 0, i64 0))
tail call void @abort()
unreachable
}
/* Variables and functions */
int toascii(char);
int getsn4(char *str) {
  int i;
  int sum;
  sum = 0;
  for (i = 18; i < 23; i++) {
    sum = sum + toascii(str[i]);
  }
  return sum;
}


x86 assembly (clang, -O0):
<getsn4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x12,-0xc(%rbp)
cmpl   $0x17,-0xc(%rbp)
jge    1163 <getsn4+0x53>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <toascii@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <getsn4+0x1a>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getsn4>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
movsbl 0x12(%rdi),%edi
call   1030 <toascii@plt>
mov    %eax,%r14d
movsbl 0x13(%r15),%edi
call   1030 <toascii@plt>
mov    %eax,%ebp
add    %r14d,%ebp
movsbl 0x14(%r15),%edi
call   1030 <toascii@plt>
mov    %eax,%ebx
add    %ebp,%ebx
movsbl 0x15(%r15),%edi
call   1030 <toascii@plt>
mov    %eax,%ebp
add    %ebx,%ebp
movsbl 0x16(%r15),%edi
call   1030 <toascii@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @getsn4(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 18
%3 = load i8, i8* %2
%4 = tail call i32 @toascii(i8 signext %3)
%5 = getelementptr inbounds i8, i8* %0, i64 19
%6 = load i8, i8* %5
%7 = tail call i32 @toascii(i8 signext %6)
%8 = add nsw i32 %7, %4
%9 = getelementptr inbounds i8, i8* %0, i64 20
%10 = load i8, i8* %9
%11 = tail call i32 @toascii(i8 signext %10)
%12 = add nsw i32 %11, %8
%13 = getelementptr inbounds i8, i8* %0, i64 21
%14 = load i8, i8* %13
%15 = tail call i32 @toascii(i8 signext %14)
%16 = add nsw i32 %15, %12
%17 = getelementptr inbounds i8, i8* %0, i64 22
%18 = load i8, i8* %17
%19 = tail call i32 @toascii(i8 signext %18)
%20 = add nsw i32 %19, %16
ret i32 %20
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ fill_ipv4_lpm_table(int *, int, int /*<<< orphan*/);
void init_simple() {
  uint8_t ip[4] = {10, 0, 99, 99};
  uint32_t nhgrp = 0;
  fill_ipv4_lpm_table(ip, 16, nhgrp);
}


x86 assembly (clang, -O0):
<init_simple>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    $0x10,%esi
call   1030 <fill_ipv4_lpm_table@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_simple>:
sub    $0x18,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x10,%esi
xor    %edx,%edx
call   1030 <fill_ipv4_lpm_table@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.init_simple.ip = [4 x i32] [i32 10, i32 0, i32 99, i32 99]
define void @init_simple() {
%1 = alloca [4 x i32]
%2 = alloca i32
%3 = bitcast [4 x i32]* %1 to i8*
store i32 0, i32* %2
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @fill_ipv4_lpm_table(i32* %4, i32 16, i32 %5)
ret void
}

LLVM IR (-O2):
@__const.init_simple.ip = [4 x i32] [i32 10, i32 0, i32 99, i32 99]
define void @init_simple() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @fill_ipv4_lpm_table(i32* %3, i32 16, i32 0)
ret void
}
int gcd(int u, int v) {
  int t;
  if (u == 0 && v == 0)
    return 0;
  while (u > 0) {
    if (u < v) {
      t = u;
      u = v;
      v = t;
    }
    u = u - v;
  }
  return v;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    112a <gcd+0x2a>
cmpl   $0x0,-0xc(%rbp)
jne    112a <gcd+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    116b <gcd+0x6b>
jmp    112f <gcd+0x2f>
cmpl   $0x0,-0x8(%rbp)
jle    1165 <gcd+0x65>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1157 <gcd+0x57>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    112f <gcd+0x2f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %esi,%ecx
or     %edi,%ecx
je     111f <gcd+0x1f>
mov    %esi,%eax
test   %edi,%edi
jle    111e <gcd+0x1e>
mov    %edi,%ecx
xchg   %ax,%ax
cmp    %eax,%edi
cmovl  %eax,%ecx
cmovl  %edi,%eax
sub    %eax,%ecx
mov    %ecx,%edi
jg     1110 <gcd+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @gcd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 0, i32* %3
br label %31
13: ; preds = %9, %2
br label %14
14: ; preds = %25, %13
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %29
17: ; preds = %14
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = load i32, i32* %4
store i32 %22, i32* %6
%23 = load i32, i32* %5
store i32 %23, i32* %4
%24 = load i32, i32* %6
store i32 %24, i32* %5
br label %25
25: ; preds = %21, %17
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = sub nsw i32 %26, %27
store i32 %28, i32* %4
br label %14
29: ; preds = %14
%30 = load i32, i32* %5
store i32 %30, i32* %3
br label %31
31: ; preds = %29, %12
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = or i32 %1, %0
%4 = icmp eq i32 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %15
7: ; preds = %5, %7
%8 = phi i32 [ %12, %7 ], [ %1, %5 ]
%9 = phi i32 [ %13, %7 ], [ %0, %5 ]
%10 = icmp slt i32 %9, %8
%11 = select i1 %10, i32 %8, i32 %9
%12 = select i1 %10, i32 %9, i32 %8
%13 = sub nsw i32 %11, %12
%14 = icmp sgt i32 %13, 0
br i1 %14, label %7, label %15
15: ; preds = %7, %5, %2
%16 = phi i32 [ 0, %2 ], [ %1, %5 ], [ %12, %7 ]
ret i32 %16
}
/* Variables and functions */
unsigned int exynos_5410_gpio_read(unsigned int);
unsigned int odroid_xu_gpio_read_15() {
  unsigned int bank_offset = 0x0C20;
  unsigned int bit_index = 2;
  return (exynos_5410_gpio_read(bank_offset) >> bit_index) & 0x1;
}


x86 assembly (clang, -O0):
<odroid_xu_gpio_read_15>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xc20,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <exynos_5410_gpio_read@plt>
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
and    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<odroid_xu_gpio_read_15>:
push   %rax
mov    $0xc20,%edi
call   1030 <exynos_5410_gpio_read@plt>
shr    $0x2,%eax
and    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @odroid_xu_gpio_read_15() {
%1 = alloca i32
%2 = alloca i32
store i32 3104, i32* %1
store i32 2, i32* %2
%3 = load i32, i32* %1
%4 = call i32 @exynos_5410_gpio_read(i32 %3)
%5 = load i32, i32* %2
%6 = lshr i32 %4, %5
%7 = and i32 %6, 1
ret i32 %7
}

LLVM IR (-O2):
define i32 @odroid_xu_gpio_read_15() {
%1 = tail call i32 @exynos_5410_gpio_read(i32 3104)
%2 = lshr i32 %1, 2
%3 = and i32 %2, 1
ret i32 %3
}
void nested_loop2_Ok() {
  double arr[10];
  int i, j;
  for (i = 0; i < 10; i++) {
    for (j = 5; j < 15; j++) {
      arr[i] = 0.0;
      arr[j - 5] = 0.0;
    }
  }
}


x86 assembly (clang, -O0):
<nested_loop2_Ok>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x54(%rbp)
cmpl   $0xa,-0x54(%rbp)
jge    1165 <nested_loop2_Ok+0x65>
movl   $0x5,-0x58(%rbp)
cmpl   $0xf,-0x58(%rbp)
jge    1152 <nested_loop2_Ok+0x52>
movslq -0x54(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp,%rax,8)
mov    -0x58(%rbp),%eax
sub    $0x5,%eax
cltq
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp,%rax,8)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    111c <nested_loop2_Ok+0x1c>
jmp    1157 <nested_loop2_Ok+0x57>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    110b <nested_loop2_Ok+0xb>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @nested_loop2_Ok() {
%1 = alloca [10 x double]
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %2
br label %4
4: ; preds = %23, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %26
7: ; preds = %4
store i32 5, i32* %3
br label %8
8: ; preds = %19, %7
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 15
br i1 %10, label %11, label %22
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 %13
store double 0.000000e+00, double* %14
%15 = load i32, i32* %3
%16 = sub nsw i32 %15, 5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 %17
store double 0.000000e+00, double* %18
br label %19
19: ; preds = %11
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %8
22: ; preds = %8
br label %23
23: ; preds = %22
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %4
26: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @nested_loop2_Ok() {
ret void
}
/* Variables and functions */
int strncmp(char const *, char const *, size_t);
int r_strncmp(const char *s1, const char *s2, size_t n) {
  int ret = strncmp(s1, s2, (size_t)n);
  return ret;
}


x86 assembly (clang, -O0):
<r_strncmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <strncmp@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<r_strncmp>:
jmp    1030 <strncmp@plt>

LLVM IR (-O0):
define i32 @r_strncmp(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = call i32 @strncmp(i8* %8, i8* %9, i64 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
ret i32 %12
}

LLVM IR (-O2):
define i32 @r_strncmp(i8* nocapture %0, i8* nocapture %1, i64 %2) {
%4 = tail call i32 @strncmp(i8* %0, i8* %1, i64 %2)
ret i32 %4
}
int is_escaped(char *min, char *str) {
  int n = 0;
  while (--str >= min && *str == '\\')
    n++;
  return n % 2;
}


x86 assembly (clang, -O0):
<is_escaped>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rcx
mov    %al,-0x15(%rbp)
jb     113e <is_escaped+0x3e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    114e <is_escaped+0x4e>
jmp    115c <is_escaped+0x5c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <is_escaped+0x13>
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_escaped>:
add    $0xffffffffffffffff,%rsi
xor    %eax,%eax
cmp    %rdi,%rsi
jb     1121 <is_escaped+0x21>
xor    %eax,%eax
nopl   (%rax)
cmpb   $0x5c,(%rsi)
jne    1121 <is_escaped+0x21>
add    $0x1,%eax
add    $0xffffffffffffffff,%rsi
cmp    %rdi,%rsi
jae    1110 <is_escaped+0x10>
and    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @is_escaped(i8* readnone %0, i8* %1) {
%3 = getelementptr inbounds i8, i8* %1, i64 -1
%4 = icmp ult i8* %3, %0
br i1 %4, label %14, label %5
5: ; preds = %2, %10
%6 = phi i8* [ %12, %10 ], [ %3, %2 ]
%7 = phi i32 [ %11, %10 ], [ 0, %2 ]
%8 = load i8, i8* %6
%9 = icmp eq i8 %8, 92
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = add nuw nsw i32 %7, 1
%12 = getelementptr inbounds i8, i8* %6, i64 -1
%13 = icmp ult i8* %12, %0
br i1 %13, label %14, label %5
14: ; preds = %5, %10, %2
%15 = phi i32 [ 0, %2 ], [ %11, %10 ], [ %7, %5 ]
%16 = and i32 %15, 1
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ MAP_HUGETLB;
int /*<<< orphan*/ mmap_chunks_higher(int, int /*<<< orphan*/);
int /*<<< orphan*/ mmap_chunks_lower(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void alloc_huge(int chunks) {
  printf("Allocating hugepage chunks < 128TB \n");
  mmap_chunks_lower(chunks / 2, MAP_HUGETLB);
  printf("Allocating hugepage chunks > 128TB \n");
  mmap_chunks_higher(chunks / 2, MAP_HUGETLB);
}


x86 assembly (clang, -O0):
<alloc_huge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    0x2e95(%rip),%rax
mov    (%rax),%esi
call   1050 <mmap_chunks_lower@plt>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    0x2e6e(%rip),%rax
mov    (%rax),%esi
call   1040 <mmap_chunks_higher@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_huge>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%ebp
shr    $0x1f,%ebp
add    %ebx,%ebp
sar    %ebp
mov    0x2e9f(%rip),%rbx
mov    (%rbx),%esi
mov    %ebp,%edi
call   1050 <mmap_chunks_lower@plt>
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%esi
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <mmap_chunks_higher@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"Allocating hugepage chunks < 128TB \0A\00"
@MAP_HUGETLB = global i32 0
@.str.1 = [37 x i8] c"Allocating hugepage chunks > 128TB \0A\00"
define void @alloc_huge(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = sdiv i32 %4, 2
%6 = load i32, i32* @MAP_HUGETLB
%7 = call i32 @mmap_chunks_lower(i32 %5, i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* %2
%10 = sdiv i32 %9, 2
%11 = load i32, i32* @MAP_HUGETLB
%12 = call i32 @mmap_chunks_higher(i32 %10, i32 %11)
ret void
}

LLVM IR (-O2):
@MAP_HUGETLB = global i32 0
@str = [36 x i8] c"Allocating hugepage chunks < 128TB \00"
@str.2 = [36 x i8] c"Allocating hugepage chunks > 128TB \00"
define void @alloc_huge(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%3 = sdiv i32 %0, 2
%4 = load i32, i32* @MAP_HUGETLB
%5 = tail call i32 @mmap_chunks_lower(i32 %3, i32 %4)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.2, i64 0, i64 0))
%7 = load i32, i32* @MAP_HUGETLB
%8 = tail call i32 @mmap_chunks_higher(i32 %3, i32 %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ atrshmlog_the_env();
char *getenv(int /*<<< orphan*/);
char *atrshmlog_getenv() { return getenv(atrshmlog_the_env()); }


x86 assembly (clang, -O0):
<atrshmlog_getenv>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <atrshmlog_the_env@plt>
mov    %eax,%edi
call   1030 <getenv@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<atrshmlog_getenv>:
push   %rax
xor    %eax,%eax
call   1040 <atrshmlog_the_env@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <getenv@plt>

LLVM IR (-O0):
define i8* @atrshmlog_getenv() {
%1 = call i32 (...) @atrshmlog_the_env()
%2 = call i8* @getenv(i32 %1)
ret i8* %2
}

LLVM IR (-O2):
define i8* @atrshmlog_getenv() {
%1 = tail call i32 (...) @atrshmlog_the_env()
%2 = tail call i8* @getenv(i32 %1)
ret i8* %2
}
_Bool CAS(int *loc, int old_val, int new_val) {
  _Bool preCond;
  ;
  preCond = (*loc == old_val);
  if (preCond) {
    *loc = new_val;
  };
  return preCond;
}


x86 assembly (clang, -O0):
<CAS>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
cmp    -0xc(%rbp),%eax
sete   %al
and    $0x1,%al
mov    %al,-0x11(%rbp)
testb  $0x1,-0x11(%rbp)
je     1132 <CAS+0x32>
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CAS>:
mov    (%rdi),%eax
cmp    %esi,%eax
jne    1108 <CAS+0x8>
mov    %edx,(%rdi)
cmp    %esi,%eax
sete   %al
ret

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

LLVM IR (-O2):
define zeroext i1 @CAS(i32* nocapture %0, i32 %1, i32 %2) {
%4 = load i32, i32* %0
%5 = icmp eq i32 %4, %1
br i1 %5, label %6, label %7
6: ; preds = %3
store i32 %2, i32* %0
br label %7
7: ; preds = %6, %3
ret i1 %5
}
void UARTFlowControlSet(unsigned long ulBase, unsigned long ulMode) {
  ;

  ;
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000030))) =
      (((*((volatile unsigned long *)(ulBase + 0x00000030))) &
        ~(0x00008000 | 0x00004000)) |
       ulMode);
}


x86 assembly (clang, -O0):
<UARTFlowControlSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x30(%rax),%rcx
and    $0xffffffffffff3fff,%rcx
or     -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x30(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTFlowControlSet>:
mov    $0xffffffffffff3fff,%rax
and    0x30(%rdi),%rax
or     %rsi,%rax
mov    %rax,0x30(%rdi)
ret

LLVM IR (-O0):
define void @UARTFlowControlSet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = add i64 %5, 48
%7 = inttoptr i64 %6 to i64*
%8 = load volatile i64, i64* %7
%9 = and i64 %8, -49153
%10 = load i64, i64* %4
%11 = or i64 %9, %10
%12 = load i64, i64* %3
%13 = add i64 %12, 48
%14 = inttoptr i64 %13 to i64*
store volatile i64 %11, i64* %14
ret void
}

LLVM IR (-O2):
define void @UARTFlowControlSet(i64 %0, i64 %1) {
%3 = add i64 %0, 48
%4 = inttoptr i64 %3 to i64*
%5 = load volatile i64, i64* %4
%6 = and i64 %5, -49153
%7 = or i64 %6, %1
store volatile i64 %7, i64* %4
ret void
}