xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ a_button();
int /*<<< orphan*/ system(char *);
int main() {
  system("sh /mnt/browser/usb/install_script");
  while (!a_button()) {
  }
  system("sh /mnt/user/install_script_p2");
  system("rm /mnt/user/install_script_p2");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1040 <system@plt>
mov    $0x0,%al
call   1030 <a_button@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1157 <main+0x37>
jmp    115c <main+0x3c>
jmp    113b <main+0x1b>
lea    0xec0(%rip),%rdi
call   1040 <system@plt>
lea    0xed3(%rip),%rdi
call   1040 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <system@plt>
nopl   (%rax)
xor    %eax,%eax
call   1030 <a_button@plt>
test   %eax,%eax
je     1130 <main+0x10>
lea    0xee1(%rip),%rdi
call   1040 <system@plt>
lea    0xef4(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"sh /mnt/browser/usb/install_script\00"
@.str.1 = [31 x i8] c"sh /mnt/user/install_script_p2\00"
@.str.2 = [31 x i8] c"rm /mnt/user/install_script_p2\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @system(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %7, %0
%4 = call i32 (...) @a_button()
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
%9 = call i32 @system(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @system(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@.str = [35 x i8] c"sh /mnt/browser/usb/install_script\00"
@.str.1 = [31 x i8] c"sh /mnt/user/install_script_p2\00"
@.str.2 = [31 x i8] c"rm /mnt/user/install_script_p2\00"
define i32 @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %2, %0
%3 = tail call i32 (...) @a_button()
%4 = icmp eq i32 %3, 0
br i1 %4, label %2, label %5
5: ; preds = %2
%6 = tail call i32 @system(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @system(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ usleep(unsigned int);
void jimi_sleep(unsigned int millisec) { usleep(millisec * 1000); }


x86 assembly (clang, -O0):
<jimi_sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
imul   $0x3e8,-0x4(%rbp),%edi
call   1030 <usleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jimi_sleep>:
imul   $0x3e8,%edi,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @jimi_sleep(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul i32 %3, 1000
%5 = call i32 @usleep(i32 %4)
ret void
}

LLVM IR (-O2):
define void @jimi_sleep(i32 %0) {
%2 = mul i32 %0, 1000
%3 = tail call i32 @usleep(i32 %2)
ret void
}
/* Type definitions */
struct socket {
  int dummy;
};

/* Variables and functions */
int EINVAL;
int /*<<< orphan*/ free(struct socket *);
int /*<<< orphan*/ so_destroy(struct socket *);
int so_close(struct socket *so) {
  if (!so)
    return EINVAL;
  so_destroy(so);
  free(so);
  return 0;
}


x86 assembly (clang, -O0):
<so_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1148 <so_close+0x28>
mov    0x2ea2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1161 <so_close+0x41>
mov    -0x10(%rbp),%rdi
call   1040 <so_destroy@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<so_close>:
push   %rbx
test   %rdi,%rdi
je     113a <so_close+0x1a>
mov    %rdi,%rbx
call   1040 <so_destroy@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    0x2e9f(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.socket = type { i32 }
@EINVAL = global i32 0
define i32 @so_close(%struct.socket* %0) {
%2 = alloca i32
%3 = alloca %struct.socket*
store %struct.socket* %0, %struct.socket** %3
%4 = load %struct.socket*, %struct.socket** %3
%5 = icmp ne %struct.socket* %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = load i32, i32* @EINVAL
store i32 %7, i32* %2
br label %13
8: ; preds = %1
%9 = load %struct.socket*, %struct.socket** %3
%10 = call i32 @so_destroy(%struct.socket* %9)
%11 = load %struct.socket*, %struct.socket** %3
%12 = call i32 @free(%struct.socket* %11)
store i32 0, i32* %2
br label %13
13: ; preds = %8, %6
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
%struct.socket = type { i32 }
@EINVAL = global i32 0
define i32 @so_close(%struct.socket* %0) {
%2 = icmp eq %struct.socket* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = load i32, i32* @EINVAL
br label %8
5: ; preds = %1
%6 = tail call i32 @so_destroy(%struct.socket* %0)
%7 = tail call i32 @free(%struct.socket* %0)
br label %8
8: ; preds = %5, %3
%9 = phi i32 [ 0, %5 ], [ %4, %3 ]
ret i32 %9
}
int test_imm_D0uint8_reg(unsigned char val) {
  return ((val) & (0xD0 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_D0uint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xd0,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_D0uint8_reg>:
test   $0xd0,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_D0uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -48
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void show_help() {
  puts("\n\n"
       "===========================================\n"
       "  (O)NScripter Script Decompiler\n"
       "===========================================\n"
       "\n"
       "USAGE:\n"
       "   nscrdec [in_file] [out_file]\n"
       "\n"
       "By default, in_file is \"nscript.dat\" and out_file is "
       "\"nscript.txt\".\n"
       "Both in_file and out_file can be \"-\" to specify stdin and/or "
       "stdout.\n");
}


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

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

LLVM IR (-O0):
@.str = [302 x i8] c"\0A\0A===========================================\0A (O)NScripter Script Decompiler\0A===========================================\0A\0AUSAGE:\0A nscrdec [in_file] [out_file]\0A\0ABy default, in_file is \22nscript.dat\22 and out_file is \22nscript.txt\22.\0ABoth in_file and out_file can be \22-\22 to specify stdin and/or stdout.\0A\00"
define void @show_help() {
%1 = call i32 @puts(i8* getelementptr inbounds ([302 x i8], [302 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [302 x i8] c"\0A\0A===========================================\0A (O)NScripter Script Decompiler\0A===========================================\0A\0AUSAGE:\0A nscrdec [in_file] [out_file]\0A\0ABy default, in_file is \22nscript.dat\22 and out_file is \22nscript.txt\22.\0ABoth in_file and out_file can be \22-\22 to specify stdin and/or stdout.\0A\00"
define void @show_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([302 x i8], [302 x i8]* @.str, i64 0, i64 0))
ret void
}
int d_le_mm1(double *a1, double *a2) { return (((*a1) <= (*a2))); }


x86 assembly (clang, -O0):
<d_le_mm1>:
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),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_le_mm1>:
movsd  (%rsi),%xmm0
xor    %eax,%eax
ucomisd (%rdi),%xmm0
setae  %al
ret

LLVM IR (-O0):
define i32 @d_le_mm1(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* %5
%7 = load double*, double** %4
%8 = load double, double* %7
%9 = fcmp ole double %6, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @d_le_mm1(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = fcmp ole double %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ WSramAddr(int);
int /*<<< orphan*/ Wd(int, int);
int /*<<< orphan*/ Ws(char *);
int Winst9B(int i, int code) {
  Ws("sbis  ");
  WSramAddr((code >> 3) & 0x1F);
  Ws(", ");
  Wd(code & 7, 1);
  return 0;
}


x86 assembly (clang, -O0):
<Winst9B>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xebb(%rip),%rdi
call   1030 <Ws@plt>
mov    -0x8(%rbp),%edi
sar    $0x3,%edi
and    $0x1f,%edi
call   1040 <WSramAddr@plt>
lea    0xea8(%rip),%rdi
call   1030 <Ws@plt>
mov    -0x8(%rbp),%edi
and    $0x7,%edi
mov    $0x1,%esi
call   1050 <Wd@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Winst9B>:
push   %rbx
mov    %esi,%ebx
lea    0xec6(%rip),%rdi
call   1030 <Ws@plt>
mov    %ebx,%edi
shr    $0x3,%edi
and    $0x1f,%edi
call   1040 <WSramAddr@plt>
lea    0xeb4(%rip),%rdi
call   1030 <Ws@plt>
and    $0x7,%ebx
mov    %ebx,%edi
mov    $0x1,%esi
call   1050 <Wd@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"sbis \00"
@.str.1 = [3 x i8] c", \00"
define i32 @Winst9B(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* %4
%7 = ashr i32 %6, 3
%8 = and i32 %7, 31
%9 = call i32 @WSramAddr(i32 %8)
%10 = call i32 @Ws(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* %4
%12 = and i32 %11, 7
%13 = call i32 @Wd(i32 %12, i32 1)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"sbis \00"
@.str.1 = [3 x i8] c", \00"
define i32 @Winst9B(i32 %0, i32 %1) {
%3 = tail call i32 @Ws(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = lshr i32 %1, 3
%5 = and i32 %4, 31
%6 = tail call i32 @WSramAddr(i32 %5)
%7 = tail call i32 @Ws(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = and i32 %1, 7
%9 = tail call i32 @Wd(i32 %8, i32 1)
ret i32 0
}
int Thread() { return (1); }


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

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

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

LLVM IR (-O2):
define i32 @Thread() {
ret i32 1
}
int myAtoi(char *str) {
  int res = 0;
  for (int i = 0; str[i] != '\0'; ++i)
    res = res * 10 + str[i] - '0';
  return res;
}


x86 assembly (clang, -O0):
<myAtoi>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1151 <myAtoi+0x51>
imul   $0xa,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0x10(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <myAtoi+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<myAtoi>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <myAtoi+0x28>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
lea    (%rax,%rax,4),%eax
lea    (%rcx,%rax,2),%eax
add    $0xffffffd0,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <myAtoi+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @myAtoi(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %24, %1
%6 = load i8*, i8** %2
%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 %27
13: ; preds = %5
%14 = load i32, i32* %3
%15 = mul nsw i32 %14, 10
%16 = load i8*, i8** %2
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = add nsw i32 %15, %21
%23 = sub nsw i32 %22, 48
store i32 %23, i32* %3
br label %24
24: ; preds = %13
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %5
27: ; preds = %5
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
define i32 @myAtoi(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %6, %1
%5 = phi i32 [ 0, %1 ], [ %13, %6 ]
ret i32 %5
6: ; preds = %1, %6
%7 = phi i64 [ %14, %6 ], [ 0, %1 ]
%8 = phi i8 [ %16, %6 ], [ %2, %1 ]
%9 = phi i32 [ %13, %6 ], [ 0, %1 ]
%10 = sext i8 %8 to i32
%11 = mul nsw i32 %9, 10
%12 = add i32 %11, -48
%13 = add i32 %12, %10
%14 = add nuw nsw i64 %7, 1
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %4, label %6
}
/* Variables and functions */
bool nrf91_errata_10(void) { return false; }


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

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

LLVM IR (-O0):
define i32 @nrf91_errata_10() {
ret i32 0
}

LLVM IR (-O2):
define i32 @nrf91_errata_10() {
ret i32 0
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
bool mp2vpicx_get_tff(const uint8_t *p_mp2vpicx) {
  return !!(p_mp2vpicx[7] & 0x80);
}


x86 assembly (clang, -O0):
<mp2vpicx_get_tff>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%eax
and    $0x80,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp2vpicx_get_tff>:
mov    0x1c(%rdi),%eax
shr    $0x7,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @mp2vpicx_get_tff(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 7
%5 = load i32, i32* %4
%6 = and i32 %5, 128
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @mp2vpicx_get_tff(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 7
%3 = load i32, i32* %2
%4 = lshr i32 %3, 7
%5 = and i32 %4, 1
ret i32 %5
}
int ber_pvt_log_printf(int errlvl, int loglvl, const char *fmt, ...) {
  return 1;
}


x86 assembly (clang, -O0):
<ber_pvt_log_printf>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @ber_pvt_log_printf(i32 %0, i32 %1, i8* nocapture readnone %2, ...) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long long);
void printLongLong(long long n) { printf("%lld", n); }


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

x86 assembly (clang, -O2):
<printLongLong>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"%lld\00"
define void @printLongLong(i64 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ BIO;

/* Variables and functions */
int /*<<< orphan*/ *BIO_new(int /*<<< orphan*/);
int /*<<< orphan*/ BIO_s_fd();
int /*<<< orphan*/ BIO_set_fd(int /*<<< orphan*/ *, int, int);
BIO *BIO_new_fd(int fd, int close_flag) {
  BIO *ret;
  ret = BIO_new(BIO_s_fd());
  if (ret == NULL)
    return (NULL);
  BIO_set_fd(ret, fd, close_flag);
  return (ret);
}


x86 assembly (clang, -O0):
<BIO_new_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <BIO_s_fd@plt>
mov    %eax,%edi
call   1040 <BIO_new@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1168 <BIO_new_fd+0x38>
movq   $0x0,-0x8(%rbp)
jmp    117f <BIO_new_fd+0x4f>
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <BIO_set_fd@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BIO_new_fd>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <BIO_s_fd@plt>
mov    %eax,%edi
call   1040 <BIO_new@plt>
mov    %rax,%rbx
test   %rax,%rax
je     115c <BIO_new_fd+0x2c>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1050 <BIO_set_fd@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32* @BIO_new_fd(i32 %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = call i32 (...) @BIO_s_fd()
%8 = call i32* @BIO_new(i32 %7)
store i32* %8, i32** %6
%9 = load i32*, i32** %6
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %12
11: ; preds = %2
store i32* null, i32** %3
br label %18
12: ; preds = %2
%13 = load i32*, i32** %6
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = call i32 @BIO_set_fd(i32* %13, i32 %14, i32 %15)
%17 = load i32*, i32** %6
store i32* %17, i32** %3
br label %18
18: ; preds = %12, %11
%19 = load i32*, i32** %3
ret i32* %19
}

LLVM IR (-O2):
define i32* @BIO_new_fd(i32 %0, i32 %1) {
%3 = tail call i32 (...) @BIO_s_fd()
%4 = tail call i32* @BIO_new(i32 %3)
%5 = icmp eq i32* %4, null
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @BIO_set_fd(i32* %4, i32 %0, i32 %1)
br label %8
8: ; preds = %2, %6
ret i32* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void gpx_start(FILE *out) {
  fprintf(out, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
               "<gpx xmlns=\"http://www.topografix.com/GPX/1/1\" "
               "creator=\"parsefsh\" version=\"1.1\"\n"
               "   xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
               "   xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 "
               "http://www.topografix.com/GPX/1/1/gpx.xsd\">\n");
}


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

x86 assembly (clang, -O2):
<gpx_start>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
mov    $0x115,%esi
mov    $0x1,%edx
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@.str = [278 x i8] c"<?xml version=\221.0\22 encoding=\22UTF-8\22?>\0A<gpx xmlns=\22http://www.topografix.com/GPX/1/1\22 creator=\22parsefsh\22 version=\221.1\22\0A xmlns:xsi=\22http://www.w3.org/2001/XMLSchema-instance\22\0A xsi:schemaLocation=\22http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd\22>\0A\00"
define void @gpx_start(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([278 x i8], [278 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [278 x i8] c"<?xml version=\221.0\22 encoding=\22UTF-8\22?>\0A<gpx xmlns=\22http://www.topografix.com/GPX/1/1\22 creator=\22parsefsh\22 version=\221.1\22\0A xmlns:xsi=\22http://www.w3.org/2001/XMLSchema-instance\22\0A xsi:schemaLocation=\22http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd\22>\0A\00"
define void @gpx_start(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([278 x i8], [278 x i8]* @.str, i64 0, i64 0), i64 277, i64 1, i32* %0)
ret void
}
void intr_enable(void) {
  asm volatile("# set IF in EFLAGS\n\t"
               "sti\n\t"
               :
               :
               : "cc", "memory");
}


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

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

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

LLVM IR (-O2):
define void @intr_enable() {
tail call void asm sideeffect "# set IF in EFLAGS\0A\09sti\0A\09", "~{cc},~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
scalar_t__ assert(int);
int foo() {
  int x;
  x = 0;
  while (x < 30) {
    int y;
    y = x;
    while (y > 0) {
      y = y - 1;
    }
    x = x + 1;
  }
  assert(x % 2) == 0;
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x1e,-0x4(%rbp)
jge    1155 <foo+0x45>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1147 <foo+0x37>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112f <foo+0x1f>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <foo+0xf>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
xor    %edi,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @foo() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %14, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 30
br i1 %5, label %6, label %17
6: ; preds = %3
%7 = load i32, i32* %1
store i32 %7, i32* %2
br label %8
8: ; preds = %11, %6
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sub nsw i32 %12, 1
store i32 %13, i32* %2
br label %8
14: ; preds = %8
%15 = load i32, i32* %1
%16 = add nsw i32 %15, 1
store i32 %16, i32* %1
br label %3
17: ; preds = %3
%18 = load i32, i32* %1
%19 = srem i32 %18, 2
%20 = call i64 @assert(i32 %19)
%21 = icmp eq i64 %20, 0
%22 = zext i1 %21 to i32
ret i32 0
}

LLVM IR (-O2):
define i32 @foo() {
%1 = tail call i64 @assert(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isascii(int);
void t_isascii_0xbb() {
  Assert_real((isascii(187) == 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",
              940, ("isascii should be 0 for 0xbb"));
}


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

x86 assembly (clang, -O2):
<t_isascii_0xbb>:
push   %rax
mov    $0xbb,%edi
call   1030 <isascii@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x3ac,%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 0xbb\00"
define void @t_isascii_0xbb() {
%1 = call i64 @isascii(i32 187)
%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 940, 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 0xbb\00"
define void @t_isascii_0xbb() {
%1 = tail call i64 @isascii(i32 187)
%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 940, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int (*put_pixel)(TYPE_2__ *, int, int, unsigned long);
};
struct TYPE_4__ {
  TYPE_1__ f;
};
typedef TYPE_2__ XImage;

/* Variables and functions */
void set_XImage_f_put_pixel(void *_p, void *_v) {
  ((XImage *)_p)->f.put_pixel = (int (*)(XImage *, int, int, unsigned long))_v;
}


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

x86 assembly (clang, -O2):
<set_XImage_f_put_pixel>:
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { {}* }
define void @set_XImage_f_put_pixel(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i32 (%struct.TYPE_4__*, i32, i32, i64)*
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to %struct.TYPE_4__*
%9 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %8, i32 0, i32 0
%10 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %9, i32 0, i32 0
%11 = bitcast {}** %10 to i32 (%struct.TYPE_4__*, i32, i32, i64)**
store i32 (%struct.TYPE_4__*, i32, i32, i64)* %6, i32 (%struct.TYPE_4__*, i32, i32, i64)** %11
ret void
}

LLVM IR (-O2):
define void @set_XImage_f_put_pixel(i8* nocapture writeonly %0, i8* %1) {
%3 = bitcast i8* %0 to i8**
store i8* %1, i8** %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void print_test_passed() { fputs("...[X]", stdout); }


x86 assembly (clang, -O0):
<print_test_passed>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_test_passed>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"...[X]\00"
@stdout = global i32 0
define void @print_test_passed() {
%1 = load i32, i32* @stdout
%2 = call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"...[X]\00"
@stdout = global i32 0
define void @print_test_passed() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Type definitions */
struct atrf_dsc {
  int dummy;
};

/* Variables and functions */
int atrf_interrupt_wait(struct atrf_dsc *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
void flush_interrupts(struct atrf_dsc *dsc) {
  int res;
  res = atrf_interrupt_wait(dsc, 1);
  if (res < 0) {
    fprintf(stderr, "atrf_interrupt_wait returns %d\n", res);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<flush_interrupts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <atrf_interrupt_wait@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1179 <flush_interrupts+0x49>
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xe96(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flush_interrupts>:
push   %rax
mov    $0x1,%esi
call   1030 <atrf_interrupt_wait@plt>
test   %eax,%eax
js     1141 <flush_interrupts+0x11>
pop    %rax
ret
mov    0x2e98(%rip),%rcx
mov    (%rcx),%edi
lea    0xeaf(%rip),%rsi
mov    %eax,%edx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.atrf_dsc = type { i32 }
@stderr = global i32 0
@.str = [32 x i8] c"atrf_interrupt_wait returns %d\0A\00"
define void @flush_interrupts(%struct.atrf_dsc* %0) {
%2 = alloca %struct.atrf_dsc*
%3 = alloca i32
store %struct.atrf_dsc* %0, %struct.atrf_dsc** %2
%4 = load %struct.atrf_dsc*, %struct.atrf_dsc** %2
%5 = call i32 @atrf_interrupt_wait(%struct.atrf_dsc* %4, i32 1)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = load i32, i32* %3
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %1
ret void
}

LLVM IR (-O2):
%struct.atrf_dsc = type { i32 }
@stderr = global i32 0
@.str = [32 x i8] c"atrf_interrupt_wait returns %d\0A\00"
define void @flush_interrupts(%struct.atrf_dsc* %0) {
%2 = tail call i32 @atrf_interrupt_wait(%struct.atrf_dsc* %0, i32 1)
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %2)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret void
}
int ps_open(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @ps_open() {
ret i32 0
}

LLVM IR (-O2):
define i32 @ps_open() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  int p = 4;
  switch (p) {
  case 0:
    printf("zero\n");
    break;
  case 1:;
  case 2:
    printf("one or two\n");
    break;
  case 3:;
  case 4:;
  case 5:
    printf("three to five\n");
    break;
  default:
    printf("something else\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x5,%rax
ja     118d <main+0x7d>
mov    -0x10(%rbp),%rax
lea    0xebe(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
jmp    1199 <main+0x89>
jmp    1161 <main+0x51>
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
jmp    1199 <main+0x89>
jmp    1177 <main+0x67>
jmp    117c <main+0x6c>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
jmp    1199 <main+0x89>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [6 x i8] c"zero\0A\00"
@.str.1 = [12 x i8] c"one or two\0A\00"
@.str.2 = [15 x i8] c"three to five\0A\00"
@.str.3 = [16 x i8] c"something else\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 4, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %13 [
i32 0, label %4
i32 1, label %6
i32 2, label %7
i32 3, label %9
i32 4, label %10
i32 5, label %11
]
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %15
6: ; preds = %0
br label %7
7: ; preds = %0, %6
%8 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %15
9: ; preds = %0
br label %10
10: ; preds = %0, %9
br label %11
11: ; preds = %0, %10
%12 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %15
13: ; preds = %0
%14 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %15
15: ; preds = %13, %11, %7, %4
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@str = [14 x i8] c"three to five\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ readfile(char const *, int *, int const *, char *, int *,
                            int *);
void ireadfile(const char *filename, const int *m, const int *n, int *A,
               const int *ldA, int *info) {
  int cm = *m * (int)(sizeof(int) / sizeof(char));
  int cldA = *ldA * (int)(sizeof(int) / sizeof(char));
  readfile(filename, &cm, n, (char *)A, &cldA, info);
}


x86 assembly (clang, -O0):
<ireadfile>:
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    -0x10(%rbp),%rax
mov    (%rax),%eax
shl    $0x2,%eax
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
shl    $0x2,%eax
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x30(%rbp),%r9
lea    -0x34(%rbp),%rsi
lea    -0x38(%rbp),%r8
call   1030 <readfile@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ireadfile>:
push   %rax
mov    (%rsi),%eax
shl    $0x2,%eax
mov    %eax,0x4(%rsp)
mov    (%r8),%eax
shl    $0x2,%eax
mov    %eax,(%rsp)
lea    0x4(%rsp),%rsi
mov    %rsp,%r8
call   1030 <readfile@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @ireadfile(i8* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5) {
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32
store i8* %0, i8** %7
store i32* %1, i32** %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store i32* %4, i32** %11
store i32* %5, i32** %12
%15 = load i32*, i32** %8
%16 = load i32, i32* %15
%17 = mul nsw i32 %16, 4
store i32 %17, i32* %13
%18 = load i32*, i32** %11
%19 = load i32, i32* %18
%20 = mul nsw i32 %19, 4
store i32 %20, i32* %14
%21 = load i8*, i8** %7
%22 = load i32*, i32** %9
%23 = load i32*, i32** %10
%24 = bitcast i32* %23 to i8*
%25 = load i32*, i32** %12
%26 = call i32 @readfile(i8* %21, i32* %13, i32* %22, i8* %24, i32* %14, i32* %25)
ret void
}

LLVM IR (-O2):
define void @ireadfile(i8* %0, i32* nocapture %1, i32* %2, i32* %3, i32* nocapture %4, i32* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = bitcast i32* %7 to i8*
%10 = load i32, i32* %1
%11 = shl nsw i32 %10, 2
store i32 %11, i32* %7
%12 = bitcast i32* %8 to i8*
%13 = load i32, i32* %4
%14 = shl nsw i32 %13, 2
store i32 %14, i32* %8
%15 = bitcast i32* %3 to i8*
%16 = call i32 @readfile(i8* %0, i32* %7, i32* %2, i8* %15, i32* %8, i32* %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ arm_memio_ldm(int /*<<< orphan*/);
int /*<<< orphan*/ arm_memio_mult_op();
void arm_ldm() { arm_memio_ldm(arm_memio_mult_op()); }


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

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

LLVM IR (-O0):
define void @arm_ldm() {
%1 = call i32 (...) @arm_memio_mult_op()
%2 = call i32 @arm_memio_ldm(i32 %1)
ret void
}

LLVM IR (-O2):
define void @arm_ldm() {
%1 = tail call i32 (...) @arm_memio_mult_op()
%2 = tail call i32 @arm_memio_ldm(i32 %1)
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int len;
  scanf("%d", &len);
  char *s = (char *)malloc(512000 * sizeof(char));
  scanf("%s", s);
  printf("Sentence: %s", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    $0x7d000,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    $0x7d000,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xeb1(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe96(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [13 x i8] c"Sentence: %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = call i64 @malloc(i32 512000)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = load i8*, i8** %3
%10 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [13 x i8] c"Sentence: %s\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = call i64 @malloc(i32 512000)
%5 = inttoptr i64 %4 to i8*
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %5)
ret i32 0
}
unsigned int i32_decode(unsigned char *buf) {
  return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
}


x86 assembly (clang, -O0):
<i32_decode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<i32_decode>:
mov    (%rdi),%eax
bswap  %eax
ret

LLVM IR (-O0):
define i32 @i32_decode(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, 24
%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, 16
%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, 8
%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 = or i32 %19, %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @i32_decode(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = shl nuw i32 %3, 24
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 16
%9 = or i32 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl nuw nsw i32 %12, 8
%14 = or i32 %9, %13
%15 = getelementptr inbounds i8, i8* %0, i64 3
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = or i32 %14, %17
ret i32 %18
}
int converterNumero(int numero) {
  switch (numero) {
  case 0:
    return 0b00111111;
  case 1:
    return 0b00000110;
  case 2:
    return 0b01011011;
  case 3:
    return 0b01001111;
  case 4:
    return 0b01100110;
  case 5:
    return 0b01101101;
  case 6:
    return 0b01111100;
  case 7:
    return 0b00000111;
  case 8:
    return 0b01111111;
  case 9:
    return 0b01100111;
  default:
    return 0b01111001;
  }
}


x86 assembly (clang, -O0):
<converterNumero>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x9,%rax
ja     11a4 <converterNumero+0xa4>
mov    -0x10(%rbp),%rax
lea    0xedd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x3f,-0x4(%rbp)
jmp    11ab <converterNumero+0xab>
movl   $0x6,-0x4(%rbp)
jmp    11ab <converterNumero+0xab>
movl   $0x5b,-0x4(%rbp)
jmp    11ab <converterNumero+0xab>
movl   $0x4f,-0x4(%rbp)
jmp    11ab <converterNumero+0xab>
movl   $0x66,-0x4(%rbp)
jmp    11ab <converterNumero+0xab>
movl   $0x6d,-0x4(%rbp)
jmp    11ab <converterNumero+0xab>
movl   $0x7c,-0x4(%rbp)
jmp    11ab <converterNumero+0xab>
movl   $0x7,-0x4(%rbp)
jmp    11ab <converterNumero+0xab>
movl   $0x7f,-0x4(%rbp)
jmp    11ab <converterNumero+0xab>
movl   $0x67,-0x4(%rbp)
jmp    11ab <converterNumero+0xab>
movl   $0x79,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<converterNumero>:
mov    $0x79,%eax
cmp    $0x9,%edi
ja     1117 <converterNumero+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @converterNumero(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %15 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 3, label %8
i32 4, label %9
i32 5, label %10
i32 6, label %11
i32 7, label %12
i32 8, label %13
i32 9, label %14
]
5: ; preds = %1
store i32 63, i32* %2
br label %16
6: ; preds = %1
store i32 6, i32* %2
br label %16
7: ; preds = %1
store i32 91, i32* %2
br label %16
8: ; preds = %1
store i32 79, i32* %2
br label %16
9: ; preds = %1
store i32 102, i32* %2
br label %16
10: ; preds = %1
store i32 109, i32* %2
br label %16
11: ; preds = %1
store i32 124, i32* %2
br label %16
12: ; preds = %1
store i32 7, i32* %2
br label %16
13: ; preds = %1
store i32 127, i32* %2
br label %16
14: ; preds = %1
store i32 103, i32* %2
br label %16
15: ; preds = %1
store i32 121, i32* %2
br label %16
16: ; preds = %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
@switch.table.converterNumero = [10 x i32] [i32 63, i32 6, i32 91, i32 79, i32 102, i32 109, i32 124, i32 7, i32 127, i32 103]
define i32 @converterNumero(i32 %0) {
%2 = icmp ult i32 %0, 10
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds [10 x i32], [10 x i32]* @switch.table.converterNumero, i64 0, i64 %4
%6 = load i32, i32* %5
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 121, %1 ]
ret i32 %8
}
void usbhost_events(void) {}


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

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

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

LLVM IR (-O2):
define void @usbhost_events() {
ret void
}
void update_accept(design, iteration, accept_flag, column, update, step_eval,
                   best_eval, current_eval) struct Design *design;
int iteration, accept_flag, *column, *update;
double *step_eval, *best_eval, current_eval;
{
  void write_step();
  if (accept_flag == 2) {
  }
  if (*step_eval < *best_eval) {
    *best_eval = *step_eval;
    accept_flag = 3;
  }
}


x86 assembly (clang, -O0):
<update_accept>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
cmpl   $0x2,-0x10(%rbp)
jne    1132 <update_accept+0x32>
jmp    1132 <update_accept+0x32>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm1
mov    0x10(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1163 <update_accept+0x63>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x3,-0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_accept>:
mov    0x8(%rsp),%rax
movsd  (%r9),%xmm0
movsd  (%rax),%xmm1
ucomisd %xmm0,%xmm1
jbe    1118 <update_accept+0x18>
movsd  %xmm0,(%rax)
ret

LLVM IR (-O0):
%struct.Design = type opaque
define void @update_accept(%struct.Design* %0, i32 %1, i32 %2, i32* %3, i32* %4, double* %5, double* %6, double %7) {
%9 = alloca %struct.Design*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double
store %struct.Design* %0, %struct.Design** %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32* %3, i32** %12
store i32* %4, i32** %13
store double* %5, double** %14
store double* %6, double** %15
store double %7, double* %16
%17 = load i32, i32* %11
%18 = icmp eq i32 %17, 2
br i1 %18, label %19, label %20
19: ; preds = %8
br label %20
20: ; preds = %19, %8
%21 = load double*, double** %14
%22 = load double, double* %21
%23 = load double*, double** %15
%24 = load double, double* %23
%25 = fcmp olt double %22, %24
br i1 %25, label %26, label %30
26: ; preds = %20
%27 = load double*, double** %14
%28 = load double, double* %27
%29 = load double*, double** %15
store double %28, double* %29
store i32 3, i32* %11
br label %30
30: ; preds = %26, %20
ret void
}

LLVM IR (-O2):
%struct.Design = type opaque
define void @update_accept(%struct.Design* nocapture readnone %0, i32 %1, i32 %2, i32* nocapture readnone %3, i32* nocapture readnone %4, double* nocapture %5, double* nocapture %6, double %7) {
%9 = load double, double* %5
%10 = load double, double* %6
%11 = fcmp olt double %9, %10
br i1 %11, label %12, label %13
12: ; preds = %8
store double %9, double* %6
br label %13
13: ; preds = %12, %8
ret void
}
void foo_2_1_2_2_1_2_2_1_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_2_1_2_2_1_2_2_1_2() {
ret void
}