xunge/DecIR huggingface dataset:
void test1(int *i) {}


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

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

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

LLVM IR (-O2):
define void @test1(i32* nocapture %0) {
ret void
}
void RTStrToInt64(void) {}


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

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

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

LLVM IR (-O2):
define void @RTStrToInt64() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void fn_vi_va(int i, ...) {
  (void)i;
  abort();
}


x86 assembly (clang, -O0):
<fn_vi_va>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<fn_vi_va>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @fn_vi_va(i32 %0, ...) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define void @fn_vi_va(i32 %0, ...) {
%2 = tail call i32 (...) @abort()
unreachable
}
long __atomic_swap(volatile long *p, long val) {
  asm volatile("xchg %0, %1" : "=r"(val), "=m"(*p) : "0"(val) : "memory");
  return val;
}


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

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

LLVM IR (-O0):
define i64 @__atomic_swap(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 i64 asm sideeffect "xchg $0, $1", "=r,=*m,0,~{memory},~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %5, i64 %6)
store i64 %7, i64* %4
%8 = load i64, i64* %4
ret i64 %8
}

LLVM IR (-O2):
define i64 @__atomic_swap(i64* %0, i64 %1) {
%3 = tail call i64 asm sideeffect "xchg $0, $1", "=r,=*m,0,~{memory},~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %0, i64 %1)
ret i64 %3
}
/* Type definitions */
typedef int __uint16_t;

/* Variables and functions */
__uint16_t yms_u16_build(__uint16_t lo, __uint16_t hi) {
  __uint16_t result = ((lo & 0xff) | ((hi << 8) & 0xff00));
  return result;
}


x86 assembly (clang, -O0):
<yms_u16_build>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    -0x8(%rbp),%ecx
shl    $0x8,%ecx
and    $0xff00,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<yms_u16_build>:
movzbl %dil,%ecx
shl    $0x8,%esi
movzwl %si,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @yms_u16_build(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = and i32 %6, 255
%8 = load i32, i32* %4
%9 = shl i32 %8, 8
%10 = and i32 %9, 65280
%11 = or i32 %7, %10
store i32 %11, i32* %5
%12 = load i32, i32* %5
ret i32 %12
}

LLVM IR (-O2):
define i32 @yms_u16_build(i32 %0, i32 %1) {
%3 = and i32 %0, 255
%4 = shl i32 %1, 8
%5 = and i32 %4, 65280
%6 = or i32 %5, %3
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void *malloc(int);
int /*<<< orphan*/ printf(char *);
void *checked_malloc(int len) {
  void *p = malloc(len);
  if (!p) {
    printf("Run out of memory!\n");
    exit(1);
  }
  return p;
}


x86 assembly (clang, -O0):
<checked_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1168 <checked_malloc+0x38>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checked_malloc>:
push   %rax
call   1040 <malloc@plt>
test   %rax,%rax
je     113d <checked_malloc+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Run out of memory!\0A\00"
define i8* @checked_malloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@str = [19 x i8] c"Run out of memory!\00"
define noalias i8* @checked_malloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
ret i8* %2
}
int main() {
  char *s = dynstr_new("Hello, world!\n");
  assert(s);
  assert(dynstr_len(s) == 14);
  printf("%s", s);
  dynstr_delete(s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1070 <dynstr_new@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <dynstr_len@plt>
cmp    $0xe,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1050 <assert@plt>
mov    -0x10(%rbp),%rsi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1060 <dynstr_delete@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xea8(%rip),%rdi
xor    %eax,%eax
call   1070 <dynstr_new@plt>
movslq %eax,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <assert@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <dynstr_len@plt>
xor    %edi,%edi
cmp    $0xe,%eax
sete   %dil
xor    %eax,%eax
call   1050 <assert@plt>
lea    0xe82(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <dynstr_delete@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Hello, world!\0A\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @dynstr_new to i32 (i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @assert to i32 (i8*, ...)*)(i8* %6)
%8 = load i8*, i8** %2
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @dynstr_len to i32 (i8*, ...)*)(i8* %8)
%10 = icmp eq i32 %9, 14
%11 = zext i1 %10 to i32
%12 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %11)
%13 = load i8*, i8** %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = load i8*, i8** %2
%16 = call i32 (i8*, ...) bitcast (i32 (...)* @dynstr_delete to i32 (i8*, ...)*)(i8* %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Hello, world!\0A\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) bitcast (i32 (...)* @dynstr_new to i32 (i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = sext i32 %1 to i64
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @assert to i32 (i8*, ...)*)(i8* %3)
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @dynstr_len to i32 (i8*, ...)*)(i8* %3)
%6 = icmp eq i32 %5, 14
%7 = zext i1 %6 to i32
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %7)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%10 = tail call i32 (i8*, ...) bitcast (i32 (...)* @dynstr_delete to i32 (i8*, ...)*)(i8* %3)
ret i32 0
}
extern unsigned short __inw_p(unsigned short port) {
  unsigned short _v;
  __asm__ __volatile__("in"
                       "w"
                       " %"
                       "w"
                       "1,%"
                       ""
                       "0"
                       : "=a"(_v)
                       : "d"(port));
  __asm__ __volatile__("jmp 1f\n1:\tjmp 1f\n1:");
  return _v;
}


