xunge/DecIR huggingface dataset:
/* Type definitions */
struct list_head {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ INIT_LIST_HEAD(struct list_head *);
int /*<<< orphan*/ list_replace(struct list_head *, struct list_head *);
void list_replace_init(struct list_head *old, struct list_head *new_item) {
  list_replace(old, new_item);
  INIT_LIST_HEAD(old);
}


x86 assembly (clang, -O0):
<list_replace_init>:
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 <list_replace@plt>
mov    -0x8(%rbp),%rdi
call   1030 <INIT_LIST_HEAD@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_replace_init>:
push   %rbx
mov    %rdi,%rbx
call   1040 <list_replace@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <INIT_LIST_HEAD@plt>

LLVM IR (-O0):
%struct.list_head = type { i32 }
define void @list_replace_init(%struct.list_head* %0, %struct.list_head* %1) {
%3 = alloca %struct.list_head*
%4 = alloca %struct.list_head*
store %struct.list_head* %0, %struct.list_head** %3
store %struct.list_head* %1, %struct.list_head** %4
%5 = load %struct.list_head*, %struct.list_head** %3
%6 = load %struct.list_head*, %struct.list_head** %4
%7 = call i32 @list_replace(%struct.list_head* %5, %struct.list_head* %6)
%8 = load %struct.list_head*, %struct.list_head** %3
%9 = call i32 @INIT_LIST_HEAD(%struct.list_head* %8)
ret void
}

LLVM IR (-O2):
%struct.list_head = type { i32 }
define void @list_replace_init(%struct.list_head* %0, %struct.list_head* %1) {
%3 = tail call i32 @list_replace(%struct.list_head* %0, %struct.list_head* %1)
%4 = tail call i32 @INIT_LIST_HEAD(%struct.list_head* %0)
ret void
}
int MBtoKB(int mb) { return (mb * 1024); }


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

x86 assembly (clang, -O2):
<MBtoKB>:
mov    %edi,%eax
shl    $0xa,%eax
ret

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

LLVM IR (-O2):
define i32 @MBtoKB(i32 %0) {
%2 = shl nsw i32 %0, 10
ret i32 %2
}
/* Type definitions */
struct TennisGame {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ TennisGame_P2Score(struct TennisGame *);
void TennisGame_SetP2Score(struct TennisGame *game, int number) {
  for (int i = 0; i < number; i++) {
    TennisGame_P2Score(game);
  }
}


x86 assembly (clang, -O0):
<TennisGame_SetP2Score>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1149 <TennisGame_SetP2Score+0x39>
mov    -0x8(%rbp),%rdi
call   1030 <TennisGame_P2Score@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <TennisGame_SetP2Score+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TennisGame_SetP2Score>:
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
jle    112d <TennisGame_SetP2Score+0x1d>
mov    %esi,%ebx
mov    %rdi,%r14
nopl   (%rax)
mov    %r14,%rdi
call   1030 <TennisGame_P2Score@plt>
add    $0xffffffff,%ebx
jne    1120 <TennisGame_SetP2Score+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.TennisGame = type { i32 }
define void @TennisGame_SetP2Score(%struct.TennisGame* %0, i32 %1) {
%3 = alloca %struct.TennisGame*
%4 = alloca i32
%5 = alloca i32
store %struct.TennisGame* %0, %struct.TennisGame** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %13, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = load %struct.TennisGame*, %struct.TennisGame** %3
%12 = call i32 @TennisGame_P2Score(%struct.TennisGame* %11)
br label %13
13: ; preds = %10
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
store i32 %15, i32* %5
br label %6
16: ; preds = %6
ret void
}

LLVM IR (-O2):
%struct.TennisGame = type { i32 }
define void @TennisGame_SetP2Score(%struct.TennisGame* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %5, label %4
4: ; preds = %5, %2
ret void
5: ; preds = %2, %5
%6 = phi i32 [ %8, %5 ], [ 0, %2 ]
%7 = tail call i32 @TennisGame_P2Score(%struct.TennisGame* %0)
%8 = add nuw nsw i32 %6, 1
%9 = icmp eq i32 %8, %1
br i1 %9, label %4, label %5
}
/* Type definitions */
typedef scalar_t__ int32_t;

/* Variables and functions */
int icmp1(const void *p1, const void *p2) {
  int32_t i1 = *(int32_t *)p1;
  int32_t i2 = *(int32_t *)p2;
  if (i1 > i2)
    return 1;
  else if (i1 < i2)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<icmp1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jle    113c <icmp1+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    1162 <icmp1+0x62>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    1156 <icmp1+0x56>
movl   $0xffffffff,-0x4(%rbp)
jmp    1162 <icmp1+0x62>
jmp    115b <icmp1+0x5b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<icmp1>:
mov    (%rdi),%rax
mov    (%rsi),%rcx
xor    %edx,%edx
cmp    %rcx,%rax
setl   %dl
neg    %edx
cmp    %rcx,%rax
mov    $0x1,%eax
cmovle %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @icmp1(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = bitcast i8* %1 to i64*
%6 = load i64, i64* %5
%7 = icmp sgt i64 %4, %6
%8 = icmp slt i64 %4, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
/* Variables and functions */
int num_digits(int val) {
  int m = 10;
  int d = 1;
  if (val < 0) {
    d++;
    val = -val;
  }
  while (val >= m) {
    m *= 10;
    d++;
  }
  return d;
}


x86 assembly (clang, -O0):
<num_digits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1130 <num_digits+0x30>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1135 <num_digits+0x35>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1156 <num_digits+0x56>
imul   $0xa,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1135 <num_digits+0x35>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<num_digits>:
mov    %edi,%eax
mov    %edi,%ecx
neg    %ecx
cmovs  %edi,%ecx
shr    $0x1f,%eax
add    $0x1,%eax
cmp    $0xa,%ecx
jl     112c <num_digits+0x2c>
mov    $0xa,%edx
nopl   0x0(%rax)
add    %edx,%edx
lea    (%rdx,%rdx,4),%edx
add    $0x1,%eax
cmp    %edx,%ecx
jge    1120 <num_digits+0x20>
ret

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

LLVM IR (-O2):
define i32 @num_digits(i32 %0) {
%2 = icmp slt i32 %0, 0
%3 = sub nsw i32 0, %0
%4 = select i1 %2, i32 %3, i32 %0
%5 = select i1 %2, i32 2, i32 1
%6 = icmp slt i32 %4, 10
br i1 %6, label %13, label %7
7: ; preds = %1, %7
%8 = phi i32 [ %11, %7 ], [ %5, %1 ]
%9 = phi i32 [ %10, %7 ], [ 10, %1 ]
%10 = mul nsw i32 %9, 10
%11 = add nuw nsw i32 %8, 1
%12 = icmp slt i32 %4, %10
br i1 %12, label %13, label %7
13: ; preds = %7, %1
%14 = phi i32 [ %5, %1 ], [ %11, %7 ]
ret i32 %14
}
/* Type definitions */
typedef int /*<<< orphan*/ CERTIFICATEPOLICIES;
typedef int /*<<< orphan*/ ASN1_VALUE;

/* Variables and functions */
int /*<<< orphan*/ ASN1_item_free(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ CERTIFICATEPOLICIES_it;
void CERTIFICATEPOLICIES_free(CERTIFICATEPOLICIES *a) {
  ASN1_item_free((ASN1_VALUE *)a, &CERTIFICATEPOLICIES_it);
}


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

x86 assembly (clang, -O2):
<CERTIFICATEPOLICIES_free>:
mov    0x2ec9(%rip),%rsi
jmp    1030 <ASN1_item_free@plt>

LLVM IR (-O0):
@CERTIFICATEPOLICIES_it = global i32 0
define void @CERTIFICATEPOLICIES_free(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @ASN1_item_free(i32* %3, i32* @CERTIFICATEPOLICIES_it)
ret void
}

LLVM IR (-O2):
@CERTIFICATEPOLICIES_it = global i32 0
define void @CERTIFICATEPOLICIES_free(i32* %0) {
%2 = tail call i32 @ASN1_item_free(i32* %0, i32* @CERTIFICATEPOLICIES_it)
ret void
}
skip7(ptr7) char **ptr7;
{
  while (!(*(*ptr7)++ & 0x80))
    ;
}


x86 assembly (clang, -O0):
<skip7>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
movsbl (%rax),%eax
and    $0x80,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1136 <skip7+0x36>
jmp    113b <skip7+0x3b>
jmp    1108 <skip7+0x8>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip7>:
mov    (%rdi),%rax
add    $0x1,%rax
nopw   0x0(%rax,%rax,1)
mov    %rax,(%rdi)
cmpb   $0x0,-0x1(%rax)
lea    0x1(%rax),%rax
jns    1110 <skip7+0x10>
ret

LLVM IR (-O0):
define i32 @skip7(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
store i8** %0, i8*** %3
br label %4
4: ; preds = %13, %1
%5 = load i8**, i8*** %3
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %5
%8 = load i8, i8* %6
%9 = sext i8 %8 to i32
%10 = and i32 %9, 128
%11 = icmp ne i32 %10, 0
%12 = xor i1 %11, true
br i1 %12, label %13, label %14
13: ; preds = %4
br label %4
14: ; preds = %4
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @skip7(i8** nocapture %0) {
%2 = load i8*, i8** %0
br label %3
3: ; preds = %3, %1
%4 = phi i8* [ %5, %3 ], [ %2, %1 ]
%5 = getelementptr inbounds i8, i8* %4, i64 1
store i8* %5, i8** %0
%6 = load i8, i8* %4
%7 = icmp sgt i8 %6, -1
br i1 %7, label %3, label %8
8: ; preds = %3
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
int main(void) {
  char stringa[20];
  int counter = 100352 - 352;
  while (counter--) {
    sprintf(stringa, "%i\n", counter);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x186a0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x24(%rbp)
cmp    $0x0,%eax
je     1152 <main+0x42>
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xeb8(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1126 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    $0x1869f,%ebx
lea    0xedb(%rip),%r14
mov    %rsp,%r15
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1030 <sprintf@plt>
add    $0xffffffff,%ebx
jb     1130 <main+0x20>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 99999, %0 ], [ %6, %3 ]
%5 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = add nsw i32 %4, -1
%7 = icmp eq i32 %4, 0
br i1 %7, label %8, label %3
8: ; preds = %3
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
void *realloc(void *, size_t);
int /*<<< orphan*/ stderr;
void *reallocate(void *p, size_t size) {
  p = realloc(p, size);
  if (!p) {
    fputs("Out of memory.\n", stderr);
    exit(EXIT_FAILURE);
  }
  return p;
}


x86 assembly (clang, -O0):
<reallocate>:
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)
cmpq   $0x0,-0x8(%rbp)
jne    117f <reallocate+0x4f>
mov    0x2e7d(%rip),%rax
mov    (%rax),%esi
lea    0xe94(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reallocate>:
push   %rax
call   1040 <realloc@plt>
test   %rax,%rax
je     113d <reallocate+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%esi
lea    0xeb3(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"Out of memory.\0A\00"
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define i8* @reallocate(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 = load i8*, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %15, label %10
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = call i32 @fputs(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %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):
@.str = [16 x i8] c"Out of memory.\0A\00"
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define noalias i8* @reallocate(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 @fputs(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %2
ret i8* %3
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
void finalizer_scrub32(void *ptr) {
  uint64_t *sz_ptr = (uint64_t *)ptr;
  sz_ptr[0] = 0xa5a5a5a5a5a5a5a5ULL;
  sz_ptr[1] = 0xa5a5a5a5a5a5a5a5ULL;
  sz_ptr[2] = 0xa5a5a5a5a5a5a5a5ULL;
  sz_ptr[3] = 0xa5a5a5a5a5a5a5a5ULL;
}


x86 assembly (clang, -O0):
<finalizer_scrub32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0xa5a5a5a5,(%rax)
mov    -0x10(%rbp),%rax
movl   $0xa5a5a5a5,0x4(%rax)
mov    -0x10(%rbp),%rax
movl   $0xa5a5a5a5,0x8(%rax)
mov    -0x10(%rbp),%rax
movl   $0xa5a5a5a5,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<finalizer_scrub32>:
movaps 0xef9(%rip),%xmm0
movups %xmm0,(%rdi)
ret

LLVM IR (-O0):
define void @finalizer_scrub32(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 0
store i32 -1515870811, i32* %7
%8 = load i32*, i32** %3
%9 = getelementptr inbounds i32, i32* %8, i64 1
store i32 -1515870811, i32* %9
%10 = load i32*, i32** %3
%11 = getelementptr inbounds i32, i32* %10, i64 2
store i32 -1515870811, i32* %11
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 3
store i32 -1515870811, i32* %13
ret void
}

LLVM IR (-O2):
define void @finalizer_scrub32(i8* nocapture writeonly %0) {
ret void
}
/* Variables and functions */
int dev_urandom_read(unsigned char *, int);
int osrandom_rand_bytes(unsigned char *buffer, int size) {
  return dev_urandom_read(buffer, size);
}


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

x86 assembly (clang, -O2):
<osrandom_rand_bytes>:
jmp    1030 <dev_urandom_read@plt>

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

LLVM IR (-O2):
define i32 @osrandom_rand_bytes(i8* %0, i32 %1) {
%3 = tail call i32 @dev_urandom_read(i8* %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int array_index(char **, char const *);
int array_contains(char **strings, const char *str) {
  return array_index(strings, str) != -1;
}


x86 assembly (clang, -O0):
<array_contains>:
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 <array_index@plt>
cmp    $0xffffffff,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_contains>:
push   %rax
call   1030 <array_index@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @array_contains(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
store i8** %0, i8*** %3
store i8* %1, i8** %4
%5 = load i8**, i8*** %3
%6 = load i8*, i8** %4
%7 = call i32 @array_index(i8** %5, i8* %6)
%8 = icmp ne i32 %7, -1
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @array_contains(i8** %0, i8* %1) {
%3 = tail call i32 @array_index(i8** %0, i8* %1)
%4 = icmp ne i32 %3, -1
%5 = zext i1 %4 to i32
ret i32 %5
}
int LZ4_versionNumber(void) { return (1 * 100 * 100 + 8 * 100 + 3); }


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

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

LLVM IR (-O0):
define i32 @LZ4_versionNumber() {
ret i32 10803
}

LLVM IR (-O2):
define i32 @LZ4_versionNumber() {
ret i32 10803
}
unsigned int _check_times(unsigned x, unsigned y) {
  unsigned long long whole_ans =
      ((unsigned long long)x) * ((unsigned long long)y);
  unsigned word_ans = (unsigned)whole_ans;
  if (word_ans < whole_ans || word_ans > (1 << 28))
    (_throw_badalloc_fn("/scratch/repos/new/home/jordi_armengol_estape/"
                        "c-scraper/outputs/2022-01-22/02-19-57/repos/FauxFaux/"
                        "cyclone/refs/heads/master/bin/genfiles/filename.c",
                        284));
  return word_ans;
}


x86 assembly (clang, -O0):
<_check_times>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%rax
jb     114d <_check_times+0x3d>
cmpl   $0x10000000,-0x14(%rbp)
jbe    1160 <_check_times+0x50>
lea    0xeac(%rip),%rdi
mov    $0x11c,%esi
mov    $0x0,%al
call   1030 <_throw_badalloc_fn@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_check_times>:
push   %rbx
mov    %edi,%eax
mul    %esi
mov    %eax,%ebx
jo     1121 <_check_times+0x11>
cmp    $0x10000001,%ebx
jb     1134 <_check_times+0x24>
lea    0xed8(%rip),%rdi
mov    $0x11c,%esi
xor    %eax,%eax
call   1030 <_throw_badalloc_fn@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/FauxFaux/cyclone/refs/heads/master/bin/genfiles/filename.c\00"
define i32 @_check_times(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = zext i32 %7 to i64
%9 = load i32, i32* %4
%10 = zext i32 %9 to i64
%11 = mul i64 %8, %10
store i64 %11, i64* %5
%12 = load i64, i64* %5
%13 = trunc i64 %12 to i32
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = zext i32 %14 to i64
%16 = load i64, i64* %5
%17 = icmp ult i64 %15, %16
br i1 %17, label %21, label %18
18: ; preds = %2
%19 = load i32, i32* %6
%20 = icmp ugt i32 %19, 268435456
br i1 %20, label %21, label %23
21: ; preds = %18, %2
%22 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @_throw_badalloc_fn to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0), i32 284)
br label %23
23: ; preds = %21, %18
%24 = load i32, i32* %6
ret i32 %24
}

LLVM IR (-O2):
@.str = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/FauxFaux/cyclone/refs/heads/master/bin/genfiles/filename.c\00"
define i32 @_check_times(i32 %0, i32 %1) {
%3 = tail call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %0, i32 %1)
%4 = extractvalue { i32, i1 } %3, 0
%5 = extractvalue { i32, i1 } %3, 1
%6 = icmp ugt i32 %4, 268435456
%7 = or i1 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @_throw_badalloc_fn to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0), i32 284)
br label %10
10: ; preds = %2, %8
ret i32 %4
}
unsigned int(ata_tag_valid)(unsigned int tag) {
  int tmp;
  {
    if (tag < 1U) {
      tmp = 1;
    } else {
      tmp = 0;
    }
    return ((unsigned int)tmp);
  }
}


x86 assembly (clang, -O0):
<ata_tag_valid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jae    111d <ata_tag_valid+0x1d>
movl   $0x1,-0x8(%rbp)
jmp    1124 <ata_tag_valid+0x24>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ata_tag_valid>:
xor    %eax,%eax
test   %edi,%edi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @ata_tag_valid(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ kannotate_write(char *, int);
int strlen(char *);
void gator_annotate_marker_color_str(int color, char *string) {
  long long marker_annotation = 0x021c | ((long long)color << 16);
  kannotate_write((char *)&marker_annotation, 6);
  kannotate_write(string, strlen(string) + 1);
}


x86 assembly (clang, -O0):
<gator_annotate_marker_color_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x10,%rax
or     $0x21c,%rax
mov    %rax,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
mov    $0x6,%esi
call   1040 <kannotate_write@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
add    $0x1,%esi
call   1040 <kannotate_write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gator_annotate_marker_color_str>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
movslq %edi,%rax
shl    $0x10,%rax
or     $0x21c,%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x6,%esi
call   1040 <kannotate_write@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%esi
mov    %rbx,%rdi
call   1040 <kannotate_write@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @gator_annotate_marker_color_str(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = shl i64 %7, 16
%9 = or i64 540, %8
store i64 %9, i64* %5
%10 = bitcast i64* %5 to i8*
%11 = call i32 @kannotate_write(i8* %10, i32 6)
%12 = load i8*, i8** %4
%13 = load i8*, i8** %4
%14 = call i32 @strlen(i8* %13)
%15 = add nsw i32 %14, 1
%16 = call i32 @kannotate_write(i8* %12, i32 %15)
ret void
}

LLVM IR (-O2):
define void @gator_annotate_marker_color_str(i32 %0, i8* %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
%5 = sext i32 %0 to i64
%6 = shl nsw i64 %5, 16
%7 = or i64 %6, 540
store i64 %7, i64* %3
%8 = call i32 @kannotate_write(i8* %4, i32 6)
%9 = call i32 @strlen(i8* %1)
%10 = add nsw i32 %9, 1
%11 = call i32 @kannotate_write(i8* %1, i32 %10)
ret void
}
int IsFullName(const char *FilePath) {
  if (FilePath[0] == '/') {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<IsFullName>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1124 <IsFullName+0x24>
movl   $0x1,-0x4(%rbp)
jmp    112b <IsFullName+0x2b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsFullName>:
xor    %eax,%eax
cmpb   $0x2f,(%rdi)
sete   %al
ret

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

LLVM IR (-O2):
define i32 @IsFullName(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 47
%4 = zext i1 %3 to i32
ret i32 %4
}
signed int _divschar(signed char x, signed char y) { return ((int)x / (int)y); }


x86 assembly (clang, -O0):
<_divschar>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
movsbl -0x2(%rbp),%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<_divschar>:
mov    %edi,%eax
cwtd
idiv   %si
cwtl
ret

LLVM IR (-O0):
define i32 @_divschar(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = sdiv i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @_divschar(i8 signext %0, i8 signext %1) {
%3 = sext i8 %0 to i16
%4 = sext i8 %1 to i16
%5 = sdiv i16 %3, %4
%6 = sext i16 %5 to i32
ret i32 %6
}
void sk_pop_free(void) {}


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

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

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

LLVM IR (-O2):
define void @sk_pop_free() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ log_fatal_err(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ mdb_strerror(int);
void log_mdb_err(int rc) {
  log_fatal_err("lmdb error: %d, %s\n", rc, mdb_strerror(rc));
}


x86 assembly (clang, -O0):
<log_mdb_err>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <mdb_strerror@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xebb(%rip),%rdi
call   1030 <log_fatal_err@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_mdb_err>:
push   %rbx
mov    %edi,%ebx
call   1040 <mdb_strerror@plt>
lea    0xed1(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
pop    %rbx
jmp    1030 <log_fatal_err@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"lmdb error: %d, %s\0A\00"
define void @log_mdb_err(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @mdb_strerror(i32 %4)
%6 = call i32 @log_fatal_err(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"lmdb error: %d, %s\0A\00"
define void @log_mdb_err(i32 %0) {
%2 = tail call i32 @mdb_strerror(i32 %0)
%3 = tail call i32 @log_fatal_err(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %2)
ret void
}
/* Variables and functions */
int chdir(char const *);
int g_set_current_dir(const char *dirname) { return chdir(dirname); }


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

x86 assembly (clang, -O2):
<g_set_current_dir>:
jmp    1030 <chdir@plt>

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

LLVM IR (-O2):
define i32 @g_set_current_dir(i8* %0) {
%2 = tail call i32 @chdir(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage() {
  printf("\n"
         "\nusage: configurator <command>"
         "\n"
         "\n  <command> can be one of the following symbols:"
         "\n"
         "\n    char-bit_num"
         "\n    short-bit_num"
         "\n    int-bit_num"
         "\n    long-bit_num"
         "\n    long_long-bit_num"
         "\n    pointer-bit_num"
         "\n    float-bit_num"
         "\n    double-bit_num"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [231 x i8] c"\0A\0Ausage: configurator <command>\0A\0A <command> can be one of the following symbols:\0A\0A char-bit_num\0A short-bit_num\0A int-bit_num\0A long-bit_num\0A long_long-bit_num\0A pointer-bit_num\0A float-bit_num\0A double-bit_num\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([231 x i8], [231 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [230 x i8] c"\0A\0Ausage: configurator <command>\0A\0A <command> can be one of the following symbols:\0A\0A char-bit_num\0A short-bit_num\0A int-bit_num\0A long-bit_num\0A long_long-bit_num\0A pointer-bit_num\0A float-bit_num\0A double-bit_num\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([230 x i8], [230 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int O_NONBLOCK;
int fcntl(int, int /*<<< orphan*/, ...);
void set_nonblock(int fd) {
  int val;
  val = fcntl(fd, F_GETFL);
  if (val >= 0 && !(val & O_NONBLOCK))
    fcntl(fd, F_SETFL, val | O_NONBLOCK);
}


x86 assembly (clang, -O0):
<set_nonblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eab(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   1030 <fcntl@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     116f <set_nonblock+0x5f>
mov    -0x8(%rbp),%eax
mov    0x2ea3(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    116f <set_nonblock+0x5f>
mov    -0x4(%rbp),%edi
mov    0x2e7e(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
mov    0x2e82(%rip),%rax
or     (%rax),%edx
mov    $0x0,%al
call   1030 <fcntl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_nonblock>:
push   %rbx
mov    %edi,%ebx
mov    0x2eb6(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
call   1030 <fcntl@plt>
test   %eax,%eax
js     1134 <set_nonblock+0x24>
mov    0x2eba(%rip),%rcx
mov    (%rcx),%edx
test   %eax,%edx
je     1136 <set_nonblock+0x26>
pop    %rbx
ret
mov    0x2e9b(%rip),%rcx
mov    (%rcx),%esi
or     %eax,%edx
mov    %ebx,%edi
xor    %eax,%eax
pop    %rbx
jmp    1030 <fcntl@plt>

LLVM IR (-O0):
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
@F_SETFL = global i32 0
define void @set_nonblock(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @F_GETFL
%6 = call i32 (i32, i32, ...) @fcntl(i32 %4, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp sge i32 %7, 0
br i1 %8, label %9, label %21
9: ; preds = %1
%10 = load i32, i32* %3
%11 = load i32, i32* @O_NONBLOCK
%12 = and i32 %10, %11
%13 = icmp ne i32 %12, 0
br i1 %13, label %21, label %14
14: ; preds = %9
%15 = load i32, i32* %2
%16 = load i32, i32* @F_SETFL
%17 = load i32, i32* %3
%18 = load i32, i32* @O_NONBLOCK
%19 = or i32 %17, %18
%20 = call i32 (i32, i32, ...) @fcntl(i32 %15, i32 %16, i32 %19)
br label %21
21: ; preds = %14, %9, %1
ret void
}

LLVM IR (-O2):
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
@F_SETFL = global i32 0
define void @set_nonblock(i32 %0) {
%2 = load i32, i32* @F_GETFL
%3 = tail call i32 (i32, i32, ...) @fcntl(i32 %0, i32 %2)
%4 = icmp sgt i32 %3, -1
br i1 %4, label %5, label %13
5: ; preds = %1
%6 = load i32, i32* @O_NONBLOCK
%7 = and i32 %6, %3
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %5
%10 = load i32, i32* @F_SETFL
%11 = or i32 %6, %3
%12 = tail call i32 (i32, i32, ...) @fcntl(i32 %0, i32 %10, i32 %11)
br label %13
13: ; preds = %9, %5, %1
ret void
}
/* Variables and functions */
scalar_t__ abs(int);
int isreach_bishop(int dx, int dy) { return abs(dx) == abs(dy); }


x86 assembly (clang, -O0):
<isreach_bishop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <abs@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isreach_bishop>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
call   1030 <abs@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   1030 <abs@plt>
xor    %ecx,%ecx
cmp    %rax,%rbx
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @isreach_bishop(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 = call i64 @abs(i32 %5)
%7 = load i32, i32* %4
%8 = call i64 @abs(i32 %7)
%9 = icmp eq i64 %6, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @isreach_bishop(i32 %0, i32 %1) {
%3 = tail call i64 @abs(i32 %0)
%4 = tail call i64 @abs(i32 %1)
%5 = icmp eq i64 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ foo(void *);
char icharxor(char x, char y) {
  x ^= 24;
  if (!x)
    foo((void *)0);
  return x;
}


x86 assembly (clang, -O0):
<icharxor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
xor    $0x18,%eax
mov    %al,-0x1(%rbp)
cmpb   $0x0,-0x1(%rbp)
jne    1141 <icharxor+0x31>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <foo@plt>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<icharxor>:
push   %rbx
mov    %edi,%ebx
xor    $0x18,%bl
jne    111f <icharxor+0xf>
xor    %edi,%edi
call   1030 <foo@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @icharxor(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = xor i32 %6, 24
%8 = trunc i32 %7 to i8
store i8 %8, i8* %3
%9 = load i8, i8* %3
%10 = icmp ne i8 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = call i32 @foo(i8* null)
br label %13
13: ; preds = %11, %2
%14 = load i8, i8* %3
ret i8 %14
}

LLVM IR (-O2):
define signext i8 @icharxor(i8 signext %0, i8 signext %1) {
%3 = xor i8 %0, 24
%4 = icmp eq i8 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @foo(i8* null)
br label %7
7: ; preds = %5, %2
ret i8 %3
}
/* Variables and functions */
char *tokenParser(char *, char *, int, char *);
char *rodParser(char *header) {
  return tokenParser(header, " \t\n", 1, "rodParser");
}


x86 assembly (clang, -O0):
<rodParser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
mov    $0x1,%edx
lea    0xed1(%rip),%rcx
call   1030 <tokenParser@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rodParser>:
lea    0xee9(%rip),%rsi
lea    0xee6(%rip),%rcx
mov    $0x1,%edx
jmp    1030 <tokenParser@plt>

LLVM IR (-O0):
@.str = [4 x i8] c" \09\0A\00"
@.str.1 = [10 x i8] c"rodParser\00"
define i8* @rodParser(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @tokenParser(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
ret i8* %4
}

LLVM IR (-O2):
@.str = [4 x i8] c" \09\0A\00"
@.str.1 = [10 x i8] c"rodParser\00"
define i8* @rodParser(i8* %0) {
%2 = tail call i8* @tokenParser(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
ret i8* %2
}
/* Type definitions */
typedef long int32_t;
typedef int /*<<< orphan*/ bool_t;
typedef int /*<<< orphan*/ XDR;

/* Variables and functions */
int /*<<< orphan*/ xdrrec_getint32(int /*<<< orphan*/ *, long *);
bool_t xdrrec_getlong(XDR *xdrs, long *lp) {
  int32_t v = 0;
  bool_t r = xdrrec_getint32(xdrs, &v);
  *lp = v;
  return r;
}


x86 assembly (clang, -O0):
<xdrrec_getlong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <xdrrec_getint32@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdrrec_getlong>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rsi
call   1030 <xdrrec_getint32@plt>
mov    0x8(%rsp),%rcx
mov    %rcx,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @xdrrec_getlong(i32* %0, i64* nocapture writeonly %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
store i64 0, i64* %3
%5 = call i32 @xdrrec_getint32(i32* %0, i64* %3)
%6 = load i64, i64* %3
store i64 %6, i64* %1
ret i32 %5
}
int fstat(int filedes, struct stat *buf) { return -1; }


x86 assembly (clang, -O0):
<fstat>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.stat = type opaque
define i32 @fstat(i32 %0, %struct.stat* %1) {
%3 = alloca i32
%4 = alloca %struct.stat*
store i32 %0, i32* %3
store %struct.stat* %1, %struct.stat** %4
ret i32 -1
}

LLVM IR (-O2):
%struct.stat = type opaque
define i32 @fstat(i32 %0, %struct.stat* nocapture readnone %1) {
ret i32 -1
}
OP(op, e6) { AND(ARG()); }


x86 assembly (clang, -O0):
<OP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <ARG@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1040 <AND@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OP>:
push   %rax
xor    %eax,%eax
call   1030 <ARG@plt>
mov    %eax,%edi
xor    %eax,%eax
pop    %rcx
jmp    1040 <AND@plt>

LLVM IR (-O0):
define i32 @OP(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = call i32 (...) @ARG()
%7 = call i32 (i32, ...) bitcast (i32 (...)* @AND to i32 (i32, ...)*)(i32 %6)
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @ARG()
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @AND to i32 (i32, ...)*)(i32 %3)
ret i32 undef
}
decode_char(char in) { return ((in) - ' ') & 63; }


x86 assembly (clang, -O0):
<decode_char>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
sub    $0x20,%eax
and    $0x3f,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_char>:
add    $0x20,%dil
and    $0x3f,%dil
movzbl %dil,%eax
ret

LLVM IR (-O0):
define i32 @decode_char(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = sub nsw i32 %4, 32
%6 = and i32 %5, 63
ret i32 %6
}

LLVM IR (-O2):
define i32 @decode_char(i8 signext %0) {
%2 = add i8 %0, 32
%3 = and i8 %2, 63
%4 = zext i8 %3 to i32
ret i32 %4
}
int main() {
  int in;
  int out;
  __asm__("");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
tail call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"()
ret i32 0
}
/* Variables and functions */
char *getenv(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ puts(char *);
int main(void) {
  char *env = (char *)malloc(512);
  env = getenv("SystemDrive");
  puts(env);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x200,%edi
call   1050 <malloc@plt>
lea    0xebe(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"SystemDrive\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i64 @malloc(i32 512)
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %2
%5 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @puts(i8* %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"SystemDrive\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 512)
%2 = tail call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) %2)
ret i32 0
}
/* Variables and functions */
int pow(double, int);
double libballistics_calcFA(double altitude) {
  double FA = -4e-15 * pow(altitude, 3) + 4e-10 * pow(altitude, 2) -
              3e-5 * altitude + 1;
  return 1.0 / FA;
}


x86 assembly (clang, -O0):
<libballistics_calcFA>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x3,%edi
call   1030 <pow@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movsd  -0x18(%rbp),%xmm1
cvtsi2sd %eax,%xmm2
movsd  0xec3(%rip),%xmm0
mulsd  %xmm2,%xmm0
movsd  0xeaf(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  0xe92(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe7a(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe69(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<libballistics_calcFA>:
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
mov    $0x3,%edi
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xeb0(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  0xeaa(%rip),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0xe9c(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xe98(%rip),%xmm0
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @libballistics_calcFA(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call i32 @pow(double %4, i32 3)
%6 = sitofp i32 %5 to double
%7 = load double, double* %2
%8 = call i32 @pow(double %7, i32 2)
%9 = sitofp i32 %8 to double
%10 = fmul double 4.000000e-10, %9
%11 = call double @llvm.fmuladd.f64(double -4.000000e-15, double %6, double %10)
%12 = load double, double* %2
%13 = call double @llvm.fmuladd.f64(double -3.000000e-05, double %12, double %11)
%14 = fadd double %13, 1.000000e+00
store double %14, double* %3
%15 = load double, double* %3
%16 = fdiv double 1.000000e+00, %15
ret double %16
}

LLVM IR (-O2):
define double @libballistics_calcFA(double %0) {
%2 = tail call i32 @pow(double %0, i32 3)
%3 = sitofp i32 %2 to double
%4 = tail call i32 @pow(double %0, i32 2)
%5 = sitofp i32 %4 to double
%6 = fmul double %5, 4.000000e-10
%7 = tail call double @llvm.fmuladd.f64(double %3, double -4.000000e-15, double %6)
%8 = tail call double @llvm.fmuladd.f64(double %0, double -3.000000e-05, double %7)
%9 = fadd double %8, 1.000000e+00
%10 = fdiv double 1.000000e+00, %9
ret double %10
}