xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *, int);
void congratulateStudent(char *student, char *course, int numDays) {
  printf("%s has done as much %s _Programming as I could fit into %d days.\n",
         student, course, numDays);
}


x86 assembly (clang, -O0):
<congratulateStudent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<congratulateStudent>:
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee1(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [66 x i8] c"%s has done as much %s _Programming as I could fit into %d days.\0A\00"
define void @congratulateStudent(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [66 x i8] c"%s has done as much %s _Programming as I could fit into %d days.\0A\00"
define void @congratulateStudent(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i32 %2)
ret void
}
/* Variables and functions */
void *alloc_test_malloc(size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *alloc_test_calloc(size_t nmemb, size_t bytes) {
  void *result;
  size_t total_bytes = nmemb * bytes;
  result = alloc_test_malloc(total_bytes);
  if (result == NULL) {
    return NULL;
  }
  memset(result, 0, total_bytes);
  return result;
}


x86 assembly (clang, -O0):
<alloc_test_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <alloc_test_malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1162 <alloc_test_calloc+0x42>
movq   $0x0,-0x8(%rbp)
jmp    1179 <alloc_test_calloc+0x59>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_test_calloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
imul   %rsi,%rbx
mov    %rbx,%rdi
call   1040 <alloc_test_malloc@plt>
mov    %rax,%r14
test   %rax,%rax
je     1148 <alloc_test_calloc+0x28>
mov    %r14,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @alloc_test_calloc(i64 %0, i64 %1) {
%3 = mul i64 %1, %0
%4 = tail call i8* @alloc_test_malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @memset(i8* %4, i32 0, i64 %3)
br label %8
8: ; preds = %2, %6
ret i8* %4
}
int DRV_UDIAG_VALUE_CHECK(unsigned int DiagValue) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @DRV_UDIAG_VALUE_CHECK(i32 %0) {
ret i32 0
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
char *mes(int i) {
  char *texto = (char *)malloc(10);
  switch (i) {
  case 0:
    strcpy(texto, "janeiro");
    break;
  case 1:
    strcpy(texto, "fevereiro");
    break;
  }
  return texto;
}


x86 assembly (clang, -O0):
<mes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    $0xa,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
test   %eax,%eax
je     115d <mes+0x3d>
jmp    114c <mes+0x2c>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
je     1172 <mes+0x52>
jmp    1182 <mes+0x62>
mov    -0x10(%rbp),%rdi
lea    0xe98(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1182 <mes+0x62>
mov    -0x10(%rbp),%rdi
lea    0xe8b(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mes>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0xa,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %ebp,%ebp
je     1144 <mes+0x24>
cmp    $0x1,%ebp
jne    1153 <mes+0x33>
lea    0xec6(%rip),%rsi
jmp    114b <mes+0x2b>
lea    0xeb5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"janeiro\00"
@.str.1 = [10 x i8] c"fevereiro\00"
define i8* @mes(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = call i64 @malloc(i32 10)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %3
%6 = load i32, i32* %2
switch i32 %6, label %13 [
i32 0, label %7
i32 1, label %10
]
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %13
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %1, %10, %7
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@.str = [8 x i8] c"janeiro\00"
@.str.1 = [10 x i8] c"fevereiro\00"
define i8* @mes(i32 %0) {
%2 = tail call i64 @malloc(i32 10)
%3 = inttoptr i64 %2 to i8*
switch i32 %0, label %8 [
i32 0, label %5
i32 1, label %4
]
4: ; preds = %1
br label %5
5: ; preds = %1, %4
%6 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %1 ]
%7 = tail call i32 @strcpy(i8* %3, i8* %6)
br label %8
8: ; preds = %5, %1
ret i8* %3
}
double anovapred(double *y, double *yhat) {
  double temp = y[0] - *yhat;
  return temp * temp;
}


x86 assembly (clang, -O0):
<anovapred>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<anovapred>:
movsd  (%rdi),%xmm0
subsd  (%rsi),%xmm0
mulsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @anovapred(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%6 = load double*, double** %3
%7 = getelementptr inbounds double, double* %6, i64 0
%8 = load double, double* %7
%9 = load double*, double** %4
%10 = load double, double* %9
%11 = fsub double %8, %10
store double %11, double* %5
%12 = load double, double* %5
%13 = load double, double* %5
%14 = fmul double %12, %13
ret double %14
}

LLVM IR (-O2):
define double @anovapred(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = fsub double %3, %4
%6 = fmul double %5, %5
ret double %6
}
int str_ncmp(char src1[], char src2[], int n) {
  int i;
  for (i = 0; i != n; i++) {
    if (src1[i] != src2[i]) {
      return 1;
      break;
    }
  }
  if (i == n) {
    return 0;
  }
}


x86 assembly (clang, -O0):
<str_ncmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     1161 <str_ncmp+0x61>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     114e <str_ncmp+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    1174 <str_ncmp+0x74>
jmp    1153 <str_ncmp+0x53>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1116 <str_ncmp+0x16>
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    1174 <str_ncmp+0x74>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_ncmp>:
test   %edx,%edx
je     1122 <str_ncmp+0x22>
mov    %edx,%eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
movzbl (%rdi,%rcx,1),%edx
cmp    (%rsi,%rcx,1),%dl
jne    1125 <str_ncmp+0x25>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1110 <str_ncmp+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @str_ncmp(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %17, label %5
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %16, %6
br i1 %8, label %17, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %16, %7 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %1, i64 %10
%14 = load i8, i8* %13
%15 = icmp eq i8 %12, %14
%16 = add nuw nsw i64 %10, 1
br i1 %15, label %7, label %17
17: ; preds = %9, %7, %3
%18 = phi i32 [ 0, %3 ], [ 0, %7 ], [ 1, %9 ]
ret i32 %18
}
void CRYPTO_set_mem_debug_options(void) {}


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

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

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

LLVM IR (-O2):
define void @CRYPTO_set_mem_debug_options() {
ret void
}
/* Variables and functions */
size_t mstrlen(const char *str) {
  size_t len;
  len = 0;
  while (str[len] != '\0') {
    len += 1;
  }
  return (len);
}


x86 assembly (clang, -O0):
<mstrlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1136 <mstrlen+0x36>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <mstrlen+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @mstrlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %7, %2 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i64 %3
}
/* Variables and functions */
int setregid(int, int);
int main(void) { return setregid(-1, -1); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xffffffff,%esi
mov    %esi,%edi
call   1030 <setregid@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0xffffffff,%edi
mov    $0xffffffff,%esi
jmp    1030 <setregid@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @setregid(i32 -1, i32 -1)
ret i32 %1
}
cbuf31(f, n) int f, n;
{ cbuf(f, n, 31); }


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

x86 assembly (clang, -O2):
<cbuf31>:
mov    $0x1f,%edx
xor    %eax,%eax
jmp    1030 <cbuf@plt>

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

LLVM IR (-O2):
define i32 @cbuf31(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %0, i32 %1, i32 31)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int yyerror() {
  printf("\nInvalid variable name!!");
  exit(0);
}


x86 assembly (clang, -O0):
<yyerror>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<yyerror>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"\0AInvalid variable name!!\00"
define i32 @yyerror() {
%1 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [25 x i8] c"\0AInvalid variable name!!\00"
define i32 @yyerror() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ SerializeDouble(double, char *);
void tostr(double *m, char *outstr) { SerializeDouble(*m, outstr); }


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

x86 assembly (clang, -O2):
<tostr>:
movsd  (%rdi),%xmm0
mov    %rsi,%rdi
jmp    1030 <SerializeDouble@plt>

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

LLVM IR (-O2):
define void @tostr(double* nocapture %0, i8* %1) {
%3 = load double, double* %0
%4 = tail call i32 @SerializeDouble(double %3, i8* %1)
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t ReadBE64(const unsigned char *ptr) {
  return ((uint64_t)ptr[0] << 56 | (uint64_t)ptr[1] << 48 |
          (uint64_t)ptr[2] << 40 | (uint64_t)ptr[3] << 32 |
          (uint64_t)ptr[4] << 24 | (uint64_t)ptr[5] << 16 |
          (uint64_t)ptr[6] << 8 | (uint64_t)ptr[7]);
}


x86 assembly (clang, -O0):
<ReadBE64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    $0x38,%ecx
shl    %cl,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%edx
mov    $0x30,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%edx
mov    $0x28,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%edx
mov    $0x20,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x4(%rcx),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x5(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x6(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x7(%rcx),%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @ReadBE64(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl i32 %6, 56
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 48
%13 = or i32 %7, %12
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 2
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 40
%19 = or i32 %13, %18
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i64 3
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = shl i32 %23, 32
%25 = or i32 %19, %24
%26 = load i8*, i8** %2
%27 = getelementptr inbounds i8, i8* %26, i64 4
%28 = load i8, i8* %27
%29 = zext i8 %28 to i32
%30 = shl i32 %29, 24
%31 = or i32 %25, %30
%32 = load i8*, i8** %2
%33 = getelementptr inbounds i8, i8* %32, i64 5
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
%36 = shl i32 %35, 16
%37 = or i32 %31, %36
%38 = load i8*, i8** %2
%39 = getelementptr inbounds i8, i8* %38, i64 6
%40 = load i8, i8* %39
%41 = zext i8 %40 to i32
%42 = shl i32 %41, 8
%43 = or i32 %37, %42
%44 = load i8*, i8** %2
%45 = getelementptr inbounds i8, i8* %44, i64 7
%46 = load i8, i8* %45
%47 = zext i8 %46 to i32
%48 = or i32 %43, %47
ret i32 %48
}

LLVM IR (-O2):
define i32 @ReadBE64(i8* nocapture readnone %0) {
ret i32 poison
}
unsigned int strv_length(char *const *l) {
  unsigned n = 0;
  if (!l)
    return 0;
  for (; *l; l++)
    n++;
  return n;
}


x86 assembly (clang, -O0):
<strv_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1126 <strv_length+0x26>
movl   $0x0,-0x4(%rbp)
jmp    1159 <strv_length+0x59>
jmp    112b <strv_length+0x2b>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1153 <strv_length+0x53>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    112b <strv_length+0x2b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strv_length>:
xor    %eax,%eax
test   %rdi,%rdi
je     111c <strv_length+0x1c>
cmpq   $0x0,(%rdi)
je     111c <strv_length+0x1c>
xor    %eax,%eax
nop
cmpq   $0x0,0x8(%rdi,%rax,8)
lea    0x1(%rax),%rax
jne    1110 <strv_length+0x10>
ret

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

LLVM IR (-O2):
define i32 @strv_length(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %13, label %6
6: ; preds = %3, %6
%7 = phi i32 [ %9, %6 ], [ 0, %3 ]
%8 = phi i8** [ %10, %6 ], [ %0, %3 ]
%9 = add i32 %7, 1
%10 = getelementptr inbounds i8*, i8** %8, i64 1
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %6
13: ; preds = %6, %3, %1
%14 = phi i32 [ 0, %1 ], [ 0, %3 ], [ %9, %6 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ notify_pvcall(char *);
int pvSetPROMPage(char byBoardNum, int nPage) {
  notify_pvcall("f");
  return (0);
}


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

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

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

LLVM IR (-O2):
@.str = [2 x i8] c"f\00"
define i32 @pvSetPROMPage(i8 signext %0, i32 %1) {
%3 = tail call i32 @notify_pvcall(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isgraph(int);
void t_isgraph_0x4c() {
  Assert_real((isgraph(76)),
              "/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_isgraph.c",
              385, ("isgraph should be 1 for L"));
}


x86 assembly (clang, -O0):
<t_isgraph_0x4c>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4c,%edi
call   1040 <isgraph@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x181,%edx
lea    0xf65(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isgraph_0x4c>:
push   %rax
mov    $0x4c,%edi
call   1040 <isgraph@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x181,%edx
pop    %rax
jmp    1030 <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_isgraph.c\00"
@.str.1 = [26 x i8] c"isgraph should be 1 for L\00"
define void @t_isgraph_0x4c() {
%1 = call i32 @isgraph(i32 76)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 385, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [26 x i8] c"isgraph should be 1 for L\00"
define void @t_isgraph_0x4c() {
%1 = tail call i32 @isgraph(i32 76)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 385, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int ResetMETARGroup(int StartGroup, int SaveStartGroup) {
  enum METAR_obGroup {
    codename,
    stnid,
    NIL1,
    COR1,
    obDateTime,
    NIL2,
    AUTO,
    COR,
    windData,
    MinMaxWinDir,
    CAVOK,
    visibility,
    RVR,
    presentWX,
    skyCond,
    tempGroup,
    altimStng,
    NotIDed = 99
  };
  if (StartGroup == NotIDed && SaveStartGroup == NotIDed)
    return NotIDed;
  else if (StartGroup == NotIDed && SaveStartGroup != NotIDed &&
           SaveStartGroup != altimStng)
    return (++SaveStartGroup);
  else
    return (++SaveStartGroup);
}


x86 assembly (clang, -O0):
<ResetMETARGroup>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x63,-0x8(%rbp)
jne    112a <ResetMETARGroup+0x2a>
cmpl   $0x63,-0xc(%rbp)
jne    112a <ResetMETARGroup+0x2a>
movl   $0x63,-0x4(%rbp)
jmp    1165 <ResetMETARGroup+0x65>
cmpl   $0x63,-0x8(%rbp)
jne    1159 <ResetMETARGroup+0x59>
cmpl   $0x63,-0xc(%rbp)
je     1159 <ResetMETARGroup+0x59>
cmpl   $0x10,-0xc(%rbp)
je     1159 <ResetMETARGroup+0x59>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    %eax,-0x4(%rbp)
jmp    1165 <ResetMETARGroup+0x65>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ResetMETARGroup>:
cmp    $0x63,%edi
jne    1110 <ResetMETARGroup+0x10>
mov    $0x63,%eax
cmp    $0x63,%esi
jne    1110 <ResetMETARGroup+0x10>
ret
cmp    $0x63,%edi
jne    111d <ResetMETARGroup+0x1d>
cmp    $0x10,%esi
je     111d <ResetMETARGroup+0x1d>
cmp    $0x63,%esi
add    $0x1,%esi
mov    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @ResetMETARGroup(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 99
%4 = icmp eq i32 %1, 99
%5 = and i1 %3, %4
br i1 %5, label %12, label %6
6: ; preds = %2
br i1 %3, label %7, label %10
7: ; preds = %6
switch i32 %1, label %8 [
i32 99, label %10
i32 16, label %10
]
8: ; preds = %7
%9 = add nsw i32 %1, 1
br label %12
10: ; preds = %7, %7, %6
%11 = add nsw i32 %1, 1
br label %12
12: ; preds = %2, %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ], [ 99, %2 ]
ret i32 %13
}
int serial_haschar() {
  return ((*((volatile unsigned int *)((0x12000000 + 0x000) + 0x4))) &
          (1 << 0));
}


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

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

LLVM IR (-O0):
define i32 @serial_haschar() {
%1 = load volatile i32, i32* inttoptr (i64 301989892 to i32*)
%2 = and i32 %1, 1
ret i32 %2
}

LLVM IR (-O2):
define i32 @serial_haschar() {
%1 = load volatile i32, i32* inttoptr (i64 301989892 to i32*)
%2 = and i32 %1, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ gestion_erreurs_set(int, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, void *);
void gestion_erreurs_set1(int line, char *_file, char *_msg, void *_arg1) {
  char _temp[1024];
  sprintf(_temp, _msg, _arg1);
  gestion_erreurs_set(line, _file, _temp);
}


x86 assembly (clang, -O0):
<gestion_erreurs_set1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <sprintf@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x420(%rbp),%rdx
call   1040 <gestion_erreurs_set@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gestion_erreurs_set1>:
push   %rbp
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
call   1030 <sprintf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <gestion_erreurs_set@plt>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @gestion_erreurs_set1(i32 %0, i8* %1, i8* nocapture %2, i8* %3) {
%5 = alloca [1024 x i8]
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) %2, i8* %3)
%8 = call i32 @gestion_erreurs_set(i32 %0, i8* %1, i8* %6)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int fast_isascii(uint8_t c) { return (c > 0 && c <= 127); }


x86 assembly (clang, -O0):
<fast_isascii>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    1120 <fast_isascii+0x20>
cmpl   $0x7f,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fast_isascii>:
add    $0xffffffff,%edi
xor    %eax,%eax
cmp    $0x7f,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @fast_isascii(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 127
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @fast_isascii(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 127
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
char *U_WMRCORENONE_set(char *);
char *U_WMR6F_set(void) { return U_WMRCORENONE_set("U_WMR6F"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMR6F\00"
define i8* @U_WMR6F_set() {
%1 = call i8* @U_WMRCORENONE_set(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMR6F\00"
define i8* @U_WMR6F_set() {
%1 = tail call i8* @U_WMRCORENONE_set(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ IOwrite_to_LM1972_DATA_L();
void IOwrite_to_LM1972_DATA_pwrsave() { IOwrite_to_LM1972_DATA_L(); }


x86 assembly (clang, -O0):
<IOwrite_to_LM1972_DATA_pwrsave>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <IOwrite_to_LM1972_DATA_L@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @IOwrite_to_LM1972_DATA_pwrsave() {
%1 = call i32 (...) @IOwrite_to_LM1972_DATA_L()
ret void
}

LLVM IR (-O2):
define void @IOwrite_to_LM1972_DATA_pwrsave() {
%1 = tail call i32 (...) @IOwrite_to_LM1972_DATA_L()
ret void
}
void trace_bytecode(struct vm_method *method) {}


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

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

LLVM IR (-O0):
%struct.vm_method = type opaque
define void @trace_bytecode(%struct.vm_method* %0) {
%2 = alloca %struct.vm_method*
store %struct.vm_method* %0, %struct.vm_method** %2
ret void
}

LLVM IR (-O2):
%struct.vm_method = type opaque
define void @trace_bytecode(%struct.vm_method* nocapture %0) {
ret void
}
int ft_str_is_numeric(char *str) {
  int i;
  i = 0;
  while (str[i] != '\0') {
    if (str[i] < 48 || str[i] > 57)
      return (0);
    i++;
  }
  return (1);
}


x86 assembly (clang, -O0):
<ft_str_is_numeric>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1168 <ft_str_is_numeric+0x68>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jl     114e <ft_str_is_numeric+0x4e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jle    115a <ft_str_is_numeric+0x5a>
movl   $0x0,-0x4(%rbp)
jmp    116f <ft_str_is_numeric+0x6f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    110f <ft_str_is_numeric+0xf>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_str_is_numeric>:
mov    (%rdi),%cl
mov    $0x1,%eax
test   %cl,%cl
je     1123 <ft_str_is_numeric+0x23>
add    $0x1,%rdi
nop
add    $0xc6,%cl
cmp    $0xf5,%cl
jbe    1124 <ft_str_is_numeric+0x24>
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <ft_str_is_numeric+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_str_is_numeric(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %8
4: ; preds = %8
%5 = getelementptr inbounds i8, i8* %0, i64 %13
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %1, %4
%9 = phi i64 [ %13, %4 ], [ 0, %1 ]
%10 = phi i8 [ %6, %4 ], [ %2, %1 ]
%11 = add i8 %10, -58
%12 = icmp ult i8 %11, -10
%13 = add nuw i64 %9, 1
br i1 %12, label %14, label %4
14: ; preds = %8, %4, %1
%15 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %8 ]
ret i32 %15
}
/* Variables and functions */
int sethostname(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int uwsgi_hook_hostname(char *arg) { return sethostname(arg, strlen(arg)); }


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

x86 assembly (clang, -O2):
<uwsgi_hook_hostname>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <sethostname@plt>

LLVM IR (-O0):
define i32 @uwsgi_hook_hostname(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = call i32 @sethostname(i8* %3, i32 %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @uwsgi_hook_hostname(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @sethostname(i8* %0, i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int x = 5;
  int y = x + 1;
  printf("%i \n", y);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xece(%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
mov    $0x6,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%i \0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 6)
ret i32 0
}
int f4(int a, int b) {
  return ((((b) < (a) ? (b) : (a))) > (b) ? (((b) < (a) ? (b) : (a))) : (b));
}


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1121 <f4+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <f4+0x27>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    115b <f4+0x5b>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    114a <f4+0x4a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1150 <f4+0x50>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1161 <f4+0x61>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4>:
mov    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @f4(i32 %0, i32 returned %1) {
ret i32 %1
}
void f3() {
  const unsigned char G__1525983317999999999994352352523523993424999 = 0;
}


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

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

LLVM IR (-O0):
define void @f3() {
%1 = alloca i8
store i8 0, i8* %1
ret void
}

LLVM IR (-O2):
define void @f3() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
scalar_t__ test_1();
scalar_t__ test_2();
int main(int argc, char *argv[]) {
  if (test_1()) {
    printf("[!] Test-1 failed\n");
    return 1;
  }
  if (test_2()) {
    printf("[!] Test-2 failed\n");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <test_1@plt>
cmp    $0x0,%rax
je     116f <main+0x3f>
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    119f <main+0x6f>
mov    $0x0,%al
call   1050 <test_2@plt>
cmp    $0x0,%rax
je     1198 <main+0x68>
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    119f <main+0x6f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <test_1@plt>
test   %rax,%rax
je     1148 <main+0x18>
lea    0xecc(%rip),%rdi
jmp    115b <main+0x2b>
xor    %eax,%eax
call   1050 <test_2@plt>
test   %rax,%rax
je     1165 <main+0x35>
lea    0xea5(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"[!] Test-1 failed\0A\00"
@.str.1 = [19 x i8] c"[!] Test-2 failed\0A\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 i64 (...) @test_1()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %16
10: ; preds = %2
%11 = call i64 (...) @test_2()
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %16
15: ; preds = %10
store i32 0, i32* %3
br label %16
16: ; preds = %15, %13, %8
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@str = [18 x i8] c"[!] Test-2 failed\00"
@str.2 = [18 x i8] c"[!] Test-1 failed\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 (...) @test_1()
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i64 (...) @test_2()
%7 = icmp eq i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %5, %2
%9 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @str.2, i64 0, i64 0), %2 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0), %5 ]
%10 = tail call i32 @puts(i8* dereferenceable(1) %9)
br label %11
11: ; preds = %8, %5
%12 = phi i32 [ 0, %5 ], [ 1, %8 ]
ret i32 %12
}
void PrintGenericCall(void *theEnv, const char *logName, void *value) {}


x86 assembly (clang, -O0):
<PrintGenericCall>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @PrintGenericCall(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
ret void
}

LLVM IR (-O2):
define void @PrintGenericCall(i8* nocapture %0, i8* nocapture %1, i8* nocapture %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void main(void) {
  int i = 10;
  int j = 15;
  printf("%d\n", i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xa,-0x4(%rbp)
movl   $0xf,-0x8(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
lea    0xee9(%rip),%rdi
mov    $0xa,%esi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 10)
ret void
}
double fadd64(double x, double y) { return x + y; }


x86 assembly (clang, -O0):
<fadd64>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fadd64>:
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @fadd64(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fadd double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @fadd64(double %0, double %1) {
%3 = fadd double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ setState(int);
__attribute__((constructor)) void myInit1() { setState(2); }


x86 assembly (clang, -O0):
<myInit1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <setState@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<myInit1>:
mov    $0x2,%edi
jmp    1030 <setState@plt>

LLVM IR (-O0):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @myInit1, i8* null }]
define void @myInit1() {
%1 = call i32 @setState(i32 2)
ret void
}

LLVM IR (-O2):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @myInit1, i8* null }]
define void @myInit1() {
%1 = tail call i32 @setState(i32 2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void quit(char *msg) {
  fprintf(stderr, "%s\n", msg);
  exit(1);
}


x86 assembly (clang, -O0):
<quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<quit>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @quit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @quit(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}