x86 assembly (clang, -O0):
<__inw_p>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%ax
mov    %ax,-0x4(%rbp)
jmp    111a <__inw_p+0x1a>
jmp    111f <__inw_p+0x1f>
movzwl -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__inw_p>:
mov    %edi,%edx
in     (%dx),%ax
jmp    1106 <__inw_p+0x6>
jmp    1108 <__inw_p+0x8>
ret

LLVM IR (-O0):
define zeroext i16 @__inw_p(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i16 asm sideeffect "inw ${1:w},$0", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i16 %5, i16* %3
%6 = load i16, i16* %3
ret i16 %6
}

LLVM IR (-O2):
define zeroext i16 @__inw_p(i16 zeroext %0) {
%2 = tail call i16 asm sideeffect "inw ${1:w},$0", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0)
tail call void asm sideeffect "jmp 1f\0A1:\09jmp 1f\0A1:", "~{dirflag},~{fpsr},~{flags}"()
ret i16 %2
}
/* Variables and functions */
unsigned swap_endianness(unsigned n) {
  unsigned res = 0;
  unsigned mask = 0xFF;
  size_t i;
  for (i = 0; i < sizeof(unsigned); i++) {
    res = (res << 8) | (n & mask);
    n >>= 8;
  }
  return res;
}


