xunge/DecIR huggingface dataset:
/* Variables and functions */
int rand();
int random() { return rand(); }


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

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

LLVM IR (-O0):
define i32 @random() {
%1 = call i32 (...) @rand()
ret i32 %1
}

LLVM IR (-O2):
define i32 @random() {
%1 = tail call i32 (...) @rand()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ Init();
void _M2_PolyMatrix3D_init(__attribute__((unused)) int argc,
                           __attribute__((unused)) char *argv[]) {
  Init();
}


x86 assembly (clang, -O0):
<_M2_PolyMatrix3D_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <Init@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @_M2_PolyMatrix3D_init(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @Init()
ret void
}

LLVM IR (-O2):
define void @_M2_PolyMatrix3D_init(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @Init()
ret void
}
/* Variables and functions */
int read(void *, unsigned char *, unsigned int);
int mtv_data_read(void *hDevice, unsigned char *buf, unsigned int bufSize) {
  int outSize;
  outSize = read(hDevice, buf, bufSize);
  return outSize;
}


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

x86 assembly (clang, -O2):
<mtv_data_read>:
jmp    1030 <read@plt>

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

LLVM IR (-O2):
define i32 @mtv_data_read(i8* %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @read(i8* %0, i8* %1, i32 %2)
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void mp2vpicx_set_tff(uint8_t *p_mp2vpicx) { p_mp2vpicx[7] |= 0x80; }


x86 assembly (clang, -O0):
<mp2vpicx_set_tff>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%ecx
or     $0x80,%ecx
mov    %ecx,0x1c(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp2vpicx_set_tff>:
orb    $0x80,0x1c(%rdi)
ret

LLVM IR (-O0):
define void @mp2vpicx_set_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 = or i32 %5, 128
store i32 %6, i32* %4
ret void
}

LLVM IR (-O2):
define void @mp2vpicx_set_tff(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 7
%3 = load i32, i32* %2
%4 = or i32 %3, 128
store i32 %4, i32* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void do_banner() {
  printf(
      "MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n");
  printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
}


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

x86 assembly (clang, -O2):
<do_banner>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf20(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [69 x i8] c"MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\0A\00"
@.str.1 = [58 x i8] c"more info at http://www.winimage.com/zLibDll/unzip.html\0A\0A\00"
define void @do_banner() {
%1 = call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [68 x i8] c"MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\00"
@str.2 = [57 x i8] c"more info at http://www.winimage.com/zLibDll/unzip.html\0A\00"
define void @do_banner() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_115() {
  Assert_real((isqrt(115) == 10),
              "/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/stdlib/isqrt.c",
              580, ("Integer square root of 115 should be 10"));
}


x86 assembly (clang, -O0):
<t_sqrt_115>:
push   %rbp
mov    %rsp,%rbp
mov    $0x73,%edi
call   1030 <isqrt@plt>
cmp    $0xa,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x244,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_115>:
push   %rax
mov    $0x73,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0xa,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x244,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 115 should be 10\00"
define void @t_sqrt_115() {
%1 = call i32 @isqrt(i32 115)
%2 = icmp eq i32 %1, 10
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 580, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 115 should be 10\00"
define void @t_sqrt_115() {
%1 = tail call i32 @isqrt(i32 115)
%2 = icmp eq i32 %1, 10
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 580, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void gdk_rgb_get_visual() {}


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

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

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

LLVM IR (-O2):
define void @gdk_rgb_get_visual() {
ret void
}
/* Variables and functions */
unsigned long long be64_to_cpu(unsigned long long const);
unsigned long long get_pdu_int(void *data) {
  const unsigned long long *val = data;
  return be64_to_cpu(*val);
}


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

x86 assembly (clang, -O2):
<get_pdu_int>:
mov    (%rdi),%rdi
jmp    1030 <be64_to_cpu@plt>

LLVM IR (-O0):
define i64 @get_pdu_int(i8* %0) {
%2 = alloca i8*
%3 = alloca i64*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i64*
store i64* %5, i64** %3
%6 = load i64*, i64** %3
%7 = load i64, i64* %6
%8 = call i64 @be64_to_cpu(i64 %7)
ret i64 %8
}

LLVM IR (-O2):
define i64 @get_pdu_int(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = tail call i64 @be64_to_cpu(i64 %3)
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_help(char *prog_name) {
  printf("Usage:\n");
  printf("  %s <dbfile-to-import>\n", prog_name);
  printf("\n");
}


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

x86 assembly (clang, -O2):
<print_help>:
push   %rbx
mov    %rdi,%rbx
lea    0xede(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Usage:\0A\00"
@.str.1 = [25 x i8] c" %s <dbfile-to-import>\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @print_help(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [25 x i8] c" %s <dbfile-to-import>\0A\00"
@str = [7 x i8] c"Usage:\00"
define void @print_help(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i32 @putchar(i32 10)
ret void
}
int xmlUCSIsLinearBIdeograms(int code) {
  return (((code >= 0x10080) && (code <= 0x100FF)));
}


x86 assembly (clang, -O0):
<xmlUCSIsLinearBIdeograms>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x10080,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1126 <xmlUCSIsLinearBIdeograms+0x26>
cmpl   $0x100ff,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmlUCSIsLinearBIdeograms>:
and    $0xffffff80,%edi
xor    %eax,%eax
cmp    $0x10080,%edi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @xmlUCSIsLinearBIdeograms(i32 %0) {
%2 = and i32 %0, -128
%3 = icmp eq i32 %2, 65664
%4 = zext i1 %3 to i32
ret i32 %4
}
void heart_host_breath_taken() {}


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @init_sockets() {
ret void
}
/* Variables and functions */
void *malloc(int);
int /*<<< orphan*/ zlog_fatal_output(int, char *, long);
void *zmalloc_20160308(int len) {
  void *r;
  if (len < 1) {
    len = 1;
  }
  if ((r = malloc(len)) == 0) {
    {
      zlog_fatal_output(1, "zmalloc: insufficient memory for %ld bytes: %m",
                        (long)len);
    };
  }
  ((char *)r)[0] = 0;
  return r;
}


x86 assembly (clang, -O0):
<zmalloc_20160308>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jge    113c <zmalloc_20160308+0x1c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1167 <zmalloc_20160308+0x47>
movslq -0x4(%rbp),%rdx
mov    $0x1,%edi
lea    0xe9e(%rip),%rsi
call   1040 <zlog_fatal_output@plt>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zmalloc_20160308>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
mov    $0x1,%ebp
cmovg  %edi,%ebp
mov    %ebp,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114f <zmalloc_20160308+0x2f>
mov    %ebp,%edx
lea    0xebb(%rip),%rsi
mov    $0x1,%edi
call   1040 <zlog_fatal_output@plt>
movb   $0x0,(%rbx)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [47 x i8] c"zmalloc: insufficient memory for %ld bytes: %m\00"
define i8* @zmalloc_20160308(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %7
7: ; preds = %6, %1
%8 = load i32, i32* %2
%9 = call i8* @malloc(i32 %8)
store i8* %9, i8** %3
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = call i32 @zlog_fatal_output(i32 1, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i64 %13)
br label %15
15: ; preds = %11, %7
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 0
store i8 0, i8* %17
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
@.str = [47 x i8] c"zmalloc: insufficient memory for %ld bytes: %m\00"
define noalias i8* @zmalloc_20160308(i32 %0) {
%2 = icmp sgt i32 %0, 1
%3 = select i1 %2, i32 %0, i32 1
%4 = tail call i8* @malloc(i32 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = zext i32 %3 to i64
%8 = tail call i32 @zlog_fatal_output(i32 1, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i64 %7)
br label %9
9: ; preds = %6, %1
store i8 0, i8* %4
ret i8* %4
}
void show_menu_title(char *title, int len) {
  if (len < 33) {
    len = (33 - len) / 2;
    if (len % 2)
      --len;
  } else
    len = 0;
  printf("%*s %s\n", len, " ", title);
}


x86 assembly (clang, -O0):
<show_menu_title>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x21,-0xc(%rbp)
jge    115e <show_menu_title+0x4e>
mov    $0x21,%eax
sub    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1159 <show_menu_title+0x49>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1165 <show_menu_title+0x55>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rcx
lea    0xe8d(%rip),%rdi
lea    0xe8e(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_menu_title>:
mov    %esi,%eax
mov    %rdi,%rcx
xor    %esi,%esi
cmp    $0x20,%eax
jg     112f <show_menu_title+0x1f>
mov    $0x21,%esi
sub    %eax,%esi
mov    %esi,%eax
shr    %eax
shl    $0x1e,%esi
sar    $0x1f,%esi
add    %eax,%esi
lea    0xeca(%rip),%rdi
lea    0xecb(%rip),%rdx
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"%*s %s\0A\00"
@.str.1 = [2 x i8] c" \00"
define void @show_menu_title(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp slt i32 %5, 33
br i1 %6, label %7, label %18
7: ; preds = %2
%8 = load i32, i32* %4
%9 = sub nsw i32 33, %8
%10 = sdiv i32 %9, 2
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = srem i32 %11, 2
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %7
%15 = load i32, i32* %4
%16 = add nsw i32 %15, -1
store i32 %16, i32* %4
br label %17
17: ; preds = %14, %7
br label %19
18: ; preds = %2
store i32 0, i32* %4
br label %19
19: ; preds = %18, %17
%20 = load i32, i32* %4
%21 = load i8*, i8** %3
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %21)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%*s %s\0A\00"
@.str.1 = [2 x i8] c" \00"
define void @show_menu_title(i8* %0, i32 %1) {
%3 = icmp slt i32 %1, 33
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = sub nsw i32 33, %1
%6 = lshr i32 %5, 1
%7 = shl i32 %5, 30
%8 = ashr i32 %7, 31
%9 = add nsw i32 %8, %6
br label %10
10: ; preds = %4, %2
%11 = phi i32 [ %9, %4 ], [ 0, %2 ]
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
struct timeval {
  double tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double relogio() {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return tv.tv_sec + 1e-6 * tv.tv_usec;
}


x86 assembly (clang, -O0):
<relogio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
movsd  -0x10(%rbp),%xmm1
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xec9(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<relogio>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdl 0x10(%rsp),%xmm0
mulsd  0xed2(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { double, i32 }
define double @relogio() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%6 = load i32, i32* %5
%7 = sitofp i32 %6 to double
%8 = call double @llvm.fmuladd.f64(double 0x3EB0C6F7A0B5ED8D, double %7, double %4)
ret double %8
}

LLVM IR (-O2):
%struct.timeval = type { double, i32 }
define double @relogio() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i32, i32* %6
%8 = sitofp i32 %7 to double
%9 = tail call double @llvm.fmuladd.f64(double %8, double 0x3EB0C6F7A0B5ED8D, double %5)
ret double %9
}
/* Variables and functions */
int /*<<< orphan*/ LOG_ERR;
int munmap(void *, unsigned int);
int /*<<< orphan*/ say(int /*<<< orphan*/, char *, int);
void unmapmem(void *addr, unsigned size) {
  int s = munmap(addr, size);
  if (s != 0) {
    say(LOG_ERR, "munmap error %d\n", s);
  }
}


x86 assembly (clang, -O0):
<unmapmem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <munmap@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1160 <unmapmem+0x40>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%edx
lea    0xea5(%rip),%rsi
call   1040 <say@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unmapmem>:
push   %rax
call   1030 <munmap@plt>
test   %eax,%eax
je     1142 <unmapmem+0x22>
mov    0x2ea7(%rip),%rcx
mov    (%rcx),%edi
lea    0xec6(%rip),%rsi
mov    %eax,%edx
pop    %rax
jmp    1040 <say@plt>
pop    %rax
ret

LLVM IR (-O0):
@LOG_ERR = global i32 0
@.str = [17 x i8] c"munmap error %d\0A\00"
define void @unmapmem(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @munmap(i8* %6, i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* @LOG_ERR
%13 = load i32, i32* %5
%14 = call i32 @say(i32 %12, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %11, %2
ret void
}

LLVM IR (-O2):
@LOG_ERR = global i32 0
@.str = [17 x i8] c"munmap error %d\0A\00"
define void @unmapmem(i8* %0, i32 %1) {
%3 = tail call i32 @munmap(i8* %0, i32 %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = load i32, i32* @LOG_ERR
%7 = tail call i32 @say(i32 %6, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %3)
br label %8
8: ; preds = %5, %2
ret void
}
void lh_strhash(void) {}


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

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

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

LLVM IR (-O2):
define void @lh_strhash() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_mcalign_new() {
  printf("NOT IMPLEMENTED:"
         "pa_mcalign_new"
         "\n");
}


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

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

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

LLVM IR (-O2):
@str = [31 x i8] c"NOT IMPLEMENTED:pa_mcalign_new\00"
define i32 @pa_mcalign_new() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
size_t wcstombs(char *, int /*<<< orphan*/ *, size_t);
size_t wctombs(char *dest, wchar_t x) {
  wchar_t wstr[] = {x, 0};
  size_t size = wcstombs(NULL, wstr, 0);
  if (size != (size_t)-1)
    size = wcstombs(dest, wstr, size + 1);
  return size;
}


x86 assembly (clang, -O0):
<wctombs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
lea    -0x14(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rdi
call   1030 <wcstombs@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0xffffffffffffffff,-0x20(%rbp)
je     1164 <wctombs+0x54>
mov    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    -0x20(%rbp),%rdx
add    $0x1,%rdx
call   1030 <wcstombs@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wctombs>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    %esi,0x8(%rsp)
movl   $0x0,0xc(%rsp)
lea    0x8(%rsp),%rsi
xor    %edi,%edi
xor    %edx,%edx
call   1030 <wcstombs@plt>
cmp    $0xffffffffffffffff,%rax
je     114e <wctombs+0x3e>
add    $0x1,%rax
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
call   1030 <wcstombs@plt>
jmp    1155 <wctombs+0x45>
mov    $0xffffffffffffffff,%rax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @wctombs(i8* %0, i32 %1) {
%3 = alloca [2 x i32]
%4 = bitcast [2 x i32]* %3 to i8*
%5 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
store i32 %1, i32* %5
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
store i32 0, i32* %6
%7 = call i64 @wcstombs(i8* null, i32* %5, i64 0)
%8 = icmp eq i64 %7, -1
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = add nuw i64 %7, 1
%11 = call i64 @wcstombs(i8* %0, i32* %5, i64 %10)
br label %12
12: ; preds = %9, %2
%13 = phi i64 [ %11, %9 ], [ -1, %2 ]
ret i64 %13
}
unsigned int bitcount_32_bit(unsigned int i) {
  return ((unsigned int)__builtin_popcount(i));
}


x86 assembly (clang, -O0):
<bitcount_32_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    %ecx,%eax
shr    %eax
and    $0x55555555,%eax
sub    %eax,%ecx
mov    %ecx,%eax
and    $0x33333333,%eax
shr    $0x2,%ecx
and    $0x33333333,%ecx
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x4,%ecx
add    %ecx,%eax
and    $0xf0f0f0f,%eax
imul   $0x1010101,%eax,%eax
shr    $0x18,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitcount_32_bit>:
mov    %edi,%eax
shr    %eax
and    $0x55555555,%eax
sub    %eax,%edi
mov    %edi,%eax
and    $0x33333333,%eax
shr    $0x2,%edi
and    $0x33333333,%edi
add    %eax,%edi
mov    %edi,%eax
shr    $0x4,%eax
add    %edi,%eax
and    $0xf0f0f0f,%eax
imul   $0x1010101,%eax,%eax
shr    $0x18,%eax
ret

LLVM IR (-O0):
define i32 @bitcount_32_bit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @llvm.ctpop.i32(i32 %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @bitcount_32_bit(i32 %0) {
%2 = tail call i32 @llvm.ctpop.i32(i32 %0)
ret i32 %2
}
const char *libmpq__version(void) { return "0.4.2"; }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"0.4.2\00"
define i8* @libmpq__version() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"0.4.2\00"
define i8* @libmpq__version() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
int fun890() { return 890; }


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

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

LLVM IR (-O0):
define i32 @fun890() {
ret i32 890
}

LLVM IR (-O2):
define i32 @fun890() {
ret i32 890
}
/* Variables and functions */
char *get_cmus_home_file(char *);
char *get_cmusfm_config_file(void) { return get_cmus_home_file("cmusfm.conf"); }


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"cmusfm.conf\00"
define i8* @get_cmusfm_config_file() {
%1 = call i8* @get_cmus_home_file(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [12 x i8] c"cmusfm.conf\00"
define i8* @get_cmusfm_config_file() {
%1 = tail call i8* @get_cmus_home_file(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ func1();
int /*<<< orphan*/ func2();
int /*<<< orphan*/ func3();
int main(void) {
  func1();
  func2();
  func3();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @func1()
%2 = tail call i32 (...) @func2()
%3 = tail call i32 (...) @func3()
ret i32 0
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char const *);
char *strdup(const char *str) {
  int n = strlen(str) + 1;
  char *dup = malloc(n);
  if (dup)
    strcpy(dup, str);
  return dup;
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     116f <strdup+0x3f>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1157 <strdup+0x27>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 1
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = call i8* @malloc(i32 %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %16
12: ; preds = %1
%13 = load i8*, i8** %4
%14 = load i8*, i8** %2
%15 = call i32 @strcpy(i8* %13, i8* %14)
br label %16
16: ; preds = %12, %1
%17 = load i8*, i8** %4
ret i8* %17
}

LLVM IR (-O2):
define i8* @strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i8* @malloc(i32 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @strcpy(i8* %4, i8* %0)
br label %8
8: ; preds = %6, %1
ret i8* %4
}
/* Variables and functions */
int round(double s) {
  if (s >= 0)
    s = s + 0.5;
  else
    s = s - 0.5;
  return ((int)s);
}


x86 assembly (clang, -O0):
<round>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1132 <round+0x32>
movsd  0xedd(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1148 <round+0x48>
movsd  -0x8(%rbp),%xmm0
movsd  0xec1(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<round>:
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
setb   %al
lea    0xeec(%rip),%rcx
addsd  (%rcx,%rax,8),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @round(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp oge double %3, 0.000000e+00
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load double, double* %2
%7 = fadd double %6, 5.000000e-01
store double %7, double* %2
br label %11
8: ; preds = %1
%9 = load double, double* %2
%10 = fsub double %9, 5.000000e-01
store double %10, double* %2
br label %11
11: ; preds = %8, %5
%12 = load double, double* %2
%13 = fptosi double %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @round(double %0) {
%2 = fcmp ult double %0, 0.000000e+00
%3 = select i1 %2, double -5.000000e-01, double 5.000000e-01
%4 = fadd double %3, %0
%5 = fptosi double %4 to i32
ret i32 %5
}
/* Variables and functions */
long DIV_ROUND_UP(long, int);
long ascii85_encode_len(long len) { return DIV_ROUND_UP(len, 4); }


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

x86 assembly (clang, -O2):
<ascii85_encode_len>:
mov    $0x4,%esi
jmp    1030 <DIV_ROUND_UP@plt>

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

LLVM IR (-O2):
define i64 @ascii85_encode_len(i64 %0) {
%2 = tail call i64 @DIV_ROUND_UP(i64 %0, i32 4)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ reverse();
int main() {
  reverse();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @reverse()
ret i32 0
}
/* Variables and functions */
long double modf(long double, double *);
long double modfl(long double a1, long double *a2) {
  return modf(a1, (double *)a2);
}


x86 assembly (clang, -O0):
<modfl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
mov    %rdi,-0x18(%rbp)
fldt   -0x10(%rbp)
mov    -0x18(%rbp),%rdi
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <modf@plt>
fld    %st(0)
fstp   %st(0)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modfl>:
jmp    1030 <modf@plt>

LLVM IR (-O0):
define x86_fp80 @modfl(x86_fp80 %0, x86_fp80* %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80*
store x86_fp80 %0, x86_fp80* %3
store x86_fp80* %1, x86_fp80** %4
%5 = load x86_fp80, x86_fp80* %3
%6 = load x86_fp80*, x86_fp80** %4
%7 = bitcast x86_fp80* %6 to double*
%8 = call x86_fp80 @modf(x86_fp80 %5, double* %7)
ret x86_fp80 %8
}

LLVM IR (-O2):
define x86_fp80 @modfl(x86_fp80 %0, x86_fp80* nocapture %1) {
%3 = bitcast x86_fp80* %1 to double*
%4 = tail call x86_fp80 @modf(x86_fp80 %0, double* %3)
ret x86_fp80 %4
}
int is_repetition(char ch) { return ch == '*' || ch == '+' || ch == '?'; }


x86 assembly (clang, -O0):
<is_repetition>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2a,%ecx
mov    %al,-0x2(%rbp)
je     113b <is_repetition+0x3b>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2b,%ecx
mov    %al,-0x2(%rbp)
je     113b <is_repetition+0x3b>
movsbl -0x1(%rbp),%eax
cmp    $0x3f,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_repetition>:
mov    %edi,%eax
and    $0xfe,%al
cmp    $0x2a,%al
sete   %al
cmp    $0x3f,%dil
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @is_repetition(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 42
br i1 %5, label %14, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 43
br i1 %9, label %14, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 63
br label %14
14: ; preds = %10, %6, %1
%15 = phi i1 [ true, %6 ], [ true, %1 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @is_repetition(i8 signext %0) {
%2 = and i8 %0, -2
%3 = icmp eq i8 %2, 42
%4 = icmp eq i8 %0, 63
%5 = or i1 %4, %3
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ print_error(char *);
void print_error_if(char message[], bool condition) {
  if (condition) {
    print_error(message);
  }
}


x86 assembly (clang, -O0):
<print_error_if>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1132 <print_error_if+0x22>
mov    -0x8(%rbp),%rdi
call   1030 <print_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_error_if>:
test   %esi,%esi
je     1119 <print_error_if+0x9>
jmp    1030 <print_error@plt>
ret

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

LLVM IR (-O2):
define void @print_error_if(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @print_error(i8* %0)
br label %6
6: ; preds = %4, %2
ret void
}
void CreateArcList(Schema, A) struct frvStruct *Schema;
struct Vertex *A;
{
  AssignVertexArcListFirst(A, 0);
}


x86 assembly (clang, -O0):
<CreateArcList>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x0,%al
call   1030 <AssignVertexArcListFirst@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CreateArcList>:
mov    %rsi,%rdi
xor    %esi,%esi
xor    %eax,%eax
jmp    1030 <AssignVertexArcListFirst@plt>

LLVM IR (-O0):
%struct.frvStruct = type opaque
%struct.Vertex = type opaque
define void @CreateArcList(%struct.frvStruct* %0, %struct.Vertex* %1) {
%3 = alloca %struct.frvStruct*
%4 = alloca %struct.Vertex*
store %struct.frvStruct* %0, %struct.frvStruct** %3
store %struct.Vertex* %1, %struct.Vertex** %4
%5 = load %struct.Vertex*, %struct.Vertex** %4
%6 = call i32 (%struct.Vertex*, i32, ...) bitcast (i32 (...)* @AssignVertexArcListFirst to i32 (%struct.Vertex*, i32, ...)*)(%struct.Vertex* %5, i32 0)
ret void
}

LLVM IR (-O2):
%struct.frvStruct = type opaque
%struct.Vertex = type opaque
define void @CreateArcList(%struct.frvStruct* nocapture readnone %0, %struct.Vertex* %1) {
%3 = tail call i32 (%struct.Vertex*, i32, ...) bitcast (i32 (...)* @AssignVertexArcListFirst to i32 (%struct.Vertex*, i32, ...)*)(%struct.Vertex* %1, i32 0)
ret void
}
int pop(int *s) { return *--s; }


x86 assembly (clang, -O0):
<pop>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x8(%rbp)
mov    -0x4(%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pop>:
mov    -0x4(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @pop(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i32 -1
store i32* %4, i32** %2
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @pop(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 -1
%3 = load i32, i32* %2
ret i32 %3
}
void expand_stringnames_2list_free(char **snames) {
  int i;
  for (i = 0; snames[i]; i++) {
    free(snames[i]);
  }
  free(snames);
}


x86 assembly (clang, -O0):
<expand_stringnames_2list_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1155 <expand_stringnames_2list_free+0x45>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <expand_stringnames_2list_free+0x13>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expand_stringnames_2list_free>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1141 <expand_stringnames_2list_free+0x31>
lea    0x8(%r14),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1130 <expand_stringnames_2list_free+0x20>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @expand_stringnames_2list_free(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8* [ %9, %4 ], [ %2, %1 ]
tail call void @free(i8* %6)
%7 = add nuw nsw i64 %5, 1
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = bitcast i8** %0 to i8*
tail call void @free(i8* %12)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ slacpy_(char *, int *, int *, float const *, int *, float *,
                           int *);
void aa_cla_slacpy(char uplo, int m, int n, const float *A, int lda, float *B,
                   int ldb) {
  slacpy_(&uplo, &m, &n, A, &lda, B, &ldb);
}


x86 assembly (clang, -O0):
<aa_cla_slacpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dil,%al
mov    0x10(%rbp),%edi
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x28(%rbp),%r9
lea    -0x1(%rbp),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x1c(%rbp),%r8
lea    0x10(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <slacpy_@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aa_cla_slacpy>:
sub    $0x18,%rsp
mov    %dil,0xb(%rsp)
mov    %esi,0x14(%rsp)
mov    %edx,0x10(%rsp)
mov    %r8d,0xc(%rsp)
lea    0x20(%rsp),%rax
mov    %rax,(%rsp)
lea    0xb(%rsp),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%r8
call   1030 <slacpy_@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @aa_cla_slacpy(i8 signext %0, i32 %1, i32 %2, float* %3, i32 %4, float* %5, i32 %6) {
%8 = alloca i8
%9 = alloca i32
%10 = alloca i32
%11 = alloca float*
%12 = alloca i32
%13 = alloca float*
%14 = alloca i32
store i8 %0, i8* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store float* %3, float** %11
store i32 %4, i32* %12
store float* %5, float** %13
store i32 %6, i32* %14
%15 = load float*, float** %11
%16 = load float*, float** %13
%17 = call i32 @slacpy_(i8* %8, i32* %9, i32* %10, float* %15, i32* %12, float* %16, i32* %14)
ret void
}

LLVM IR (-O2):
define void @aa_cla_slacpy(i8 signext %0, i32 %1, i32 %2, float* %3, i32 %4, float* %5, i32 %6) {
%8 = alloca i8
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8 %0, i8* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %4, i32* %11
store i32 %6, i32* %12
%13 = call i32 @slacpy_(i8* %8, i32* %9, i32* %10, float* %3, i32* %11, float* %5, i32* %12)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;
struct udev {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, char const *, int);
int /*<<< orphan*/ vprintf(char const *, int /*<<< orphan*/);
void log_fn(struct udev *udev, int priority, const char *file, int line,
            const char *fn, const char *format, va_list args) {
  printf("test-libudev: %s %s:%d ", fn, file, line);
  vprintf(format, args);
}


x86 assembly (clang, -O0):
<log_fn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    0x10(%rbp),%esi
call   1040 <vprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_fn>:
push   %rbp
push   %rbx
push   %rax
mov    %r9,%rbx
mov    %r8,%rsi
mov    0x20(%rsp),%ebp
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <vprintf@plt>

LLVM IR (-O0):
%struct.udev = type { i32 }
@.str = [24 x i8] c"test-libudev: %s %s:%d \00"
define void @log_fn(%struct.udev* %0, i32 %1, i8* %2, i32 %3, i8* %4, i8* %5, i32 %6) {
%8 = alloca %struct.udev*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
store %struct.udev* %0, %struct.udev** %8
store i32 %1, i32* %9
store i8* %2, i8** %10
store i32 %3, i32* %11
store i8* %4, i8** %12
store i8* %5, i8** %13
store i32 %6, i32* %14
%15 = load i8*, i8** %12
%16 = load i8*, i8** %10
%17 = load i32, i32* %11
%18 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %16, i32 %17)
%19 = load i8*, i8** %13
%20 = load i32, i32* %14
%21 = call i32 @vprintf(i8* %19, i32 %20)
ret void
}

LLVM IR (-O2):
%struct.udev = type { i32 }
@.str = [24 x i8] c"test-libudev: %s %s:%d \00"
define void @log_fn(%struct.udev* nocapture readnone %0, i32 %1, i8* %2, i32 %3, i8* %4, i8* nocapture %5, i32 %6) {
%8 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %2, i32 %3)
%9 = tail call i32 @vprintf(i8* %5, i32 %6)
ret void
}
/* Variables and functions */
scalar_t__ cbrtl(long double);
int /*<<< orphan*/ link_failure_cbrtl();
void test_cbrtl(long double ld) {
  if (cbrtl(ld) != cbrtl(ld))
    link_failure_cbrtl();
}


x86 assembly (clang, -O0):
<test_cbrtl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <cbrtl@plt>
mov    %rax,-0x18(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <cbrtl@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
je     1163 <test_cbrtl+0x43>
mov    $0x0,%al
call   1030 <link_failure_cbrtl@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_cbrtl>:
push   %rbx
sub    $0x20,%rsp
fldt   0x30(%rsp)
fld    %st(0)
fstpt  0x14(%rsp)
fstpt  (%rsp)
call   1040 <cbrtl@plt>
mov    %rax,%rbx
fldt   0x14(%rsp)
fstpt  (%rsp)
call   1040 <cbrtl@plt>
cmp    %rax,%rbx
jne    1151 <test_cbrtl+0x31>
add    $0x20,%rsp
pop    %rbx
ret
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
jmp    1030 <link_failure_cbrtl@plt>

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

LLVM IR (-O2):
define void @test_cbrtl(x86_fp80 %0) {
%2 = tail call i64 @cbrtl(x86_fp80 %0)
%3 = tail call i64 @cbrtl(x86_fp80 %0)
%4 = icmp eq i64 %2, %3
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (...) @link_failure_cbrtl()
br label %7
7: ; preds = %5, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
void loulou(void) {
  printf("LOULOU !\n");
  getchar();
}


x86 assembly (clang, -O0):
<loulou>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<loulou>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <getchar@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"LOULOU !\0A\00"
define void @loulou() {
%1 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @getchar()
ret void
}

LLVM IR (-O2):
@str = [9 x i8] c"LOULOU !\00"
define void @loulou() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @getchar()
ret void
}