xunge/DecIR huggingface dataset:
/* Variables and functions */
double f(void *);
double g(void *p) { return f(p); }


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

x86 assembly (clang, -O2):
<g>:
jmp    1030 <f@plt>

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

LLVM IR (-O2):
define double @g(i8* %0) {
%2 = tail call double @f(i8* %0)
ret double %2
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int _print_nb(int /*<<< orphan*/ *, int, int);
int printf_handle_flag_u(va_list *parameters) {
  return _print_nb(parameters, 1, 10);
}


x86 assembly (clang, -O0):
<printf_handle_flag_u>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
mov    $0xa,%edx
call   1030 <_print_nb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printf_handle_flag_u>:
mov    $0x1,%esi
mov    $0xa,%edx
jmp    1030 <_print_nb@plt>

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

LLVM IR (-O2):
define i32 @printf_handle_flag_u(i32* %0) {
%2 = tail call i32 @_print_nb(i32* %0, i32 1, i32 10)
ret i32 %2
}
void d2i_ECDSA_SIG(void) {}


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

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

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

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

/* Variables and functions */
int contains_data(int /*<<< orphan*/ *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int is_fat_32_fs(FILE *fp) {
  char *szMagic = "FAT32   ";
  return contains_data(fp, 0x52, szMagic, strlen(szMagic));
}


x86 assembly (clang, -O0):
<is_fat_32_fs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    %eax,%ecx
mov    $0x52,%esi
call   1040 <contains_data@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_fat_32_fs>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed2(%rip),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    $0x52,%esi
mov    %r14,%rdx
mov    %eax,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <contains_data@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"FAT32 \00"
define i32 @is_fat_32_fs(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
store i32* %0, i32** %2
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load i32*, i32** %2
%5 = load i8*, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
%8 = call i32 @contains_data(i32* %4, i32 82, i8* %5, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
@.str = [9 x i8] c"FAT32 \00"
define i32 @is_fat_32_fs(i32* %0) {
%2 = tail call i32 @strlen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @contains_data(i32* %0, i32 82, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 %3
}
/* Variables and functions */
unsigned long LONG_MAX;
unsigned long _dictNextPower(unsigned long size) {
  unsigned long i = 4;
  if (size >= LONG_MAX) {
    return LONG_MAX;
  }
  while (1) {
    if (i >= size) {
      return i;
    }
    i *= 2;
  }
}


x86 assembly (clang, -O0):
<_dictNextPower>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movq   $0x4,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2ec5(%rip),%rcx
cmp    (%rcx),%rax
jb     1137 <_dictNextPower+0x37>
mov    0x2eb5(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    1168 <_dictNextPower+0x68>
jmp    113c <_dictNextPower+0x3c>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jb     1157 <_dictNextPower+0x57>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1168 <_dictNextPower+0x68>
mov    -0x18(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    113c <_dictNextPower+0x3c>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_dictNextPower>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%rax
cmp    %rdi,%rax
jbe    112b <_dictNextPower+0x2b>
mov    $0x4,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rcx,%rax
add    %rcx,%rcx
cmp    %rdi,%rax
jb     1120 <_dictNextPower+0x20>
ret

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

LLVM IR (-O2):
@LONG_MAX = global i64 0
define i64 @_dictNextPower(i64 %0) {
%2 = load i64, i64* @LONG_MAX
%3 = icmp ugt i64 %2, %0
br i1 %3, label %4, label %8
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 4, %1 ]
%6 = icmp ult i64 %5, %0
%7 = shl i64 %5, 1
br i1 %6, label %4, label %8
8: ; preds = %4, %1
%9 = phi i64 [ %2, %1 ], [ %5, %4 ]
ret i64 %9
}
/* Variables and functions */
size_t strnlen(const char *s, size_t maxlen) {
  size_t len;
  for (len = 0; len < maxlen && s[len] != '\0'; len++)
    ;
  return len;
}


x86 assembly (clang, -O0):
<strnlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
cmp    -0x10(%rbp),%rcx
mov    %al,-0x19(%rbp)
jae    113c <strnlen+0x3c>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    114c <strnlen+0x4c>
jmp    1162 <strnlen+0x62>
jmp    1151 <strnlen+0x51>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1114 <strnlen+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strnlen>:
xor    %eax,%eax
test   %rsi,%rsi
je     1122 <strnlen+0x22>
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,(%rdi,%rax,1)
je     1122 <strnlen+0x22>
add    $0x1,%rax
cmp    %rax,%rsi
jne    1110 <strnlen+0x10>
mov    %rsi,%rax
ret

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

LLVM IR (-O2):
define i64 @strnlen(i8* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2, %9
%5 = phi i64 [ %10, %9 ], [ 0, %2 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = add nuw i64 %5, 1
%11 = icmp eq i64 %10, %1
br i1 %11, label %12, label %4
12: ; preds = %4, %9, %2
%13 = phi i64 [ 0, %2 ], [ %1, %9 ], [ %5, %4 ]
ret i64 %13
}
/* Variables and functions */
int /*<<< orphan*/ foo();
int f() { foo(); }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <foo@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f() {
%1 = alloca i32
%2 = call i32 (...) @foo()
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @f() {
%1 = tail call i32 (...) @foo()
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int chdir(const char *path) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<chdir>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ed9(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec0(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<chdir>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @chdir(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @ENOSYS
store i32 %3, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @chdir(i8* nocapture readnone %0) {
%2 = load i32, i32* @ENOSYS
store i32 %2, i32* @errno
ret i32 -1
}
/* Variables and functions */
int rand();
int getTime(int avgTime) { return (rand() % ((2 * avgTime) + 1)); }


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

x86 assembly (clang, -O2):
<getTime>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
lea    (%rbx,%rbx,1),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @getTime(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = shl nsw i32 %0, 1
%4 = or i32 %3, 1
%5 = srem i32 %2, %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ e_izpy();
int /*<<< orphan*/ e_sta();
int /*<<< orphan*/ e_writeback();
void e_sta_izpy() {
  e_izpy();
  e_sta();
  e_writeback();
}


x86 assembly (clang, -O0):
<e_sta_izpy>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <e_izpy@plt>
mov    $0x0,%al
call   1040 <e_sta@plt>
mov    $0x0,%al
call   1030 <e_writeback@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<e_sta_izpy>:
push   %rax
xor    %eax,%eax
call   1050 <e_izpy@plt>
xor    %eax,%eax
call   1040 <e_sta@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <e_writeback@plt>

LLVM IR (-O0):
define void @e_sta_izpy() {
%1 = call i32 (...) @e_izpy()
%2 = call i32 (...) @e_sta()
%3 = call i32 (...) @e_writeback()
ret void
}

LLVM IR (-O2):
define void @e_sta_izpy() {
%1 = tail call i32 (...) @e_izpy()
%2 = tail call i32 (...) @e_sta()
%3 = tail call i32 (...) @e_writeback()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ usleep(int);
void *timer_thread(void *arg) {
  while (1) {
    usleep(3000000);
    printf("\nHello from pthread!\n");
    printf("Enter 'q' to exit:");
  }
  return NULL;
}


x86 assembly (clang, -O0):
<timer_thread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x2dc6c0,%edi
call   1040 <usleep@plt>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
jmp    112c <timer_thread+0xc>

x86 assembly (clang, -O2):
<timer_thread>:
push   %r14
push   %rbx
push   %rax
lea    0xed8(%rip),%r14
lea    0xebe(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2dc6c0,%edi
call   1050 <usleep@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
jmp    1150 <timer_thread+0x20>

LLVM IR (-O0):
@.str = [22 x i8] c"\0AHello from pthread!\0A\00"
@.str.1 = [19 x i8] c"Enter 'q' to exit:\00"
define i8* @timer_thread(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1, %3
%4 = call i32 @usleep(i32 3000000)
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %3
}

LLVM IR (-O2):
@.str.1 = [19 x i8] c"Enter 'q' to exit:\00"
@str = [21 x i8] c"\0AHello from pthread!\00"
define noalias i8* @timer_thread(i8* nocapture readnone %0) {
br label %2
2: ; preds = %1, %2
%3 = tail call i32 @usleep(i32 3000000)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %2
}
void set_intptr(void *ptr, int val) { *(int *)ptr = val; }


x86 assembly (clang, -O0):
<set_intptr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_intptr>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @set_intptr(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 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
store i32 %5, i32* %7
ret void
}

LLVM IR (-O2):
define void @set_intptr(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ setopt(char *, char *);
char *strtok(char *, char *);
void setsingleopt(char *equation) {
  char *parname;
  char *parvalue;
  parname = strtok(equation, "=");
  parvalue = strtok(NULL, "=");
  setopt(parname, parvalue);
}


x86 assembly (clang, -O0):
<setsingleopt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xeb5(%rip),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <setopt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setsingleopt>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%r14
mov    %r14,%rsi
call   1030 <strtok@plt>
mov    %rax,%rbx
xor    %edi,%edi
mov    %r14,%rsi
call   1030 <strtok@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <setopt@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"=\00"
define void @setsingleopt(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @strtok(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %3
%7 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %4
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = call i32 @setopt(i8* %8, i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"=\00"
define void @setsingleopt(i8* %0) {
%2 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @setopt(i8* %2, i8* %3)
ret void
}
unsigned int tune3(unsigned int t) {
  return ((-t & 4095) * (255 & t * (t & t >> 13)) >> 12) +
         (127 & t * (234 & t >> 8 & t >> 3) >> (3 & t >> 14));
}


x86 assembly (clang, -O0):
<tune3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
sub    -0x4(%rbp),%eax
and    $0xfff,%eax
mov    -0x4(%rbp),%ecx
mov    -0x4(%rbp),%edx
mov    -0x4(%rbp),%esi
shr    $0xd,%esi
and    %esi,%edx
imul   %edx,%ecx
and    $0xff,%ecx
imul   %ecx,%eax
shr    $0xc,%eax
mov    -0x4(%rbp),%edx
mov    -0x4(%rbp),%ecx
shr    $0x8,%ecx
and    $0xea,%ecx
mov    -0x4(%rbp),%esi
shr    $0x3,%esi
and    %esi,%ecx
imul   %ecx,%edx
mov    -0x4(%rbp),%ecx
shr    $0xe,%ecx
and    $0x3,%ecx
shr    %cl,%edx
mov    %edx,%ecx
and    $0x7f,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tune3>:
mov    %edi,%ecx
mov    %edi,%edx
neg    %edx
and    $0xfff,%edx
mov    %edi,%esi
shr    $0x8,%esi
mov    %edi,%eax
shr    $0x3,%eax
and    %esi,%eax
mov    %edi,%esi
shr    $0xd,%esi
and    %edi,%esi
imul   %edi,%esi
movzbl %sil,%esi
and    $0xea,%eax
imul   %edi,%eax
shr    $0xe,%ecx
and    $0x3,%cl
shr    %cl,%eax
imul   %edx,%esi
shr    $0xc,%esi
and    $0x7f,%eax
add    %esi,%eax
ret

LLVM IR (-O0):
define i32 @tune3(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub i32 0, %3
%5 = and i32 %4, 4095
%6 = load i32, i32* %2
%7 = load i32, i32* %2
%8 = load i32, i32* %2
%9 = lshr i32 %8, 13
%10 = and i32 %7, %9
%11 = mul i32 %6, %10
%12 = and i32 255, %11
%13 = mul i32 %5, %12
%14 = lshr i32 %13, 12
%15 = load i32, i32* %2
%16 = load i32, i32* %2
%17 = lshr i32 %16, 8
%18 = and i32 234, %17
%19 = load i32, i32* %2
%20 = lshr i32 %19, 3
%21 = and i32 %18, %20
%22 = mul i32 %15, %21
%23 = load i32, i32* %2
%24 = lshr i32 %23, 14
%25 = and i32 3, %24
%26 = lshr i32 %22, %25
%27 = and i32 127, %26
%28 = add i32 %14, %27
ret i32 %28
}

LLVM IR (-O2):
define i32 @tune3(i32 %0) {
%2 = sub i32 0, %0
%3 = and i32 %2, 4095
%4 = lshr i32 %0, 13
%5 = and i32 %4, %0
%6 = mul i32 %5, %0
%7 = and i32 %6, 255
%8 = mul nuw nsw i32 %7, %3
%9 = lshr i32 %8, 12
%10 = lshr i32 %0, 8
%11 = and i32 %10, 234
%12 = lshr i32 %0, 3
%13 = and i32 %11, %12
%14 = mul i32 %13, %0
%15 = lshr i32 %0, 14
%16 = and i32 %15, 3
%17 = lshr i32 %14, %16
%18 = and i32 %17, 127
%19 = add nuw nsw i32 %9, %18
ret i32 %19
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() {
  printf("unknown CPU ID\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [15 x i8] c"unknown CPU ID\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
scalar_t__ close(int);
int /*<<< orphan*/ fail(char const *, char *);
void ipdivert_close(const char *test, int s) {
  if (close(s) < 0)
    fail(test, "close");
}


x86 assembly (clang, -O0):
<ipdivert_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <close@plt>
cmp    $0x0,%rax
jge    1151 <ipdivert_close+0x31>
mov    -0x8(%rbp),%rdi
lea    0xeb4(%rip),%rsi
call   1030 <fail@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipdivert_close>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
call   1040 <close@plt>
test   %rax,%rax
js     1132 <ipdivert_close+0x12>
pop    %rbx
ret
lea    0xec7(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fail@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"close\00"
define void @ipdivert_close(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 = call i64 @close(i32 %5)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = call i32 @fail(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %8, %2
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"close\00"
define void @ipdivert_close(i8* %0, i32 %1) {
%3 = tail call i64 @close(i32 %1)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @fail(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
main() {
  int i;
  for (i = 0; i < 256; i++)
    printf("%c", i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jge    1150 <main+0x40>
mov    -0x8(%rbp),%esi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xee3(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x100,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %9, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 256
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %6
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
br label %3
12: ; preds = %3
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 256
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
int test_imm_A0uint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0xA0 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_A0uint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 160
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int SubnetIsValid(unsigned char *subnet) {
  int fvalid = 0;
  if (subnet[0] != 0)
    fvalid = 1;
  return (fvalid);
}


x86 assembly (clang, -O0):
<SubnetIsValid>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
je     1126 <SubnetIsValid+0x26>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @SubnetIsValid(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 1, i32* %3
br label %10
10: ; preds = %9, %1
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @SubnetIsValid(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp ne i8 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("hello_world\n");
  printf("okay_bye");
  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)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str.1 = [9 x i8] c"okay_bye\00"
@str = [12 x i8] c"hello_world\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
float absolute(float num) {
  if (num >= 0) {
    return num;
  } else {
    return -num;
  }
}


x86 assembly (clang, -O0):
<absolute>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1129 <absolute+0x29>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1140 <absolute+0x40>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<absolute>:
movaps 0xef9(%rip),%xmm2
xorps  %xmm0,%xmm2
xorps  %xmm1,%xmm1
cmpnless %xmm0,%xmm1
andps  %xmm1,%xmm2
andnps %xmm0,%xmm1
orps   %xmm2,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @absolute(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fcmp oge float %4, 0.000000e+00
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load float, float* %3
store float %7, float* %2
br label %11
8: ; preds = %1
%9 = load float, float* %3
%10 = fneg float %9
store float %10, float* %2
br label %11
11: ; preds = %8, %6
%12 = load float, float* %2
ret float %12
}

LLVM IR (-O2):
define float @absolute(float %0) {
%2 = fcmp ult float %0, 0.000000e+00
%3 = fneg float %0
%4 = select i1 %2, float %3, float %0
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ closeNFC();
int /*<<< orphan*/ closeTCPsocket();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ turnOffLED();
void error(const char *msg) {
  perror(msg);
  closeTCPsocket();
  closeNFC();
  turnOffLED();
  exit(0);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
mov    $0x0,%al
call   1030 <closeTCPsocket@plt>
mov    $0x0,%al
call   1070 <closeNFC@plt>
mov    $0x0,%al
call   1050 <turnOffLED@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
call   1040 <perror@plt>
xor    %eax,%eax
call   1030 <closeTCPsocket@plt>
xor    %eax,%eax
call   1070 <closeNFC@plt>
xor    %eax,%eax
call   1050 <turnOffLED@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 (...) @closeTCPsocket()
%6 = call i32 (...) @closeNFC()
%7 = call i32 (...) @turnOffLED()
%8 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @error(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 (...) @closeTCPsocket()
%4 = tail call i32 (...) @closeNFC()
%5 = tail call i32 (...) @turnOffLED()
%6 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ __VERIFIER_assert(int);
float __VERIFIER_nondet_float();
int main(void) {
  float a = __VERIFIER_nondet_float();
  if (a < 0) {
    return 0;
  }
  __VERIFIER_assert(a != 1);
  return a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_float@plt>
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1154 <main+0x34>
movl   $0x0,-0x4(%rbp)
jmp    117e <main+0x5e>
movss  -0x8(%rbp),%xmm0
movss  0xe9f(%rip),%xmm1
ucomiss %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <__VERIFIER_assert@plt>
cvttss2si -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_float@plt>
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
ja     115b <main+0x3b>
movss  0xec2(%rip),%xmm1
cmpneqss %xmm0,%xmm1
movd   %xmm1,%edi
and    $0x1,%edi
movss  %xmm0,0xc(%rsp)
call   1030 <__VERIFIER_assert@plt>
cvttss2si 0xc(%rsp),%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
%3 = call float (...) @__VERIFIER_nondet_float()
store float %3, float* %2
%4 = load float, float* %2
%5 = fcmp olt float %4, 0.000000e+00
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 0, i32* %1
br label %14
7: ; preds = %0
%8 = load float, float* %2
%9 = fcmp une float %8, 1.000000e+00
%10 = zext i1 %9 to i32
%11 = call i32 @__VERIFIER_assert(i32 %10)
%12 = load float, float* %2
%13 = fptosi float %12 to i32
store i32 %13, i32* %1
br label %14
14: ; preds = %7, %6
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call float (...) @__VERIFIER_nondet_float()
%2 = fcmp olt float %1, 0.000000e+00
br i1 %2, label %8, label %3
3: ; preds = %0
%4 = fcmp une float %1, 1.000000e+00
%5 = zext i1 %4 to i32
%6 = tail call i32 @__VERIFIER_assert(i32 %5)
%7 = fptosi float %1 to i32
br label %8
8: ; preds = %0, %3
%9 = phi i32 [ %7, %3 ], [ 0, %0 ]
ret i32 %9
}
int Hundred(int n) {
  int number;
  number = n / 100;
  return number;
}


x86 assembly (clang, -O0):
<Hundred>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Hundred>:
movslq %edi,%rax
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @Hundred(i32 %0) {
%2 = sdiv i32 %0, 100
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ bar(int, int);
int /*<<< orphan*/ foo(int *);
int main() {
  int x[15], i;
  for (i = 0; i < 15; i++)
    x[i] = 4 * i;
  foo(x);
  bar(15, 5);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0xf,-0x44(%rbp)
jge    115c <main+0x3c>
mov    -0x44(%rbp),%ecx
shl    $0x2,%ecx
movslq -0x44(%rbp),%rax
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1136 <main+0x16>
lea    -0x40(%rbp),%rdi
call   1040 <foo@plt>
mov    $0xf,%edi
mov    $0x5,%esi
call   1030 <bar@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xeda(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xede(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movabs $0x3400000030,%rax
mov    %rax,0x30(%rsp)
movl   $0x38,0x38(%rsp)
mov    %rsp,%rdi
call   1040 <foo@plt>
mov    $0xf,%edi
mov    $0x5,%esi
call   1030 <bar@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [15 x i32]
%2 = bitcast [15 x i32]* %1 to i8*
%3 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 0
%4 = bitcast [15 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 0, i32 4, i32 8, i32 12>, <4 x i32>* %4
%5 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 4
%6 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 16, i32 20, i32 24, i32 28>, <4 x i32>* %6
%7 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 8
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> <i32 32, i32 36, i32 40, i32 44>, <4 x i32>* %8
%9 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 12
store i32 48, i32* %9
%10 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 13
store i32 52, i32* %10
%11 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 14
store i32 56, i32* %11
%12 = call i32 @foo(i32* %3)
%13 = call i32 @bar(i32 15, i32 5)
ret i32 0
}
void atomic_store_n_gomp_task(struct gomp_task **ptr, struct gomp_task *val,
                              int memorder) {
  __atomic_store_n(ptr, val, memorder);
}


x86 assembly (clang, -O0):
<atomic_store_n_gomp_task>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rcx
mov    %rcx,-0x20(%rbp)
lea    -0x20(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
sub    $0x3,%eax
je     115f <atomic_store_n_gomp_task+0x5f>
jmp    113b <atomic_store_n_gomp_task+0x3b>
mov    -0x2c(%rbp),%eax
sub    $0x5,%eax
je     1172 <atomic_store_n_gomp_task+0x72>
jmp    114c <atomic_store_n_gomp_task+0x4c>
mov    -0x38(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rcx),%rcx
mov    %rcx,(%rax)
jmp    1180 <atomic_store_n_gomp_task+0x80>
mov    -0x38(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rcx),%rcx
mov    %rcx,(%rax)
jmp    1180 <atomic_store_n_gomp_task+0x80>
mov    -0x38(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
xchg   %rax,(%rcx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<atomic_store_n_gomp_task>:
cmp    $0x3,%edx
je     110e <atomic_store_n_gomp_task+0xe>
cmp    $0x5,%edx
jne    110e <atomic_store_n_gomp_task+0xe>
xchg   %rsi,(%rdi)
ret
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
%struct.gomp_task = type opaque
define void @atomic_store_n_gomp_task(%struct.gomp_task** %0, %struct.gomp_task* %1, i32 %2) {
%4 = alloca %struct.gomp_task**
%5 = alloca %struct.gomp_task*
%6 = alloca i32
%7 = alloca %struct.gomp_task*
store %struct.gomp_task** %0, %struct.gomp_task*** %4
store %struct.gomp_task* %1, %struct.gomp_task** %5
store i32 %2, i32* %6
%8 = load %struct.gomp_task**, %struct.gomp_task*** %4
%9 = load i32, i32* %6
%10 = load %struct.gomp_task*, %struct.gomp_task** %5
store %struct.gomp_task* %10, %struct.gomp_task** %7
%11 = bitcast %struct.gomp_task** %8 to i64*
%12 = bitcast %struct.gomp_task** %7 to i64*
switch i32 %9, label %13 [
i32 3, label %15
i32 5, label %17
]
13: ; preds = %3
%14 = load i64, i64* %12
store atomic i64 %14, i64* %11 monotonic
br label %19
15: ; preds = %3
%16 = load i64, i64* %12
store atomic i64 %16, i64* %11 release
br label %19
17: ; preds = %3
%18 = load i64, i64* %12
store atomic i64 %18, i64* %11 seq_cst
br label %19
19: ; preds = %17, %15, %13
ret void
}

LLVM IR (-O2):
%struct.gomp_task = type opaque
define void @atomic_store_n_gomp_task(%struct.gomp_task** nocapture writeonly %0, %struct.gomp_task* %1, i32 %2) {
%4 = bitcast %struct.gomp_task** %0 to i64*
switch i32 %2, label %5 [
i32 3, label %7
i32 5, label %9
]
5: ; preds = %3
%6 = ptrtoint %struct.gomp_task* %1 to i64
store atomic i64 %6, i64* %4 monotonic
br label %11
7: ; preds = %3
%8 = ptrtoint %struct.gomp_task* %1 to i64
store atomic i64 %8, i64* %4 release
br label %11
9: ; preds = %3
%10 = ptrtoint %struct.gomp_task* %1 to i64
store atomic i64 %10, i64* %4 seq_cst
br label %11
11: ; preds = %9, %7, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ stdio_helper_fake_printf(char *, float);
void soru_2(float x) {
  stdio_helper_fake_printf("%f", x);
  stdio_helper_fake_printf("%.2f", x);
}


x86 assembly (clang, -O0):
<soru_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
lea    0xed7(%rip),%rdi
call   1030 <stdio_helper_fake_printf@plt>
movss  -0x4(%rbp),%xmm0
lea    0xec9(%rip),%rdi
call   1030 <stdio_helper_fake_printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<soru_2>:
push   %rax
movss  %xmm0,0x4(%rsp)
lea    0xee2(%rip),%rdi
call   1030 <stdio_helper_fake_printf@plt>
lea    0xed9(%rip),%rdi
movss  0x4(%rsp),%xmm0
pop    %rax
jmp    1030 <stdio_helper_fake_printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [5 x i8] c"%.2f\00"
define void @soru_2(float %0) {
%2 = tail call i32 @stdio_helper_fake_printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float %0)
%3 = tail call i32 @stdio_helper_fake_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), float %0)
ret void
}
int given_number_includes_digit(int n, int digit) {
  int matches_found = 0;
  while (n) {
    int current_digit = n % 10;
    n = n / 10;
    if (current_digit == digit) {
      matches_found++;
    }
  }
  return matches_found;
}


x86 assembly (clang, -O0):
<given_number_includes_digit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1151 <given_number_includes_digit+0x51>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    114c <given_number_includes_digit+0x4c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1111 <given_number_includes_digit+0x11>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<given_number_includes_digit>:
xor    %eax,%eax
test   %edi,%edi
je     1147 <given_number_includes_digit+0x47>
cs nopw 0x0(%rax,%rax,1)
movslq %edi,%r9
imul   $0x66666667,%r9,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
lea    (%rdi,%rdi,1),%edx
lea    (%rdx,%rdx,4),%r8d
mov    %r9d,%edx
sub    %r8d,%edx
xor    %ecx,%ecx
cmp    %esi,%edx
sete   %cl
add    %ecx,%eax
add    $0x9,%r9d
cmp    $0x12,%r9d
ja     1110 <given_number_includes_digit+0x10>
ret

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

LLVM IR (-O2):
define i32 @given_number_includes_digit(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %14, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %8, %4 ], [ %0, %2 ]
%6 = phi i32 [ %11, %4 ], [ 0, %2 ]
%7 = srem i32 %5, 10
%8 = sdiv i32 %5, 10
%9 = icmp eq i32 %7, %1
%10 = zext i1 %9 to i32
%11 = add nuw nsw i32 %6, %10
%12 = add i32 %5, 9
%13 = icmp ult i32 %12, 19
br i1 %13, label %14, label %4
14: ; preds = %4, %2
%15 = phi i32 [ 0, %2 ], [ %11, %4 ]
ret i32 %15
}
void signal(int s) {
  extern void exit(int);
  exit(s);
}


x86 assembly (clang, -O0):
<signal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<signal>:
push   %rax
call   1030 <exit@plt>

LLVM IR (-O0):
define void @signal(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
unreachable
}

LLVM IR (-O2):
define void @signal(i32 %0) {
tail call void @exit(i32 %0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, size_t);
void *realloc(void *, size_t);
int /*<<< orphan*/ stderr;
void *wt_saferealloc(void *old_mem, size_t new_size) {
  if ((old_mem = realloc(old_mem, new_size)) == NULL) {
    fprintf(stderr,
            "ERROR: cbheap_saferealloc() cannot allocate"
            "%zu blocks of memory.\n",
            new_size);
    exit(EXIT_FAILURE);
  }
  return (old_mem);
}


x86 assembly (clang, -O0):
<wt_saferealloc>:
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   1040 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    1182 <wt_saferealloc+0x52>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe91(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wt_saferealloc>:
push   %rbx
mov    %rsi,%rbx
call   1040 <realloc@plt>
test   %rax,%rax
je     1140 <wt_saferealloc+0x10>
pop    %rbx
ret
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [66 x i8] c"ERROR: cbheap_saferealloc() cannot allocate%zu blocks of memory.\0A\00"
@EXIT_FAILURE = global i32 0
define i8* @wt_saferealloc(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 i8* @realloc(i8* %5, i64 %6)
store i8* %7, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i64, i64* %4
%12 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i64 %11)
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %2
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [66 x i8] c"ERROR: cbheap_saferealloc() cannot allocate%zu blocks of memory.\0A\00"
@EXIT_FAILURE = global i32 0
define noalias i8* @wt_saferealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i64 %1)
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %2
ret i8* %3
}
void BIO_copy_next_retry(void) {}


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

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

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

LLVM IR (-O2):
define void @BIO_copy_next_retry() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalpha(int);
void t_isalpha_0xb7() {
  Assert_real((isalpha(183) == 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_isalpha.c",
              920, ("isalpha should be 0 for 0xb7"));
}


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

x86 assembly (clang, -O2):
<t_isalpha_0xb7>:
push   %rax
mov    $0xb7,%edi
call   1030 <isalpha@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x398,%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_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0xb7\00"
define void @t_isalpha_0xb7() {
%1 = call i64 @isalpha(i32 183)
%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 920, i8* getelementptr inbounds ([29 x i8], [29 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_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0xb7\00"
define void @t_isalpha_0xb7() {
%1 = tail call i64 @isalpha(i32 183)
%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 920, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void load_preshared_secrets(int whackfd) {}


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

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

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

LLVM IR (-O2):
define void @load_preshared_secrets(i32 %0) {
ret void
}