x86 assembly (clang, -O0):
<swap_endianness>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0xff,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x4,-0x18(%rbp)
jae    1153 <swap_endianness+0x53>
mov    -0x8(%rbp),%eax
shl    $0x8,%eax
mov    -0x4(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
mov    %eax,-0x4(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    111d <swap_endianness+0x1d>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @swap_endianness(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
store i32 %0, i32* %2
store i32 0, i32* %3
store i32 255, i32* %4
store i64 0, i64* %5
br label %6
6: ; preds = %18, %1
%7 = load i64, i64* %5
%8 = icmp ult i64 %7, 4
br i1 %8, label %9, label %21
9: ; preds = %6
%10 = load i32, i32* %3
%11 = shl i32 %10, 8
%12 = load i32, i32* %2
%13 = load i32, i32* %4
%14 = and i32 %12, %13
%15 = or i32 %11, %14
store i32 %15, i32* %3
%16 = load i32, i32* %2
%17 = lshr i32 %16, 8
store i32 %17, i32* %2
br label %18
18: ; preds = %9
%19 = load i64, i64* %5
%20 = add i64 %19, 1
store i64 %20, i64* %5
br label %6
21: ; preds = %6
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @swap_endianness(i32 %0) {
%2 = call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ fatal_perror(char *, size_t, size_t);
void *callock(size_t nmemb, size_t size) {
  void *m;
  m = calloc(nmemb, size);
  if (!m && size)
    fatal_perror("calloc(%u, %u): ", nmemb, size);
  return m;
}


x86 assembly (clang, -O0):
<callock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    116b <callock+0x4b>
cmpq   $0x0,-0x10(%rbp)
je     116b <callock+0x4b>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe9a(%rip),%rdi
call   1040 <fatal_perror@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<callock>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
call   1030 <calloc@plt>
mov    %rax,%r15
test   %rbx,%rbx
je     114f <callock+0x2f>
test   %r15,%r15
jne    114f <callock+0x2f>
lea    0xebc(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <fatal_perror@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"calloc(%u, %u): \00"
define noalias i8* @callock(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i8* %3, null
%5 = icmp ne i64 %1, 0
%6 = and i1 %5, %4
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @fatal_perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %0, i64 %1)
br label %9
9: ; preds = %7, %2
ret i8* %3
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint8_t instruction_extension_extract_wl(uint16_t instruction) {
  return (instruction >> 0x0B) & 0x01;
}


x86 assembly (clang, -O0):
<instruction_extension_extract_wl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0xb,%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<instruction_extension_extract_wl>:
mov    %edi,%eax
shr    $0xb,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @instruction_extension_extract_wl(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 11
%5 = and i32 %4, 1
ret i32 %5
}

LLVM IR (-O2):
define i32 @instruction_extension_extract_wl(i32 %0) {
%2 = lshr i32 %0, 11
%3 = and i32 %2, 1
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ GLfloat;

/* Variables and functions */
int /*<<< orphan*/ glRasterPos4fv(int /*<<< orphan*/ *);
void RasterPos4fv(GLfloat v[4]) { glRasterPos4fv(v); }


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

x86 assembly (clang, -O2):
<RasterPos4fv>:
jmp    1030 <glRasterPos4fv@plt>

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

LLVM IR (-O2):
define void @RasterPos4fv(i32* %0) {
%2 = tail call i32 @glRasterPos4fv(i32* %0)
ret void
}
struct private *private(struct lzma *lz) {
  return (struct private *)(lz);
}


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

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

LLVM IR (-O0):
%struct.private = type opaque
%struct.lzma = type opaque
define %struct.private* @private(%struct.lzma* %0) {
%2 = alloca %struct.lzma*
store %struct.lzma* %0, %struct.lzma** %2
%3 = load %struct.lzma*, %struct.lzma** %2
%4 = bitcast %struct.lzma* %3 to %struct.private*
ret %struct.private* %4
}

LLVM IR (-O2):
%struct.private = type opaque
%struct.lzma = type opaque
define %struct.private* @private(%struct.lzma* readnone %0) {
%2 = bitcast %struct.lzma* %0 to %struct.private*
ret %struct.private* %2
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ dup(int);
int open(char *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  int s;
  {
    int i;
    for (i = 3; i < 64; i++)
      close(i);
  };
  s = open("/dev/null", O_RDONLY);
  dup(s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x3,-0x18(%rbp)
cmpl   $0x40,-0x18(%rbp)
jge    116d <main+0x3d>
mov    -0x18(%rbp),%edi
call   1040 <close@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114d <main+0x1d>
mov    0x2e74(%rip),%rax
mov    (%rax),%esi
lea    0xe83(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <dup@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x3,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1040 <close@plt>
add    $0x1,%ebx
cmp    $0x40,%ebx
jne    1140 <main+0x10>
mov    0x2e92(%rip),%rax
mov    (%rax),%esi
lea    0xea1(%rip),%rdi
call   1050 <open@plt>
mov    %eax,%edi
call   1030 <dup@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"/dev/null\00"
@O_RDONLY = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 3, i32* %7
br label %8
8: ; preds = %14, %2
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 64
br i1 %10, label %11, label %17
11: ; preds = %8
%12 = load i32, i32* %7
%13 = call i32 @close(i32 %12)
br label %14
14: ; preds = %11
%15 = load i32, i32* %7
%16 = add nsw i32 %15, 1
store i32 %16, i32* %7
br label %8
17: ; preds = %8
%18 = load i32, i32* @O_RDONLY
%19 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %18)
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = call i32 @dup(i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"/dev/null\00"
@O_RDONLY = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i32 [ 3, %2 ], [ %6, %3 ]
%5 = tail call i32 @close(i32 %4)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, 64
br i1 %7, label %8, label %3
8: ; preds = %3
%9 = load i32, i32* @O_RDONLY
%10 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = tail call i32 @dup(i32 %10)
ret i32 0
}
/* Variables and functions */
int get_fpu_except_flags();
int /*<<< orphan*/ set_fpu_except_flags(int, int /*<<< orphan*/);
int /*<<< orphan*/ set_fpu_state(void *);
void ieee_procedure_exit(void *state) {
  int flags = get_fpu_except_flags();
  set_fpu_state(state);
  set_fpu_except_flags(flags, 0);
}


x86 assembly (clang, -O0):
<ieee_procedure_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <get_fpu_except_flags@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <set_fpu_state@plt>
mov    -0xc(%rbp),%edi
xor    %esi,%esi
call   1040 <set_fpu_except_flags@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ieee_procedure_exit>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <get_fpu_except_flags@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <set_fpu_state@plt>
mov    %ebp,%edi
xor    %esi,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <set_fpu_except_flags@plt>

LLVM IR (-O0):
define void @ieee_procedure_exit(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = call i32 (...) @get_fpu_except_flags()
store i32 %4, i32* %3
%5 = load i8*, i8** %2
%6 = call i32 @set_fpu_state(i8* %5)
%7 = load i32, i32* %3
%8 = call i32 @set_fpu_except_flags(i32 %7, i32 0)
ret void
}

LLVM IR (-O2):
define void @ieee_procedure_exit(i8* %0) {
%2 = tail call i32 (...) @get_fpu_except_flags()
%3 = tail call i32 @set_fpu_state(i8* %0)
%4 = tail call i32 @set_fpu_except_flags(i32 %2, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cramen(int);
int /*<<< orphan*/ cramlc(int, int, int);
int /*<<< orphan*/ proutn(char *);
void crmena(int i, int enemy, int key, int x, int y) {
  if (i == 1)
    proutn("***");
  cramen(enemy);
  proutn(" at");
  cramlc(key, x, y);
}


x86 assembly (clang, -O0):
<crmena>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    115e <crmena+0x2e>
lea    0xea7(%rip),%rdi
call   1030 <proutn@plt>
mov    -0x8(%rbp),%edi
call   1040 <cramen@plt>
lea    0xe97(%rip),%rdi
call   1030 <proutn@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1050 <cramlc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crmena>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8d,%r14d
mov    %ecx,%r15d
mov    %edx,%ebx
mov    %esi,%ebp
cmp    $0x1,%edi
jne    1152 <crmena+0x22>
lea    0xeb3(%rip),%rdi
call   1030 <proutn@plt>
mov    %ebp,%edi
call   1040 <cramen@plt>
lea    0xea4(%rip),%rdi
call   1030 <proutn@plt>
mov    %ebx,%edi
mov    %r15d,%esi
mov    %r14d,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <cramlc@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"***\00"
@.str.1 = [4 x i8] c" at\00"
define void @crmena(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %6
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %15
13: ; preds = %5
%14 = call i32 @proutn(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %5
%16 = load i32, i32* %7
%17 = call i32 @cramen(i32 %16)
%18 = call i32 @proutn(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%19 = load i32, i32* %8
%20 = load i32, i32* %9
%21 = load i32, i32* %10
%22 = call i32 @cramlc(i32 %19, i32 %20, i32 %21)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"***\00"
@.str.1 = [4 x i8] c" at\00"
define void @crmena(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = icmp eq i32 %0, 1
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i32 @proutn(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
%10 = tail call i32 @cramen(i32 %1)
%11 = tail call i32 @proutn(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 @cramlc(i32 %2, i32 %3, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *argv0) {
  fprintf(stderr, "Usage: %s {one or more binary numbers ...}\n", argv0);
  exit(1);
}


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

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

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [44 x i8] c"Usage: %s {one or more binary numbers ...}\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
double pow(int, double);
double DbToLinear(double dfDb) { return pow(10, dfDb / 20); }


x86 assembly (clang, -O0):
<DbToLinear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    $0xa,%edi
call   1030 <pow@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DbToLinear>:
divsd  0xee8(%rip),%xmm0
mov    $0xa,%edi
jmp    1030 <pow@plt>

LLVM IR (-O0):
define double @DbToLinear(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fdiv double %3, 2.000000e+01
%5 = call double @pow(i32 10, double %4)
ret double %5
}

LLVM IR (-O2):
define double @DbToLinear(double %0) {
%2 = fdiv double %0, 2.000000e+01
%3 = tail call double @pow(i32 10, double %2)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ exit1(int /*<<< orphan*/);
int /*<<< orphan*/ qemu_write(int, char *, int);
void _start(void) {
  qemu_write(1, "Hello World\n", 12);
  exit1(0);
}


x86 assembly (clang, -O0):
<_start>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
lea    0xed0(%rip),%rsi
mov    $0xc,%edx
call   1040 <qemu_write@plt>
xor    %edi,%edi
call   1030 <exit1@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<_start>:
push   %rax
lea    0xed8(%rip),%rsi
mov    $0x1,%edi
mov    $0xc,%edx
call   1040 <qemu_write@plt>
xor    %edi,%edi
pop    %rax
jmp    1030 <exit1@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"Hello World\0A\00"
define void @_start() {
%1 = call i32 @qemu_write(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 12)
%2 = call i32 @exit1(i32 0)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello World\0A\00"
define void @_start() {
%1 = tail call i32 @qemu_write(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 12)
%2 = tail call i32 @exit1(i32 0)
ret void
}
unsigned ZSTD_XXH_versionNumber(void) { return (0 * 100 * 100 + 6 * 100 + 2); }


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

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

LLVM IR (-O0):
define i32 @ZSTD_XXH_versionNumber() {
ret i32 602
}

LLVM IR (-O2):
define i32 @ZSTD_XXH_versionNumber() {
ret i32 602
}
/* Variables and functions */
void *clock_gettime;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  void *p;
  (void)argc;
  (void)argv;
  p = clock_gettime;
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eab(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@clock_gettime = global i8* null
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = load i8*, i8** @clock_gettime
store i8* %9, i8** %6
%10 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@clock_gettime = global i8* null
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ put32(unsigned int);
int /*<<< orphan*/ put8(int);
void sub_m32_imm32(unsigned int *m32, unsigned int imm32) {
  put8(0x81);
  put8(0x2D);
  put32((unsigned int)(m32));
  put32(imm32);
}


x86 assembly (clang, -O0):
<sub_m32_imm32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x81,%edi
call   1030 <put8@plt>
mov    $0x2d,%edi
call   1030 <put8@plt>
mov    -0x8(%rbp),%rax
mov    %eax,%edi
call   1040 <put32@plt>
mov    -0xc(%rbp),%edi
call   1040 <put32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub_m32_imm32>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    $0x81,%edi
call   1030 <put8@plt>
mov    $0x2d,%edi
call   1030 <put8@plt>
mov    %ebx,%edi
call   1040 <put32@plt>
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <put32@plt>

LLVM IR (-O0):
define void @sub_m32_imm32(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = call i32 @put8(i32 129)
%6 = call i32 @put8(i32 45)
%7 = load i32*, i32** %3
%8 = ptrtoint i32* %7 to i32
%9 = call i32 @put32(i32 %8)
%10 = load i32, i32* %4
%11 = call i32 @put32(i32 %10)
ret void
}

LLVM IR (-O2):
define void @sub_m32_imm32(i32* %0, i32 %1) {
%3 = tail call i32 @put8(i32 129)
%4 = tail call i32 @put8(i32 45)
%5 = ptrtoint i32* %0 to i64
%6 = trunc i64 %5 to i32
%7 = tail call i32 @put32(i32 %6)
%8 = tail call i32 @put32(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void get_libname(void) { printf("riscv64\n"); }


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

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

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

LLVM IR (-O2):
@str = [8 x i8] c"riscv64\00"
define void @get_libname() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret void
}
void free_lvalue(lv) struct lvalue *lv;
{
  sh_xfree((lv),
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/AlexYursha/shell/refs/heads/dev/expr.c",
           928);
}


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

x86 assembly (clang, -O2):
<free_lvalue>:
lea    0xee9(%rip),%rsi
mov    $0x3a0,%edx
xor    %eax,%eax
jmp    1030 <sh_xfree@plt>

LLVM IR (-O0):
%struct.lvalue = type opaque
@.str = [129 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AlexYursha/shell/refs/heads/dev/expr.c\00"
define void @free_lvalue(%struct.lvalue* %0) {
%2 = alloca %struct.lvalue*
store %struct.lvalue* %0, %struct.lvalue** %2
%3 = load %struct.lvalue*, %struct.lvalue** %2
%4 = call i32 (%struct.lvalue*, i8*, i32, ...) bitcast (i32 (...)* @sh_xfree to i32 (%struct.lvalue*, i8*, i32, ...)*)(%struct.lvalue* %3, i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 928)
ret void
}

LLVM IR (-O2):
%struct.lvalue = type opaque
@.str = [129 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AlexYursha/shell/refs/heads/dev/expr.c\00"
define void @free_lvalue(%struct.lvalue* %0) {
%2 = tail call i32 (%struct.lvalue*, i8*, i32, ...) bitcast (i32 (...)* @sh_xfree to i32 (%struct.lvalue*, i8*, i32, ...)*)(%struct.lvalue* %0, i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 928)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("Usage:\n");
  printf("  bench_a_mul_c -f <matrix_file> [-b block_size] [-t] [-c] [-r]\n");
  printf("  -t  transpose matrix\n");
  printf("  -c  run conjugate gradient\n");
  printf("  -r  also run CSR A_mul_b\n");
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
lea    0xf17(%rip),%rdi
call   1030 <puts@plt>
lea    0xf22(%rip),%rdi
call   1030 <puts@plt>
lea    0xf33(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Usage:\0A\00"
@.str.1 = [65 x i8] c" bench_a_mul_c -f <matrix_file> [-b block_size] [-t] [-c] [-r]\0A\00"
@.str.2 = [24 x i8] c" -t transpose matrix\0A\00"
@.str.3 = [30 x i8] c" -c run conjugate gradient\0A\00"
@.str.4 = [28 x i8] c" -r also run CSR A_mul_b\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [7 x i8] c"Usage:\00"
@str.5 = [64 x i8] c" bench_a_mul_c -f <matrix_file> [-b block_size] [-t] [-c] [-r]\00"
@str.6 = [23 x i8] c" -t transpose matrix\00"
@str.7 = [29 x i8] c" -c run conjugate gradient\00"
@str.8 = [27 x i8] c" -r also run CSR A_mul_b\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.8, i64 0, i64 0))
ret void
}
void XESetError() {}


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

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

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

LLVM IR (-O2):
define void @XESetError() {
ret void
}
/* Variables and functions */
unsigned char UCHAR_MAX;
int expect_unsigned_char_sum(unsigned char (*f)(unsigned char, unsigned char)) {
  return f(UCHAR_MAX - 1, 1) == UCHAR_MAX;
}


x86 assembly (clang, -O0):
<expect_unsigned_char_sum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2ed9(%rip),%rcx
movzbl (%rcx),%ecx
sub    $0x1,%ecx
mov    $0x1,%esi
movzbl %cl,%edi
call   *%rax
movzbl %al,%eax
mov    0x2ebf(%rip),%rcx
movzbl (%rcx),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expect_unsigned_char_sum>:
push   %rbx
mov    %rdi,%rax
mov    0x2ee5(%rip),%rbx
mov    (%rbx),%cl
add    $0xff,%cl
movzbl %cl,%edi
mov    $0x1,%esi
call   *%rax
xor    %ecx,%ecx
cmp    (%rbx),%al
sete   %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@UCHAR_MAX = global i8 0
define i32 @expect_unsigned_char_sum(i8 (i8, i8)* %0) {
%2 = alloca i8 (i8, i8)*
store i8 (i8, i8)* %0, i8 (i8, i8)** %2
%3 = load i8 (i8, i8)*, i8 (i8, i8)** %2
%4 = load i8, i8* @UCHAR_MAX
%5 = zext i8 %4 to i32
%6 = sub nsw i32 %5, 1
%7 = trunc i32 %6 to i8
%8 = call zeroext i8 %3(i8 zeroext %7, i8 zeroext 1)
%9 = zext i8 %8 to i32
%10 = load i8, i8* @UCHAR_MAX
%11 = zext i8 %10 to i32
%12 = icmp eq i32 %9, %11
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
@UCHAR_MAX = global i8 0
define i32 @expect_unsigned_char_sum(i8 (i8, i8)* nocapture %0) {
%2 = load i8, i8* @UCHAR_MAX
%3 = add i8 %2, -1
%4 = tail call zeroext i8 %0(i8 zeroext %3, i8 zeroext 1)
%5 = load i8, i8* @UCHAR_MAX
%6 = icmp eq i8 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Type definitions */
struct stat {
  int st_size;
};

/* Variables and functions */
scalar_t__ stat(char const *, struct stat *);
int file_size(const char *path) {
  struct stat st;
  if (stat(path, &st) == 0)
    return st.st_size;
  return -1;
}


x86 assembly (clang, -O0):
<file_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
jne    113e <file_size+0x2e>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1145 <file_size+0x35>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_size>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
neg    %rax
sbb    %eax,%eax
or     (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @file_size(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @stat(i8* %5, %struct.stat* %4)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%10 = load i32, i32* %9
store i32 %10, i32* %2
br label %12
11: ; preds = %1
store i32 -1, i32* %2
br label %12
12: ; preds = %11, %8
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @file_size(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%7 = load i32, i32* %6
%8 = select i1 %5, i32 %7, i32 -1
ret i32 %8
}
/* Type definitions */
typedef int uint64_t;
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
scalar_t__ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
uint64_t ticks() {
  struct timeval tv;
  if (gettimeofday(&tv, NULL) != 0)
    return 0;
  return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
}


x86 assembly (clang, -O0):
<ticks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cmp    $0x0,%rax
je     113b <ticks+0x2b>
movl   $0x0,-0x4(%rbp)
jmp    115a <ticks+0x4a>
imul   $0x3e8,-0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ticks>:
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
test   %rax,%rax
jne    114b <ticks+0x3b>
imul   $0x3e8,0x8(%rsp),%eax
movslq 0xc(%rsp),%rcx
imul   $0x10624dd3,%rcx,%rbx
mov    %rbx,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rbx
add    %ecx,%ebx
add    %eax,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @ticks() {
%1 = alloca i32
%2 = alloca %struct.timeval
%3 = call i64 @gettimeofday(%struct.timeval* %2, i32* null)
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 0, i32* %1
br label %14
6: ; preds = %0
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%8 = load i32, i32* %7
%9 = mul nsw i32 %8, 1000
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
%11 = load i32, i32* %10
%12 = sdiv i32 %11, 1000
%13 = add nsw i32 %9, %12
store i32 %13, i32* %1
br label %14
14: ; preds = %6, %5
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i32 @ticks() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i64 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %13
5: ; preds = %0
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 1000
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%10 = load i32, i32* %9
%11 = sdiv i32 %10, 1000
%12 = add nsw i32 %11, %8
br label %13
13: ; preds = %0, %5
%14 = phi i32 [ %12, %5 ], [ 0, %0 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M121_f(char *s) {
  debug("M121_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M121_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M121_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M121_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M121_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M121_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M121_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
int x39_process_syn(struct mypacket *packet) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.mypacket = type opaque
define i32 @x39_process_syn(%struct.mypacket* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int /*<<< orphan*/ print_u32_hex(int);
void print_u64_hex(uint64_t val) {
  print_u32_hex(val >> 32);
  print_u32_hex(val);
}


x86 assembly (clang, -O0):
<print_u64_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x20,%ecx
sar    %cl,%edi
call   1030 <print_u32_hex@plt>
mov    -0x4(%rbp),%edi
call   1030 <print_u32_hex@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_u64_hex>:
push   %rbx
mov    %edi,%ebx
call   1030 <print_u32_hex@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <print_u32_hex@plt>

LLVM IR (-O0):
define void @print_u64_hex(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 32
%5 = call i32 @print_u32_hex(i32 %4)
%6 = load i32, i32* %2
%7 = call i32 @print_u32_hex(i32 %6)
ret void
}

LLVM IR (-O2):
define void @print_u64_hex(i32 %0) {
%2 = tail call i32 @print_u32_hex(i32 poison)
%3 = tail call i32 @print_u32_hex(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void other(void) { printf("Computer hacked <(0_0)>\n"); }


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

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

LLVM IR (-O0):
@.str = [25 x i8] c"Computer hacked <(0_0)>\0A\00"
define void @other() {
%1 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [24 x i8] c"Computer hacked <(0_0)>\00"
define void @other() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct table_entry {
  int dummy;
};
struct table_col {
  int dummy;
};

/* Variables and functions */
int l_unit_raw_div(struct table_col *, struct table_entry *, int, char *);
int l_unit_mib(struct table_col *col, struct table_entry *e) {
  return l_unit_raw_div(col, e, 1024, "%.2lf");
}


x86 assembly (clang, -O0):
<l_unit_mib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x400,%edx
lea    0xecc(%rip),%rcx
call   1030 <l_unit_raw_div@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<l_unit_mib>:
lea    0xee9(%rip),%rcx
mov    $0x400,%edx
jmp    1030 <l_unit_raw_div@plt>

LLVM IR (-O0):
%struct.table_col = type { i32 }
%struct.table_entry = type { i32 }
@.str = [6 x i8] c"%.2lf\00"
define i32 @l_unit_mib(%struct.table_col* %0, %struct.table_entry* %1) {
%3 = alloca %struct.table_col*
%4 = alloca %struct.table_entry*
store %struct.table_col* %0, %struct.table_col** %3
store %struct.table_entry* %1, %struct.table_entry** %4
%5 = load %struct.table_col*, %struct.table_col** %3
%6 = load %struct.table_entry*, %struct.table_entry** %4
%7 = call i32 @l_unit_raw_div(%struct.table_col* %5, %struct.table_entry* %6, i32 1024, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 %7
}

LLVM IR (-O2):
%struct.table_col = type { i32 }
%struct.table_entry = type { i32 }
@.str = [6 x i8] c"%.2lf\00"
define i32 @l_unit_mib(%struct.table_col* %0, %struct.table_entry* %1) {
%3 = tail call i32 @l_unit_raw_div(%struct.table_col* %0, %struct.table_entry* %1, i32 1024, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ DumpStr(char *, char *);
void StrDump(char *text) { DumpStr("%s", text); }


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @StrDump(i8* %0) {
%2 = tail call i32 @DumpStr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int foo(int bar) { return bar; }


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

x86 assembly (clang, -O2):
<foo>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 returned %0) {
ret i32 %0
}