xunge/DecIR huggingface dataset:
int ft_sqrt(int nb) {
  int i;
  if (nb < 0)
    return (0);
  i = 0;
  while (i * i < nb)
    ++i;
  if (i * i == nb)
    return (i);
  else
    return (0);
}


x86 assembly (clang, -O0):
<ft_sqrt>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111d <ft_sqrt+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1164 <ft_sqrt+0x64>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1142 <ft_sqrt+0x42>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <ft_sqrt+0x24>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    115d <ft_sqrt+0x5d>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1164 <ft_sqrt+0x64>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_sqrt>:
test   %edi,%edi
js     1124 <ft_sqrt+0x24>
mov    $0xffffffff,%ecx
nopl   0x0(%rax)
add    $0x1,%ecx
mov    %ecx,%edx
imul   %ecx,%edx
cmp    %edi,%edx
jl     1110 <ft_sqrt+0x10>
xor    %eax,%eax
cmp    %edi,%edx
cmove  %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_sqrt(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = mul nsw i32 %4, %4
%6 = icmp slt i32 %5, %0
%7 = add nuw nsw i32 %4, 1
br i1 %6, label %3, label %8
8: ; preds = %3
%9 = icmp eq i32 %5, %0
%10 = select i1 %9, i32 %4, i32 0
br label %11
11: ; preds = %8, %1
%12 = phi i32 [ 0, %1 ], [ %10, %8 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ hmod(uintptr_t, uintptr_t, int /*<<< orphan*/);
void hmod_rename(uintptr_t h, uintptr_t rename) { hmod(h, rename, 0); }


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

x86 assembly (clang, -O2):
<hmod_rename>:
xor    %edx,%edx
jmp    1030 <hmod@plt>

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

LLVM IR (-O2):
define void @hmod_rename(i64 %0, i64 %1) {
%3 = tail call i32 @hmod(i64 %0, i64 %1, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ qbyte(char);
void qhexdigit(char c) { qbyte("0123456789ABCDEF"[c & 0x0F]); }


x86 assembly (clang, -O0):
<qhexdigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
and    $0xf,%eax
movslq %eax,%rcx
lea    0xed1(%rip),%rax
movsbl (%rax,%rcx,1),%edi
call   1030 <qbyte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qhexdigit>:
and    $0xf,%edi
lea    0xee6(%rip),%rax
movsbl (%rdi,%rax,1),%edi
jmp    1030 <qbyte@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"0123456789ABCDEF\00"
define void @qhexdigit(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 15
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %6
%8 = load i8, i8* %7
%9 = call i32 @qbyte(i8 signext %8)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"0123456789ABCDEF\00"
define void @qhexdigit(i8 signext %0) {
%2 = and i8 %0, 15
%3 = zext i8 %2 to i64
%4 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %3
%5 = load i8, i8* %4
%6 = tail call i32 @qbyte(i8 signext %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int fffree(void *value, int *status) {
  if (*status > 0)
    return (*status);
  if (value)
    free(value);
  return (*status);
}


x86 assembly (clang, -O0):
<fffree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
jle    113b <fffree+0x2b>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <fffree+0x48>
cmpq   $0x0,-0x10(%rbp)
je     114f <fffree+0x3f>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fffree>:
push   %rbx
mov    (%rsi),%eax
test   %eax,%eax
jg     1126 <fffree+0x16>
test   %rdi,%rdi
je     1126 <fffree+0x16>
mov    %rsi,%rbx
call   1030 <free@plt>
mov    (%rbx),%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @fffree(i8* %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = icmp sgt i32 %3, 0
%5 = icmp eq i8* %0, null
%6 = or i1 %4, %5
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = tail call i32 @free(i8* %0)
%9 = load i32, i32* %1
br label %10
10: ; preds = %7, %2
%11 = phi i32 [ %3, %2 ], [ %9, %7 ]
ret i32 %11
}
int getw(fp)
struct _buf *fp;
{
  int a, b;
  if (((a = fgetc(fp)) >= 0) && ((b = fgetc(fp)) >= 0))
    return (b << 8) + a;
  return -1;
}


x86 assembly (clang, -O0):
<getw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <fgetc@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jl     115b <getw+0x4b>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <fgetc@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jl     115b <getw+0x4b>
mov    -0x18(%rbp),%eax
shl    $0x8,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1162 <getw+0x52>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getw>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <fgetc@plt>
mov    $0xffffffff,%r14d
test   %eax,%eax
js     1140 <getw+0x30>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <fgetc@plt>
test   %eax,%eax
js     1140 <getw+0x30>
shl    $0x8,%eax
add    %ebp,%eax
mov    %eax,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct._buf = type opaque
define i32 @getw(%struct._buf* %0) {
%2 = alloca i32
%3 = alloca %struct._buf*
%4 = alloca i32
%5 = alloca i32
store %struct._buf* %0, %struct._buf** %3
%6 = load %struct._buf*, %struct._buf** %3
%7 = call i32 (%struct._buf*, ...) bitcast (i32 (...)* @fgetc to i32 (%struct._buf*, ...)*)(%struct._buf* %6)
store i32 %7, i32* %4
%8 = icmp sge i32 %7, 0
br i1 %8, label %9, label %18
9: ; preds = %1
%10 = load %struct._buf*, %struct._buf** %3
%11 = call i32 (%struct._buf*, ...) bitcast (i32 (...)* @fgetc to i32 (%struct._buf*, ...)*)(%struct._buf* %10)
store i32 %11, i32* %5
%12 = icmp sge i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %9
%14 = load i32, i32* %5
%15 = shl i32 %14, 8
%16 = load i32, i32* %4
%17 = add nsw i32 %15, %16
store i32 %17, i32* %2
br label %19
18: ; preds = %9, %1
store i32 -1, i32* %2
br label %19
19: ; preds = %18, %13
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
%struct._buf = type opaque
define i32 @getw(%struct._buf* %0) {
%2 = tail call i32 (%struct._buf*, ...) bitcast (i32 (...)* @fgetc to i32 (%struct._buf*, ...)*)(%struct._buf* %0)
%3 = icmp sgt i32 %2, -1
br i1 %3, label %4, label %10
4: ; preds = %1
%5 = tail call i32 (%struct._buf*, ...) bitcast (i32 (...)* @fgetc to i32 (%struct._buf*, ...)*)(%struct._buf* %0)
%6 = icmp sgt i32 %5, -1
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = shl i32 %5, 8
%9 = add nsw i32 %8, %2
br label %10
10: ; preds = %1, %4, %7
%11 = phi i32 [ %9, %7 ], [ -1, %4 ], [ -1, %1 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ test_mq_msg_stats();
int /*<<< orphan*/ test_mq_msg_ws();
int main(void) {
  test_mq_msg_ws();
  test_mq_msg_stats();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <test_mq_msg_ws@plt>
mov    $0x0,%al
call   1040 <test_mq_msg_stats@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_mq_msg_ws@plt>
xor    %eax,%eax
call   1040 <test_mq_msg_stats@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_mq_msg_ws()
%2 = tail call i32 (...) @test_mq_msg_stats()
ret i32 0
}
/* Variables and functions */
int execve(char const *, char *const *, char *const *);
int _execve(const char *fname, char *const argv[], char *const envp[]) {
  return execve(fname, argv, envp);
}


x86 assembly (clang, -O0):
<_execve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <execve@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_execve>:
jmp    1030 <execve@plt>

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

LLVM IR (-O2):
define i32 @_execve(i8* %0, i8** %1, i8** %2) {
%4 = tail call i32 @execve(i8* %0, i8** %1, i8** %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ ast_register_file_version(char *, char *);
void __attribute__((constructor)) __register_file_version(void) {
  ast_register_file_version(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/tpenguin/solarisvoip-asterisk/refs/heads/"
      "master/plc.c",
      "$Revision: 34087 $");
}


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

x86 assembly (clang, -O2):
<__register_file_version>:
lea    0xee9(%rip),%rdi
lea    0xf72(%rip),%rsi
jmp    1030 <ast_register_file_version@plt>

LLVM IR (-O0):
@.str = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/tpenguin/solarisvoip-asterisk/refs/heads/master/plc.c\00"
@.str.1 = [19 x i8] c"$Revision: 34087 $\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @__register_file_version, i8* null }]
define void @__register_file_version() {
%1 = call i32 @ast_register_file_version(i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/tpenguin/solarisvoip-asterisk/refs/heads/master/plc.c\00"
@.str.1 = [19 x i8] c"$Revision: 34087 $\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @__register_file_version, i8* null }]
define void @__register_file_version() {
%1 = tail call i32 @ast_register_file_version(i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void INT16(void *msg_buf) {}


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

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

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

LLVM IR (-O2):
define void @INT16(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void print_version() {
  printf(
      "common 1.0\nCopyright (C) 2011 Toni Romic.\nLicense GPLv3+: GNU GPL "
      "version 3 or later <http://gnu.org/licenses/gpl.html>.\nThis is free "
      "software: you are free to change and redistribute it.\nThere is NO "
      "WARRANTY, to the extent permitted by law.\n\nWritten by Toni Romic.\n");
  exit(0);
}


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

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

LLVM IR (-O0):
@.str = [267 x i8] c"common 1.0\0ACopyright (C) 2011 Toni Romic.\0ALicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\0AThis is free software: you are free to change and redistribute it.\0AThere is NO WARRANTY, to the extent permitted by law.\0A\0AWritten by Toni Romic.\0A\00"
define void @print_version() {
%1 = call i32 @printf(i8* getelementptr inbounds ([267 x i8], [267 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [266 x i8] c"common 1.0\0ACopyright (C) 2011 Toni Romic.\0ALicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\0AThis is free software: you are free to change and redistribute it.\0AThere is NO WARRANTY, to the extent permitted by law.\0A\0AWritten by Toni Romic.\00"
define void @print_version() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([266 x i8], [266 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
unsigned long long TimerLoadGet64(unsigned long ulBase) {
  unsigned long ulHigh1, ulHigh2, ulLow;
  ;
  do {
    ulHigh1 = (*((volatile unsigned long *)(ulBase + 0x0000002C)));
    ulLow = (*((volatile unsigned long *)(ulBase + 0x00000028)));
    ulHigh2 = (*((volatile unsigned long *)(ulBase + 0x0000002C)));
  } while (ulHigh1 != ulHigh2);
  return (((unsigned long long)ulHigh1 << 32) | (unsigned long long)ulLow);
}


x86 assembly (clang, -O0):
<TimerLoadGet64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2c(%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2c(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    1108 <TimerLoadGet64+0x8>
mov    -0x10(%rbp),%rax
shl    $0x20,%rax
or     -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerLoadGet64>:
mov    0x2c(%rdi),%rax
mov    0x28(%rdi),%rcx
cmp    0x2c(%rdi),%rax
jne    1100 <TimerLoadGet64>
shl    $0x20,%rax
or     %rcx,%rax
ret

LLVM IR (-O0):
define i64 @TimerLoadGet64(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %2
br label %6
6: ; preds = %19, %1
%7 = load i64, i64* %2
%8 = add i64 %7, 44
%9 = inttoptr i64 %8 to i64*
%10 = load volatile i64, i64* %9
store i64 %10, i64* %3
%11 = load i64, i64* %2
%12 = add i64 %11, 40
%13 = inttoptr i64 %12 to i64*
%14 = load volatile i64, i64* %13
store i64 %14, i64* %5
%15 = load i64, i64* %2
%16 = add i64 %15, 44
%17 = inttoptr i64 %16 to i64*
%18 = load volatile i64, i64* %17
store i64 %18, i64* %4
br label %19
19: ; preds = %6
%20 = load i64, i64* %3
%21 = load i64, i64* %4
%22 = icmp ne i64 %20, %21
br i1 %22, label %6, label %23
23: ; preds = %19
%24 = load i64, i64* %3
%25 = shl i64 %24, 32
%26 = load i64, i64* %5
%27 = or i64 %25, %26
ret i64 %27
}

LLVM IR (-O2):
define i64 @TimerLoadGet64(i64 %0) {
%2 = add i64 %0, 44
%3 = inttoptr i64 %2 to i64*
%4 = add i64 %0, 40
%5 = inttoptr i64 %4 to i64*
br label %6
6: ; preds = %6, %1
%7 = load volatile i64, i64* %3
%8 = load volatile i64, i64* %5
%9 = load volatile i64, i64* %3
%10 = icmp eq i64 %7, %9
br i1 %10, label %11, label %6
11: ; preds = %6
%12 = shl i64 %7, 32
%13 = or i64 %12, %8
ret i64 %13
}
void PM25_init(void) {}


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

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

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

LLVM IR (-O2):
define void @PM25_init() {
ret void
}
void v3sub(const float *src1, const float *src2, float *dst) {
  dst[0] = src1[0] - src2[0];
  dst[1] = src1[1] - src2[1];
  dst[2] = src1[2] - src2[2];
}


x86 assembly (clang, -O0):
<v3sub>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  0x4(%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<v3sub>:
movss  (%rdi),%xmm0
subss  (%rsi),%xmm0
movss  %xmm0,(%rdx)
movss  0x4(%rdi),%xmm0
subss  0x4(%rsi),%xmm0
movss  %xmm0,0x4(%rdx)
movss  0x8(%rdi),%xmm0
subss  0x8(%rsi),%xmm0
movss  %xmm0,0x8(%rdx)
ret

LLVM IR (-O0):
define void @v3sub(float* %0, float* %1, float* %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float*
store float* %0, float** %4
store float* %1, float** %5
store float* %2, float** %6
%7 = load float*, float** %4
%8 = getelementptr inbounds float, float* %7, i64 0
%9 = load float, float* %8
%10 = load float*, float** %5
%11 = getelementptr inbounds float, float* %10, i64 0
%12 = load float, float* %11
%13 = fsub float %9, %12
%14 = load float*, float** %6
%15 = getelementptr inbounds float, float* %14, i64 0
store float %13, float* %15
%16 = load float*, float** %4
%17 = getelementptr inbounds float, float* %16, i64 1
%18 = load float, float* %17
%19 = load float*, float** %5
%20 = getelementptr inbounds float, float* %19, i64 1
%21 = load float, float* %20
%22 = fsub float %18, %21
%23 = load float*, float** %6
%24 = getelementptr inbounds float, float* %23, i64 1
store float %22, float* %24
%25 = load float*, float** %4
%26 = getelementptr inbounds float, float* %25, i64 2
%27 = load float, float* %26
%28 = load float*, float** %5
%29 = getelementptr inbounds float, float* %28, i64 2
%30 = load float, float* %29
%31 = fsub float %27, %30
%32 = load float*, float** %6
%33 = getelementptr inbounds float, float* %32, i64 2
store float %31, float* %33
ret void
}

LLVM IR (-O2):
define void @v3sub(float* nocapture %0, float* nocapture %1, float* nocapture writeonly %2) {
%4 = load float, float* %0
%5 = load float, float* %1
%6 = fsub float %4, %5
store float %6, float* %2
%7 = getelementptr inbounds float, float* %0, i64 1
%8 = load float, float* %7
%9 = getelementptr inbounds float, float* %1, i64 1
%10 = load float, float* %9
%11 = fsub float %8, %10
%12 = getelementptr inbounds float, float* %2, i64 1
store float %11, float* %12
%13 = getelementptr inbounds float, float* %0, i64 2
%14 = load float, float* %13
%15 = getelementptr inbounds float, float* %1, i64 2
%16 = load float, float* %15
%17 = fsub float %14, %16
%18 = getelementptr inbounds float, float* %2, i64 2
store float %17, float* %18
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalnum(int);
void t_isalnum_0x2a() {
  Assert_real((isalnum(42) == 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_isalnum.c",
              215, ("isalnum should be 0 for *"));
}


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

x86 assembly (clang, -O2):
<t_isalnum_0x2a>:
push   %rax
mov    $0x2a,%edi
call   1030 <isalnum@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0xd7,%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_isalnum.c\00"
@.str.1 = [26 x i8] c"isalnum should be 0 for *\00"
define void @t_isalnum_0x2a() {
%1 = call i64 @isalnum(i32 42)
%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 215, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalnum.c\00"
@.str.1 = [26 x i8] c"isalnum should be 0 for *\00"
define void @t_isalnum_0x2a() {
%1 = tail call i64 @isalnum(i32 42)
%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 215, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void jogmap_read(void) {}


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

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

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

LLVM IR (-O2):
define void @jogmap_read() {
ret void
}
int parse_cmd(char *cmd_line) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @parse_cmd(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  if (1 < 42)
    printf("one is smaller than fortytwo \n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [31 x i8] c"one is smaller than fortytwo \0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [30 x i8] c"one is smaller than fortytwo \00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret i32 0
}
double kernel__Float___42d(double self, double p0) {
  double var;
  double var1;
  var1 = self * p0;
  var = var1;
  goto RET_LABEL;
RET_LABEL:;
  return var;
}


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

x86 assembly (clang, -O2):
<kernel__Float___42d>:
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @kernel__Float___42d(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %3
store double %1, double* %4
%7 = load double, double* %3
%8 = load double, double* %4
%9 = fmul double %7, %8
store double %9, double* %6
%10 = load double, double* %6
store double %10, double* %5
br label %11
11: ; preds = %2
%12 = load double, double* %5
ret double %12
}

LLVM IR (-O2):
define double @kernel__Float___42d(double %0, double %1) {
%3 = fmul double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ convolve_5x5_sse(float *, float *, float *, long, long, long,
                                    long);
void convolve_5x5(float *output, float *input, float *kernel, long outRows,
                  long outCols, long inCols) {
  {
    convolve_5x5_sse(output, input, kernel, outRows, outCols, outCols, inCols);
  }
}


x86 assembly (clang, -O0):
<convolve_5x5>:
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    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    -0x30(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <convolve_5x5_sse@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convolve_5x5>:
push   %rax
mov    %r9,(%rsp)
mov    %r8,%r9
call   1030 <convolve_5x5_sse@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @convolve_5x5(float* %0, float* %1, float* %2, i64 %3, i64 %4, i64 %5) {
%7 = alloca float*
%8 = alloca float*
%9 = alloca float*
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
store float* %0, float** %7
store float* %1, float** %8
store float* %2, float** %9
store i64 %3, i64* %10
store i64 %4, i64* %11
store i64 %5, i64* %12
%13 = load float*, float** %7
%14 = load float*, float** %8
%15 = load float*, float** %9
%16 = load i64, i64* %10
%17 = load i64, i64* %11
%18 = load i64, i64* %11
%19 = load i64, i64* %12
%20 = call i32 @convolve_5x5_sse(float* %13, float* %14, float* %15, i64 %16, i64 %17, i64 %18, i64 %19)
ret void
}

LLVM IR (-O2):
define void @convolve_5x5(float* %0, float* %1, float* %2, i64 %3, i64 %4, i64 %5) {
%7 = tail call i32 @convolve_5x5_sse(float* %0, float* %1, float* %2, i64 %3, i64 %4, i64 %4, i64 %5)
ret void
}
int roundup(int s, int m) { return ((s + m - 1) / m) * m; }


x86 assembly (clang, -O0):
<roundup>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
sub    $0x1,%eax
cltd
idivl  -0x8(%rbp)
imul   -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<roundup>:
lea    (%rdi,%rsi,1),%ecx
add    $0xffffffff,%ecx
mov    %ecx,%eax
cltd
idiv   %esi
sub    %edx,%ecx
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @roundup(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = add nsw i32 %5, %6
%8 = sub nsw i32 %7, 1
%9 = load i32, i32* %4
%10 = sdiv i32 %8, %9
%11 = load i32, i32* %4
%12 = mul nsw i32 %10, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @roundup(i32 %0, i32 %1) {
%3 = add i32 %0, -1
%4 = add i32 %3, %1
%5 = srem i32 %4, %1
%6 = sub i32 %4, %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ pushNarray(char *, unsigned int);
void pushcomplex8array(void *x, int n) {
  pushNarray((char *)x, (unsigned int)(n * 8));
}


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

x86 assembly (clang, -O2):
<pushcomplex8array>:
shl    $0x3,%esi
jmp    1030 <pushNarray@plt>

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

LLVM IR (-O2):
define void @pushcomplex8array(i8* %0, i32 %1) {
%3 = shl nsw i32 %1, 3
%4 = tail call i32 @pushNarray(i8* %0, i32 %3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
void update_filesize(uint64_t symbol) {}


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @avcodec_profile_name() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ send(unsigned int);
void send_hex(unsigned n, unsigned len) {
  unsigned l = len * 4;
  do {
    l -= 4;
    unsigned nibble = (n >> l) & 15;
    if (nibble >= 10)
      nibble += 'a' - '0' - 10;
    send(nibble + '0');
  } while (l);
}


x86 assembly (clang, -O0):
<send_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x4,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
shr    %cl,%eax
and    $0xf,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0xa,-0x10(%rbp)
jb     1151 <send_hex+0x41>
mov    -0x10(%rbp),%eax
add    $0x27,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
add    $0x30,%edi
call   1030 <send@plt>
cmpl   $0x0,-0xc(%rbp)
jne    1127 <send_hex+0x17>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_hex>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
lea    -0x4(,%rsi,4),%ebp
nopl   0x0(%rax)
mov    %ebx,%eax
mov    %ebp,%ecx
shr    %cl,%eax
and    $0xf,%eax
lea    0x27(%rax),%edi
cmp    $0xa,%eax
cmovb  %eax,%edi
add    $0x30,%edi
call   1030 <send@plt>
add    $0xfffffffc,%ebp
cmp    $0xfffffffc,%ebp
jne    1120 <send_hex+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @send_hex(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = mul i32 %7, 4
store i32 %8, i32* %5
br label %9
9: ; preds = %25, %2
%10 = load i32, i32* %5
%11 = sub i32 %10, 4
store i32 %11, i32* %5
%12 = load i32, i32* %3
%13 = load i32, i32* %5
%14 = lshr i32 %12, %13
%15 = and i32 %14, 15
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = icmp uge i32 %16, 10
br i1 %17, label %18, label %21
18: ; preds = %9
%19 = load i32, i32* %6
%20 = add i32 %19, 39
store i32 %20, i32* %6
br label %21
21: ; preds = %18, %9
%22 = load i32, i32* %6
%23 = add i32 %22, 48
%24 = call i32 @send(i32 %23)
br label %25
25: ; preds = %21
%26 = load i32, i32* %5
%27 = icmp ne i32 %26, 0
br i1 %27, label %9, label %28
28: ; preds = %25
ret void
}

LLVM IR (-O2):
define void @send_hex(i32 %0, i32 %1) {
%3 = shl i32 %1, 2
br label %4
4: ; preds = %4, %2
%5 = phi i32 [ %3, %2 ], [ %6, %4 ]
%6 = add i32 %5, -4
%7 = lshr i32 %0, %6
%8 = and i32 %7, 15
%9 = icmp ugt i32 %8, 9
%10 = add nuw nsw i32 %8, 39
%11 = select i1 %9, i32 %10, i32 %8
%12 = add nuw nsw i32 %11, 48
%13 = tail call i32 @send(i32 %12)
%14 = icmp eq i32 %6, 0
br i1 %14, label %15, label %4
15: ; preds = %4
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
scalar_t__ spi_write_then_read(int, int *, int, int *, int);
uint8_t do_read_status_reg(int fd) {
  uint8_t val = 0;
  uint8_t op = 0x05;
  if (spi_write_then_read(fd, &op, 1, &val, 1) < 0)
    return 0;
  else
    return val;
}


x86 assembly (clang, -O0):
<do_read_status_reg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x5,-0x10(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
mov    $0x1,%r8d
lea    -0xc(%rbp),%rcx
mov    %r8d,%edx
call   1030 <spi_write_then_read@plt>
cmp    $0x0,%rax
jge    1158 <do_read_status_reg+0x48>
movl   $0x0,-0x4(%rbp)
jmp    115e <do_read_status_reg+0x4e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_read_status_reg>:
push   %rax
movl   $0x0,(%rsp)
movl   $0x5,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    %rsp,%rcx
mov    $0x1,%edx
mov    $0x1,%r8d
call   1030 <spi_write_then_read@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
js     1145 <do_read_status_reg+0x35>
mov    (%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @do_read_status_reg(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = bitcast i32* %3 to i8*
store i32 5, i32* %3
%6 = call i64 @spi_write_then_read(i32 %0, i32* %3, i32 1, i32* %2, i32 1)
%7 = icmp slt i64 %6, 0
%8 = load i32, i32* %2
%9 = select i1 %7, i32 0, i32 %8
ret i32 %9
}
int main() {
  static int i;
  char foo[255];
  for (i = 0; i <= 400; i++)
    foo[i] = 42;
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,0x2f08(%rip)
cmpl   $0x190,0x2efe(%rip)
jg     114f <main+0x4f>
movslq 0x2ef1(%rip),%rax
movb   $0x2a,-0x110(%rbp,%rax,1)
2a
mov    0x2ee3(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2eda(%rip)
jmp    111c <main+0x1c>
mov    $0x1,%eax
add    $0x90,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@main.i = internal global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [255 x i8]
store i32 0, i32* %1
store i32 0, i32* @main.i
br label %3
3: ; preds = %10, %0
%4 = load i32, i32* @main.i
%5 = icmp sle i32 %4, 400
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = load i32, i32* @main.i
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 %8
store i8 42, i8* %9
br label %10
10: ; preds = %6
%11 = load i32, i32* @main.i
%12 = add nsw i32 %11, 1
store i32 %12, i32* @main.i
br label %3
13: ; preds = %3
ret i32 1
}

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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fexists(char *fname) {
  FILE *fn;
  int rc = 0;
  fn = fopen(fname, "r");
  if (fn != NULL) {
    fclose(fn);
    rc = 1;
  }
  return rc;
}


x86 assembly (clang, -O0):
<fexists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1162 <fexists+0x42>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fexists>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1141 <fexists+0x21>
mov    %rax,%rdi
call   1030 <fclose@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @fexists(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @fclose(i32* %2)
br label %6
6: ; preds = %4, %1
%7 = phi i32 [ 1, %4 ], [ 0, %1 ]
ret i32 %7
}
int test_imm_B7uint32_reg(unsigned int val) {
  return ((val) & (0xB7 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_B7uint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xb7,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_B7uint32_reg(i32 %0) {
%2 = and i32 %0, 183
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void clear_string(char string[100000]) {
  int i = 0;
  while (i < 100000) {
    string[i] = 0;
    i++;
  }
}


x86 assembly (clang, -O0):
<clear_string>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x186a0,-0xc(%rbp)
jge    1136 <clear_string+0x36>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <clear_string+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_string>:
push   %rax
mov    $0x186a0,%edx
xor    %esi,%esi
call   1030 <memset@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @clear_string(i8* nocapture writeonly %0) {
ret void
}
/* Type definitions */
typedef char const wchar_t;
typedef int /*<<< orphan*/ wc;

/* Variables and functions */
int mbstowcs(char const *, char const *, int);
wchar_t get_first_wchar(const char str[]) {
  wchar_t wc[2] = {};
  return (mbstowcs(wc, str, (sizeof(wc) / sizeof((wc)[0]))) >= 1) ? wc[0]
                                                                  : str[0];
}


x86 assembly (clang, -O0):
<get_first_wchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xa(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1040 <memset@plt>
lea    -0xa(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x2,%edx
call   1030 <mbstowcs@plt>
cmp    $0x1,%eax
jl     1163 <get_first_wchar+0x43>
movsbl -0xa(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    116d <get_first_wchar+0x4d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_first_wchar>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movw   $0x0,0x6(%rsp)
lea    0x6(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1030 <mbstowcs@plt>
test   %eax,%eax
cmovg  %r14,%rbx
mov    (%rbx),%al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define signext i8 @get_first_wchar(i8* %0) {
%2 = alloca i8*
%3 = alloca [2 x i8]
store i8* %0, i8** %2
%4 = bitcast [2 x i8]* %3 to i8*
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @mbstowcs(i8* %5, i8* %6, i32 2)
%8 = icmp sge i32 %7, 1
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
br label %18
13: ; preds = %1
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
br label %18
18: ; preds = %13, %9
%19 = phi i32 [ %12, %9 ], [ %17, %13 ]
%20 = trunc i32 %19 to i8
ret i8 %20
}

LLVM IR (-O2):
define signext i8 @get_first_wchar(i8* %0) {
%2 = alloca i16
%3 = bitcast i16* %2 to i8*
store i16 0, i16* %2
%4 = call i32 @mbstowcs(i8* %3, i8* %0, i32 2)
%5 = icmp sgt i32 %4, 0
%6 = select i1 %5, i8* %3, i8* %0
%7 = load i8, i8* %6
ret i8 %7
}
int test_imm_5Buint8_mem(unsigned char *val) {
  return ((*val) & (0x5B << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_5Buint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 91
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
float ps2_asinf(float);
float ps2_acosf(float x) {
  return 1.5707963267948966192313216916398f - ps2_asinf(x);
}


x86 assembly (clang, -O0):
<ps2_acosf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <ps2_asinf@plt>
movaps %xmm0,%xmm1
movss  0xece(%rip),%xmm0
subss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ps2_acosf>:
push   %rax
call   1030 <ps2_asinf@plt>
movss  0xee2(%rip),%xmm1
subss  %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @ps2_acosf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @ps2_asinf(float %3)
%5 = fsub float 0x3FF921FB60000000, %4
ret float %5
}

LLVM IR (-O2):
define float @ps2_acosf(float %0) {
%2 = tail call float @ps2_asinf(float %0)
%3 = fsub float 0x3FF921FB60000000, %2
ret float %3
}
void foo246(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo246(i32 %0) {
ret void
}
/* Variables and functions */
void *lwork(void const *, void const *, size_t *, size_t,
            int (*)(void const *, void const *), int /*<<< orphan*/);
void *lfind(const void *key, const void *base, size_t *nelp, size_t width,
            int (*compar)(const void *, const void *)) {
  return lwork(key, base, nelp, width, compar, 0);
}


x86 assembly (clang, -O0):
<lfind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
xor    %r9d,%r9d
call   1030 <lwork@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lfind>:
xor    %r9d,%r9d
jmp    1030 <lwork@plt>

LLVM IR (-O0):
define i8* @lfind(i8* %0, i8* %1, i64* %2, i64 %3, i32 (i8*, i8*)* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64*
%9 = alloca i64
%10 = alloca i32 (i8*, i8*)*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i64* %2, i64** %8
store i64 %3, i64* %9
store i32 (i8*, i8*)* %4, i32 (i8*, i8*)** %10
%11 = load i8*, i8** %6
%12 = load i8*, i8** %7
%13 = load i64*, i64** %8
%14 = load i64, i64* %9
%15 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %10
%16 = call i8* @lwork(i8* %11, i8* %12, i64* %13, i64 %14, i32 (i8*, i8*)* %15, i32 0)
ret i8* %16
}

LLVM IR (-O2):
define i8* @lfind(i8* %0, i8* %1, i64* %2, i64 %3, i32 (i8*, i8*)* %4) {
%6 = tail call i8* @lwork(i8* %0, i8* %1, i64* %2, i64 %3, i32 (i8*, i8*)* %4, i32 0)
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int real_dup2(int, int);
int smbw_dup2(int, int);
scalar_t__ smbw_fd(int);
int dup2(int oldfd, int newfd) {
  if (smbw_fd(newfd)) {
    close(newfd);
  }
  if (smbw_fd(oldfd)) {
    return smbw_dup2(oldfd, newfd);
  }
  return real_dup2(oldfd, newfd);
}


x86 assembly (clang, -O0):
<dup2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <smbw_fd@plt>
cmp    $0x0,%rax
je     1168 <dup2+0x28>
mov    -0xc(%rbp),%edi
call   1030 <close@plt>
mov    -0x8(%rbp),%edi
call   1040 <smbw_fd@plt>
cmp    $0x0,%rax
je     118d <dup2+0x4d>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <smbw_dup2@plt>
mov    %eax,-0x4(%rbp)
jmp    119b <dup2+0x5b>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1060 <real_dup2@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dup2>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    %esi,%edi
call   1040 <smbw_fd@plt>
test   %rax,%rax
je     115a <dup2+0x1a>
mov    %ebx,%edi
call   1030 <close@plt>
mov    %ebp,%edi
call   1040 <smbw_fd@plt>
mov    %ebp,%edi
mov    %ebx,%esi
add    $0x8,%rsp
test   %rax,%rax
je     1175 <dup2+0x35>
pop    %rbx
pop    %rbp
jmp    1050 <smbw_dup2@plt>
pop    %rbx
pop    %rbp
jmp    1060 <real_dup2@plt>

LLVM IR (-O0):
define i32 @dup2(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = call i64 @smbw_fd(i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32, i32* %5
%11 = call i32 @close(i32 %10)
br label %12
12: ; preds = %9, %2
%13 = load i32, i32* %4
%14 = call i64 @smbw_fd(i32 %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = call i32 @smbw_dup2(i32 %17, i32 %18)
store i32 %19, i32* %3
br label %24
20: ; preds = %12
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = call i32 @real_dup2(i32 %21, i32 %22)
store i32 %23, i32* %3
br label %24
24: ; preds = %20, %16
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @dup2(i32 %0, i32 %1) {
%3 = tail call i64 @smbw_fd(i32 %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @close(i32 %1)
br label %7
7: ; preds = %5, %2
%8 = tail call i64 @smbw_fd(i32 %0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 @smbw_dup2(i32 %0, i32 %1)
br label %14
12: ; preds = %7
%13 = tail call i32 @real_dup2(i32 %0, i32 %1)
br label %14
14: ; preds = %12, %10
%15 = phi i32 [ %11, %10 ], [ %13, %12 ]
ret i32 %15
}