xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ ofl_packet_in_reason_print(int /*<<< orphan*/ *,
                                              int /*<<< orphan*/);
int /*<<< orphan*/ *open_memstream(char **, size_t *);
char *ofl_packet_in_reason_to_string(uint8_t reason) {
  char *str;
  size_t str_size;
  FILE *stream = open_memstream(&str, &str_size);
  ofl_packet_in_reason_print(stream, reason);
  fclose(stream);
  return str;
}


x86 assembly (clang, -O0):
<ofl_packet_in_reason_to_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <open_memstream@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1050 <ofl_packet_in_reason_print@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ofl_packet_in_reason_to_string>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebp
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1030 <open_memstream@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %ebp,%esi
call   1050 <ofl_packet_in_reason_print@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0x8(%rsp),%rax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @ofl_packet_in_reason_to_string(i32 %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = bitcast i8** %2 to i8*
%5 = bitcast i64* %3 to i8*
%6 = call i32* @open_memstream(i8** %2, i64* %3)
%7 = call i32 @ofl_packet_in_reason_print(i32* %6, i32 %0)
%8 = call i32 @fclose(i32* %6)
%9 = load i8*, i8** %2
ret i8* %9
}
int power_of_two(unsigned int a) {
  if (a < 2) {
    return 0;
  }
  return (a & (a - 1)) == 0;
}


x86 assembly (clang, -O0):
<power_of_two>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jae    111d <power_of_two+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1136 <power_of_two+0x36>
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<power_of_two>:
xor    %eax,%eax
cmp    $0x2,%edi
jb     1111 <power_of_two+0x11>
lea    -0x1(%rdi),%ecx
xor    %eax,%eax
test   %ecx,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @power_of_two(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp ult i32 %4, 2
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %14
7: ; preds = %1
%8 = load i32, i32* %3
%9 = load i32, i32* %3
%10 = sub i32 %9, 1
%11 = and i32 %8, %10
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
store i32 %13, i32* %2
br label %14
14: ; preds = %7, %6
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @power_of_two(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i32 @llvm.ctpop.i32(i32 %0)
%5 = icmp ult i32 %4, 2
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 0, %1 ]
ret i32 %8
}
double math_step(double x) { return (x < 0) ? 0 : 1; }


x86 assembly (clang, -O0):
<math_step>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
xorps  %xmm0,%xmm0
mov    $0x1,%eax
xor    %ecx,%ecx
ucomisd %xmm1,%xmm0
cmova  %ecx,%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_step>:
xorpd  %xmm1,%xmm1
cmpnltsd %xmm1,%xmm0
movsd  0xeef(%rip),%xmm1
andpd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @math_step(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp olt double %3, 0.000000e+00
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 0, i32 1
%7 = sitofp i32 %6 to double
ret double %7
}

LLVM IR (-O2):
define double @math_step(double %0) {
%2 = fcmp uge double %0, 0.000000e+00
%3 = uitofp i1 %2 to double
ret double %3
}
double dot(double *vector1, double *vector2) {
  double dotProd = (vector1[0] * vector2[0]) + (vector1[1] * vector2[1]) +
                   (vector1[2] * vector2[2]);
  return dotProd;
}


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

x86 assembly (clang, -O2):
<dot>:
movsd  0x8(%rdi),%xmm0
mulsd  0x8(%rsi),%xmm0
movsd  (%rdi),%xmm1
mulsd  (%rsi),%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
mulsd  0x10(%rsi),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @dot(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 = getelementptr inbounds double, double* %9, i64 0
%11 = load double, double* %10
%12 = load double*, double** %3
%13 = getelementptr inbounds double, double* %12, i64 1
%14 = load double, double* %13
%15 = load double*, double** %4
%16 = getelementptr inbounds double, double* %15, i64 1
%17 = load double, double* %16
%18 = fmul double %14, %17
%19 = call double @llvm.fmuladd.f64(double %8, double %11, double %18)
%20 = load double*, double** %3
%21 = getelementptr inbounds double, double* %20, i64 2
%22 = load double, double* %21
%23 = load double*, double** %4
%24 = getelementptr inbounds double, double* %23, i64 2
%25 = load double, double* %24
%26 = call double @llvm.fmuladd.f64(double %22, double %25, double %19)
store double %26, double* %5
%27 = load double, double* %5
ret double %27
}

LLVM IR (-O2):
define double @dot(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = fmul double %6, %8
%10 = tail call double @llvm.fmuladd.f64(double %3, double %4, double %9)
%11 = getelementptr inbounds double, double* %0, i64 2
%12 = load double, double* %11
%13 = getelementptr inbounds double, double* %1, i64 2
%14 = load double, double* %13
%15 = tail call double @llvm.fmuladd.f64(double %12, double %14, double %10)
ret double %15
}
/* Variables and functions */
int /*<<< orphan*/ bmy_board_internal_call(char const *, int, char *, char *,
                                           char *);
void bmy_board_rename(int boardnum, char *name_en, char *name_zh_gbk,
                      char *secstr) {
  const char *sql = "CALL procedure_update_board(?, ?, ?, ?)";
  bmy_board_internal_call(sql, boardnum, name_en, name_zh_gbk, secstr);
}


x86 assembly (clang, -O0):
<bmy_board_rename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    0xed2(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
call   1030 <bmy_board_internal_call@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bmy_board_rename>:
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %edi,%esi
lea    0xede(%rip),%rdi
jmp    1030 <bmy_board_internal_call@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"CALL procedure_update_board(?, ?, ?, ?)\00"
define void @bmy_board_rename(i32 %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
store i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8** %9
%10 = load i8*, i8** %9
%11 = load i32, i32* %5
%12 = load i8*, i8** %6
%13 = load i8*, i8** %7
%14 = load i8*, i8** %8
%15 = call i32 @bmy_board_internal_call(i8* %10, i32 %11, i8* %12, i8* %13, i8* %14)
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"CALL procedure_update_board(?, ?, ?, ?)\00"
define void @bmy_board_rename(i32 %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i32 @bmy_board_internal_call(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %1, i8* %2, i8* %3)
ret void
}
/* Variables and functions */
long labs(long);
long __attribute__((no)) labsv(long a) { return labs(a); }


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

x86 assembly (clang, -O2):
<labsv>:
mov    %rdi,%rax
neg    %rax
cmovs  %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @labsv(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ merge(int *, int, int, int);
void mergeSort(int *arr, int low, int high) {
  int mid;
  if (low < high) {
    mid = (low + high) / 2;
    mergeSort(arr, low, mid);
    mergeSort(arr, mid + 1, high);
    merge(arr, low, mid, high);
  }
}


x86 assembly (clang, -O0):
<mergeSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1182 <mergeSort+0x62>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <mergeSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1030 <mergeSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1040 <merge@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mergeSort>:
cmp    %edx,%esi
jge    1172 <mergeSort+0x52>
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r12d
mov    %rdi,%r15
lea    (%r14,%r12,1),%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
mov    %ebx,%edx
call   1030 <mergeSort@plt>
lea    0x1(%rbx),%esi
mov    %r15,%rdi
mov    %r14d,%edx
call   1030 <mergeSort@plt>
mov    %r15,%rdi
mov    %r12d,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <merge@plt>
ret

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

LLVM IR (-O2):
define void @mergeSort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %6, label %5
5: ; preds = %3, %6
ret void
6: ; preds = %3
%7 = add nsw i32 %2, %1
%8 = sdiv i32 %7, 2
tail call void @mergeSort(i32* %0, i32 %1, i32 %8)
%9 = add nsw i32 %8, 1
tail call void @mergeSort(i32* %0, i32 %9, i32 %2)
%10 = tail call i32 @merge(i32* %0, i32 %1, i32 %8, i32 %2)
br label %5
}
/* Variables and functions */
int /*<<< orphan*/ defmac(char *);
void initmac(void) {
  defmac("cpm\t1");
  defmac("Z80\t1");
  defmac("smallc\t1");
}


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

x86 assembly (clang, -O2):
<initmac>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <defmac@plt>
lea    0xee2(%rip),%rdi
call   1030 <defmac@plt>
lea    0xedc(%rip),%rdi
pop    %rax
jmp    1030 <defmac@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"cpm\091\00"
@.str.1 = [6 x i8] c"Z80\091\00"
@.str.2 = [9 x i8] c"smallc\091\00"
define void @initmac() {
%1 = call i32 @defmac(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @defmac(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @defmac(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"cpm\091\00"
@.str.1 = [6 x i8] c"Z80\091\00"
@.str.2 = [9 x i8] c"smallc\091\00"
define void @initmac() {
%1 = tail call i32 @defmac(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @defmac(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @defmac(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ printf(char *);
scalar_t__ strlen(unsigned char *);
scalar_t__ write(int, unsigned char *, scalar_t__);
void WRITE_DHCPC_FILE(int fh, unsigned char *buf) {
  if (write(fh, buf, strlen(buf)) != strlen(buf)) {
    printf("Write udhcpc script file error!\n");
    close(fh);
  }
}


x86 assembly (clang, -O0):
<WRITE_DHCPC_FILE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    %rax,%rdx
call   1030 <write@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
je     11a6 <WRITE_DHCPC_FILE+0x66>
lea    0xe67(%rip),%rdi
call   1050 <printf@plt>
mov    -0x4(%rbp),%edi
call   1060 <close@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WRITE_DHCPC_FILE>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%r14d
mov    %rsi,%rdi
call   1050 <strlen@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1040 <write@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1050 <strlen@plt>
cmp    %rax,%rbp
jne    1175 <WRITE_DHCPC_FILE+0x35>
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe84(%rip),%rdi
call   1030 <puts@plt>
mov    %r14d,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <close@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"Write udhcpc script file error!\0A\00"
define void @WRITE_DHCPC_FILE(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i64 @strlen(i8* %7)
%9 = call i64 @write(i32 %5, i8* %6, i64 %8)
%10 = load i8*, i8** %4
%11 = call i64 @strlen(i8* %10)
%12 = icmp ne i64 %9, %11
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* %3
%16 = call i32 @close(i32 %15)
br label %17
17: ; preds = %13, %2
ret void
}

LLVM IR (-O2):
@str = [32 x i8] c"Write udhcpc script file error!\00"
define void @WRITE_DHCPC_FILE(i32 %0, i8* nocapture %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = tail call i64 @write(i32 %0, i8* %1, i64 %3)
%5 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%6 = icmp eq i64 %4, %5
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @close(i32 %0)
br label %10
10: ; preds = %7, %2
ret void
}
/* Variables and functions */
int f();
int main(void) {
  int tmp___0;
  {
    tmp___0 = f();
    if (!tmp___0) {
      tmp___0 = 4;
    }
    return (tmp___0);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <f@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    113a <main+0x2a>
movl   $0x4,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <f@plt>
test   %eax,%eax
mov    $0x4,%ecx
cmove  %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @f()
%2 = icmp eq i32 %1, 0
%3 = select i1 %2, i32 4, i32 %1
ret i32 %3
}
/* Variables and functions */
double floor(double);
double Int(double arg) { return (floor(arg)); }


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

x86 assembly (clang, -O2):
<Int>:
jmp    1030 <floor@plt>

LLVM IR (-O0):
define double @Int(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.floor.f64(double %3)
ret double %4
}

LLVM IR (-O2):
define double @Int(double %0) {
%2 = tail call double @llvm.floor.f64(double %0)
ret double %2
}
int fix_grade(int grade) {
  if (grade < 38) {
    return grade;
  }
  if ((grade + 2) % 5 == 0) {
    return grade + 2;
  }
  if ((grade + 1) % 5 == 0) {
    return grade + 1;
  }
  return grade;
}


x86 assembly (clang, -O0):
<fix_grade>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x26,-0x8(%rbp)
jge    111c <fix_grade+0x1c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116c <fix_grade+0x6c>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1141 <fix_grade+0x41>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
jmp    116c <fix_grade+0x6c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1166 <fix_grade+0x66>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    116c <fix_grade+0x6c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fix_grade>:
cmp    $0x26,%edi
jl     1128 <fix_grade+0x28>
lea    0x2(%rdi),%eax
imul   $0xcccccccd,%eax,%ecx
cmp    $0x33333334,%ecx
jb     112a <fix_grade+0x2a>
lea    0x1(%rdi),%eax
imul   $0xcccccccd,%eax,%ecx
cmp    $0x33333334,%ecx
cmovb  %eax,%edi
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @fix_grade(i32 %0) {
%2 = icmp slt i32 %0, 38
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = add nuw nsw i32 %0, 2
%5 = urem i32 %4, 5
%6 = icmp eq i32 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %3
%8 = add nuw nsw i32 %0, 1
%9 = urem i32 %8, 5
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i32 %8, i32 %0
br label %12
12: ; preds = %7, %3, %1
%13 = phi i32 [ %0, %1 ], [ %4, %3 ], [ %11, %7 ]
ret i32 %13
}
const char *jac_chain_nm6_name_in(int i) {
  switch (i) {
  case 0:
    return "i0";
  case 1:
    return "i1";
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<jac_chain_nm6_name_in>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     112b <jac_chain_nm6_name_in+0x2b>
jmp    111a <jac_chain_nm6_name_in+0x1a>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     113b <jac_chain_nm6_name_in+0x3b>
jmp    114b <jac_chain_nm6_name_in+0x4b>
lea    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <jac_chain_nm6_name_in+0x53>
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <jac_chain_nm6_name_in+0x53>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<jac_chain_nm6_name_in>:
xor    %ecx,%ecx
cmp    $0x1,%edi
lea    0xef7(%rip),%rax
cmove  %rax,%rcx
test   %edi,%edi
lea    0xee7(%rip),%rax
cmovne %rcx,%rax
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"i0\00"
@.str.1 = [3 x i8] c"i1\00"
define i8* @jac_chain_nm6_name_in(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* null
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isascii(int);
void t_isascii_0x8e() {
  Assert_real((isascii(142) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isascii.c",
              715, ("isascii should be 0 for 0x8e"));
}


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

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

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

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isascii.c\00"
@.str.1 = [29 x i8] c"isascii should be 0 for 0x8e\00"
define void @t_isascii_0x8e() {
%1 = tail call i64 @isascii(i32 142)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 715, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lookNarray(char *, unsigned int);
void lookreal8array_(void *x, unsigned int *n) {
  lookNarray((char *)x, (*n * 8));
}


x86 assembly (clang, -O0):
<lookreal8array_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
shl    $0x3,%esi
call   1030 <lookNarray@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookreal8array_>:
mov    (%rsi),%esi
shl    $0x3,%esi
jmp    1030 <lookNarray@plt>

LLVM IR (-O0):
define void @lookreal8array_(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 = load i32, i32* %6
%8 = mul i32 %7, 8
%9 = call i32 @lookNarray(i8* %5, i32 %8)
ret void
}

LLVM IR (-O2):
define void @lookreal8array_(i8* %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = shl i32 %3, 3
%5 = tail call i32 @lookNarray(i8* %0, i32 %4)
ret void
}
int gdt_compare_longlong(const void *p1, const void *p2) {
  long long n1 = *((long long *)p1);
  long long n2 = *((long long *)p2);
  if (n1 < n2) {
    return -1;
  } else if (n1 > n2) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<gdt_compare_longlong>:
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
jge    113c <gdt_compare_longlong+0x3c>
movl   $0xffffffff,-0x4(%rbp)
jmp    115d <gdt_compare_longlong+0x5d>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jle    1156 <gdt_compare_longlong+0x56>
movl   $0x1,-0x4(%rbp)
jmp    115d <gdt_compare_longlong+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gdt_compare_longlong>:
mov    (%rdi),%rax
xor    %ecx,%ecx
cmp    (%rsi),%rax
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

LLVM IR (-O0):
define i32 @gdt_compare_longlong(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 slt i64 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 -1, i32* %3
br label %24
18: ; preds = %2
%19 = load i64, i64* %6
%20 = load i64, i64* %7
%21 = icmp sgt i64 %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 1, i32* %3
br label %24
23: ; preds = %18
store i32 0, i32* %3
br label %24
24: ; preds = %23, %22, %17
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @gdt_compare_longlong(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 slt i64 %4, %6
%8 = icmp sgt i64 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int __attribute__((__section__("code_segment"))) my_init1(void) {
  printf("my_init () #1/n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"my_init ()/n\00"
define i32 @my_init1() section "code_segment" {
%1 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"my_init ()/n\00"
define i32 @my_init1() section "code_segment" {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
const char *Lock_Description(void) {
  return "The `Lock` class can be implemented by types to limit the access to "
         "them. "
         "For example this class is implemented by the `Mutex` type to provide "
         "mutual exclusion across Threads.";
}


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

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

LLVM IR (-O0):
@.str = [176 x i8] c"The `Lock` class can be implemented by types to limit the access to them. For example this class is implemented by the `Mutex` type to provide mutual exclusion across Threads.\00"
define i8* @Lock_Description() {
ret i8* getelementptr inbounds ([176 x i8], [176 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [176 x i8] c"The `Lock` class can be implemented by types to limit the access to them. For example this class is implemented by the `Mutex` type to provide mutual exclusion across Threads.\00"
define i8* @Lock_Description() {
ret i8* getelementptr inbounds ([176 x i8], [176 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ close_history_file();
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *get_history_file();
int /*<<< orphan*/ open_history_file();
int /*<<< orphan*/ perror(char *);
void append_history(char *command) {
  open_history_file();
  FILE *file = get_history_file();
  if (file != NULL) {
    fputs(command, file);
    close_history_file();
  } else {
    perror(" ERROR : cann't open history file");
  }
}


x86 assembly (clang, -O0):
<append_history>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1070 <open_history_file@plt>
mov    $0x0,%al
call   1030 <get_history_file@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1192 <append_history+0x42>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <fputs@plt>
mov    $0x0,%al
call   1050 <close_history_file@plt>
jmp    119e <append_history+0x4e>
lea    0xe67(%rip),%rdi
call   1060 <perror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<append_history>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1070 <open_history_file@plt>
xor    %eax,%eax
call   1030 <get_history_file@plt>
test   %rax,%rax
je     117a <append_history+0x2a>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <fputs@plt>
xor    %eax,%eax
pop    %rbx
jmp    1050 <close_history_file@plt>
lea    0xe7f(%rip),%rdi
pop    %rbx
jmp    1060 <perror@plt>

LLVM IR (-O0):
@.str = [34 x i8] c" ERROR : cann't open history file\00"
define void @append_history(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = call i32 (...) @open_history_file()
%5 = call i32* (...) @get_history_file()
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = icmp ne i32* %6, null
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = load i32*, i32** %3
%11 = call i32 @fputs(i8* %9, i32* %10)
%12 = call i32 (...) @close_history_file()
br label %15
13: ; preds = %1
%14 = call i32 @perror(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %8
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c" ERROR : cann't open history file\00"
define void @append_history(i8* nocapture %0) {
%2 = tail call i32 (...) @open_history_file()
%3 = tail call i32* (...) @get_history_file()
%4 = icmp eq i32* %3, null
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = tail call i32 @fputs(i8* %0, i32* %3)
%7 = tail call i32 (...) @close_history_file()
br label %10
8: ; preds = %1
%9 = tail call i32 @perror(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
ret void
}
/* Type definitions */
struct b6_heap {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ b6_heap_length(struct b6_heap const *);
int b6_heap_empty(const struct b6_heap *self) { return !b6_heap_length(self); }


x86 assembly (clang, -O0):
<b6_heap_empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <b6_heap_length@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<b6_heap_empty>:
push   %rax
call   1030 <b6_heap_length@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.b6_heap = type { i32 }
define i32 @b6_heap_empty(%struct.b6_heap* %0) {
%2 = alloca %struct.b6_heap*
store %struct.b6_heap* %0, %struct.b6_heap** %2
%3 = load %struct.b6_heap*, %struct.b6_heap** %2
%4 = call i32 @b6_heap_length(%struct.b6_heap* %3)
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
%struct.b6_heap = type { i32 }
define i32 @b6_heap_empty(%struct.b6_heap* %0) {
%2 = tail call i32 @b6_heap_length(%struct.b6_heap* %0)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
struct hostent {
  int dummy;
};
typedef enum nss_status { ____Placeholder_nss_status } nss_status;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int _nss_sqlite_gethostbyname2_r(char const *, int /*<<< orphan*/,
                                 struct hostent *, char *, size_t, int *,
                                 int *);
enum nss_status _nss_sqlite_gethostbyname_r(const char *name,
                                            struct hostent *result,
                                            char *buffer, size_t buflen,
                                            int *errnop, int *h_errnop) {
  return _nss_sqlite_gethostbyname2_r(name, AF_INET, result, buffer, buflen,
                                      errnop, h_errnop);
}


x86 assembly (clang, -O0):
<_nss_sqlite_gethostbyname_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    -0x30(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <_nss_sqlite_gethostbyname2_r@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_nss_sqlite_gethostbyname_r>:
push   %rax
mov    %r8,%rax
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    0x2ec4(%rip),%rsi
mov    (%rsi),%esi
mov    %r9,(%rsp)
mov    %rax,%r9
call   1030 <_nss_sqlite_gethostbyname2_r@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.hostent = type { i32 }
@AF_INET = global i32 0
define i32 @_nss_sqlite_gethostbyname_r(i8* %0, %struct.hostent* %1, i8* %2, i64 %3, i32* %4, i32* %5) {
%7 = alloca i8*
%8 = alloca %struct.hostent*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32*
%12 = alloca i32*
store i8* %0, i8** %7
store %struct.hostent* %1, %struct.hostent** %8
store i8* %2, i8** %9
store i64 %3, i64* %10
store i32* %4, i32** %11
store i32* %5, i32** %12
%13 = load i8*, i8** %7
%14 = load i32, i32* @AF_INET
%15 = load %struct.hostent*, %struct.hostent** %8
%16 = load i8*, i8** %9
%17 = load i64, i64* %10
%18 = load i32*, i32** %11
%19 = load i32*, i32** %12
%20 = call i32 @_nss_sqlite_gethostbyname2_r(i8* %13, i32 %14, %struct.hostent* %15, i8* %16, i64 %17, i32* %18, i32* %19)
ret i32 %20
}

LLVM IR (-O2):
%struct.hostent = type { i32 }
@AF_INET = global i32 0
define i32 @_nss_sqlite_gethostbyname_r(i8* %0, %struct.hostent* %1, i8* %2, i64 %3, i32* %4, i32* %5) {
%7 = load i32, i32* @AF_INET
%8 = tail call i32 @_nss_sqlite_gethostbyname2_r(i8* %0, i32 %7, %struct.hostent* %1, i8* %2, i64 %3, i32* %4, i32* %5)
ret i32 %8
}
/* Type definitions */
typedef int ptrdiff_t;

/* Variables and functions */
int /*<<< orphan*/ abort();
__attribute__((no)) void check(void *a) {
  if (((ptrdiff_t)a & (32 - 1)) != 0)
    abort();
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0x1f,%eax
cmp    $0x0,%eax
je     1133 <check+0x23>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
test   $0x1f,%dil
jne    1117 <check+0x7>
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @check(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i32
%5 = and i32 %4, 31
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 (...) @abort()
unreachable
9: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @check(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = and i64 %2, 31
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %1
ret void
}
/* Variables and functions */
size_t vector_align_size(size_t s) {
  size_t a = (s + 16) & ((size_t)~15);
  return (a < s) ? s : a;
}


x86 assembly (clang, -O0):
<vector_align_size>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rax
and    $0xfffffffffffffff0,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    1133 <vector_align_size+0x33>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    113b <vector_align_size+0x3b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vector_align_size>:
lea    0x10(%rdi),%rax
and    $0xfffffffffffffff0,%rax
cmp    %rdi,%rax
cmovb  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @vector_align_size(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = add i64 %4, 16
%6 = and i64 %5, -16
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = load i64, i64* %2
%9 = icmp ult i64 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load i64, i64* %2
br label %14
12: ; preds = %1
%13 = load i64, i64* %3
br label %14
14: ; preds = %12, %10
%15 = phi i64 [ %11, %10 ], [ %13, %12 ]
ret i64 %15
}

LLVM IR (-O2):
define i64 @vector_align_size(i64 %0) {
%2 = add i64 %0, 16
%3 = and i64 %2, -16
%4 = icmp ult i64 %3, %0
%5 = select i1 %4, i64 %0, i64 %3
ret i64 %5
}
/* Variables and functions */
scalar_t__ notnull(int *);
int g2(int *y) {
  if (notnull(y)) {
    return 0;
  } else {
    return *y;
  }
}


x86 assembly (clang, -O0):
<g2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <notnull@plt>
cmp    $0x0,%rax
je     113b <g2+0x2b>
movl   $0x0,-0x4(%rbp)
jmp    1144 <g2+0x34>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g2>:
push   %rbx
mov    %rdi,%rbx
call   1030 <notnull@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1125 <g2+0x15>
pop    %rbx
ret
mov    (%rbx),%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @g2(i32* %0) {
%2 = tail call i64 @notnull(i32* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = load i32, i32* %0
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ 0, %1 ]
ret i32 %7
}
int p2i(const void *p) {
  union {
    const void *p;
    int i;
  } u;
  u.p = p;
  return u.i;
}


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

x86 assembly (clang, -O2):
<p2i>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
%union.anon = type { i8* }
define i32 @p2i(i8* %0) {
%2 = alloca i8*
%3 = alloca %union.anon
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast %union.anon* %3 to i8**
store i8* %4, i8** %5
%6 = bitcast %union.anon* %3 to i32*
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @p2i(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Variables and functions */
extern char *kw_value(int kwc, char *kwv[], int code) {
  if ((code >= 0) && (code < kwc)) {
    return kwv[code];
  } else {
    return (char *)NULL;
  }
}


x86 assembly (clang, -O0):
<kw_value>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     1139 <kw_value+0x39>
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1139 <kw_value+0x39>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
jmp    1141 <kw_value+0x41>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<kw_value>:
xor    %eax,%eax
test   %edx,%edx
js     1110 <kw_value+0x10>
cmp    %edi,%edx
jge    1110 <kw_value+0x10>
mov    %edx,%eax
mov    (%rsi,%rax,8),%rax
ret

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

LLVM IR (-O2):
define i8* @kw_value(i32 %0, i8** nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, -1
%5 = icmp slt i32 %2, %0
%6 = and i1 %4, %5
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = zext i32 %2 to i64
%9 = getelementptr inbounds i8*, i8** %1, i64 %8
%10 = load i8*, i8** %9
br label %11
11: ; preds = %3, %7
%12 = phi i8* [ %10, %7 ], [ null, %3 ]
ret i8* %12
}
int getReward(int level) {
  switch (level) {
  case 2:
    return 1;
  case 3:
    return 1;
  case 4:
    return 2;
  case 5:
    return 2;
  default:
    return 4;
  }
}


x86 assembly (clang, -O0):
<getReward>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xfffffffe,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     1160 <getReward+0x60>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    1167 <getReward+0x67>
movl   $0x1,-0x4(%rbp)
jmp    1167 <getReward+0x67>
movl   $0x2,-0x4(%rbp)
jmp    1167 <getReward+0x67>
movl   $0x2,-0x4(%rbp)
jmp    1167 <getReward+0x67>
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getReward>:
add    $0xfffffffe,%edi
mov    $0x4,%eax
cmp    $0x3,%edi
ja     111a <getReward+0x1a>
movslq %edi,%rax
lea    0xee9(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

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

LLVM IR (-O2):
@switch.table.getReward = [4 x i32] [i32 1, i32 1, i32 2, i32 2]
define i32 @getReward(i32 %0) {
%2 = add i32 %0, -2
%3 = icmp ult i32 %2, 4
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [4 x i32], [4 x i32]* @switch.table.getReward, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ 4, %1 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int fail_on_purpose(const char *msg) {
  printf("%s", msg);
  return 1;
}


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

x86 assembly (clang, -O2):
<fail_on_purpose>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @fail_on_purpose(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 1
}
int ft_isprint(int c) { return (c >= 32 && c < 127); }


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

x86 assembly (clang, -O2):
<ft_isprint>:
add    $0xffffffe0,%edi
xor    %eax,%eax
cmp    $0x5f,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @ft_isprint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 32
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp slt 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 @ft_isprint(i32 %0) {
%2 = add i32 %0, -32
%3 = icmp ult i32 %2, 95
%4 = zext i1 %3 to i32
ret i32 %4
}
void bar(int *a) {}


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

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

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

LLVM IR (-O2):
define void @bar(i32* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int syscall(int, int, int /*<<< orphan*/ const *, int);
int signalfd(int fd, const sigset_t *sigs, int flags) {
  return syscall(321, fd, sigs, 8);
}


x86 assembly (clang, -O0):
<signalfd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    $0x141,%edi
mov    $0x8,%ecx
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signalfd>:
mov    %rsi,%rdx
mov    %edi,%esi
mov    $0x141,%edi
mov    $0x8,%ecx
jmp    1030 <syscall@plt>

LLVM IR (-O0):
define i32 @signalfd(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32*, i32** %5
%9 = call i32 @syscall(i32 321, i32 %7, i32* %8, i32 8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @signalfd(i32 %0, i32* %1, i32 %2) {
%4 = tail call i32 @syscall(i32 321, i32 %0, i32* %1, i32 8)
ret i32 %4
}