xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ cPrintf(char *);
void help10(void) {
  cPrintf("  d                 dump 256 bytes starting at PC\n");
  cPrintf("  d  <addr>         dump 256 bytes starting at <addr>\n");
  cPrintf("  d  <addr> <cnt>   dump <cnt> bytes starting at <addr>\n");
}


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

x86 assembly (clang, -O2):
<help10>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <cPrintf@plt>
lea    0xf0f(%rip),%rdi
call   1030 <cPrintf@plt>
lea    0xf3a(%rip),%rdi
pop    %rax
jmp    1030 <cPrintf@plt>

LLVM IR (-O0):
@.str = [51 x i8] c" d dump 256 bytes starting at PC\0A\00"
@.str.1 = [55 x i8] c" d <addr> dump 256 bytes starting at <addr>\0A\00"
@.str.2 = [57 x i8] c" d <addr> <cnt> dump <cnt> bytes starting at <addr>\0A\00"
define void @help10() {
%1 = call i32 @cPrintf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @cPrintf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @cPrintf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [51 x i8] c" d dump 256 bytes starting at PC\0A\00"
@.str.1 = [55 x i8] c" d <addr> dump 256 bytes starting at <addr>\0A\00"
@.str.2 = [57 x i8] c" d <addr> <cnt> dump <cnt> bytes starting at <addr>\0A\00"
define void @help10() {
%1 = tail call i32 @cPrintf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @cPrintf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @cPrintf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0))
ret void
}
void load_inode(int inode_num, void *buf) {
  __asm__("nop" ::"b"(inode_num));
  __asm__("nop" ::"c"(buf));
  __asm__("int $0x85" ::"a"(0x01));
}


x86 assembly (clang, -O0):
<load_inode>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0xc(%rbp),%ebx
nop
mov    -0x18(%rbp),%rcx
nop
mov    $0x1,%eax
int    $0x85
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_inode>:
push   %rbx
mov    %rsi,%rcx
mov    %edi,%ebx
nop
nop
mov    $0x1,%eax
int    $0x85
pop    %rbx
ret

LLVM IR (-O0):
define void @load_inode(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
ret void
}

LLVM IR (-O2):
define void @load_inode(i32 %0, i8* %1) {
tail call void asm sideeffect "nop", "{bx},~{dirflag},~{fpsr},~{flags}"(i32 %0)
tail call void asm sideeffect "nop", "{cx},~{dirflag},~{fpsr},~{flags}"(i8* %1)
tail call void asm sideeffect "int $$0x85", "{ax},~{dirflag},~{fpsr},~{flags}"(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void check(int result) {
  if (result != -1)
    abort();
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
je     112c <check+0x1c>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
cmp    $0xffffffff,%edi
jne    1116 <check+0x6>
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define void @check(i32 %0) {
%2 = icmp eq i32 %0, -1
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
ret void
}
/* Variables and functions */
int rand();
int rand_bool(int percent) { return ((rand() % 100) <= percent); }


x86 assembly (clang, -O0):
<rand_bool>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    -0x4(%rbp),%edx
setle  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_bool>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
movslq %eax,%rcx
imul   $0x51eb851f,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rax
add    %edx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%ecx
xor    %eax,%eax
cmp    %ebx,%ecx
setle  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @rand_bool(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rand()
%4 = srem i32 %3, 100
%5 = load i32, i32* %2
%6 = icmp sle i32 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @rand_bool(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, 100
%4 = icmp sle i32 %3, %0
%5 = zext i1 %4 to i32
ret i32 %5
}
int test_imm_02uint8_reg(unsigned char val) {
  return ((val) & (0x02 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_02uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 2
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int EOF;
int close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprint_err(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
extern int disconnect_socket(int socket) {
  int err = close(socket);
  if (err == EOF) {
    fprint_err("### Error closing output: %s\n", strerror(errno));
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<disconnect_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <close@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e98(%rip),%rcx
cmp    (%rcx),%eax
jne    1180 <disconnect_socket+0x50>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %eax,%esi
lea    0xe91(%rip),%rdi
call   1030 <fprint_err@plt>
movl   $0x1,-0x4(%rbp)
jmp    1187 <disconnect_socket+0x57>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disconnect_socket>:
push   %rax
call   1040 <close@plt>
mov    %eax,%ecx
mov    0x2ea9(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%ecx
jne    1166 <disconnect_socket+0x36>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xea6(%rip),%rdi
mov    %eax,%esi
call   1030 <fprint_err@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [30 x i8] c"### Error closing output: %s\0A\00"
@errno = global i32 0
define i32 @disconnect_socket(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @close(i32 %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %14
10: ; preds = %1
%11 = load i32, i32* @errno
%12 = call i32 @strerror(i32 %11)
%13 = call i32 @fprint_err(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %12)
store i32 1, i32* %2
br label %15
14: ; preds = %1
store i32 0, i32* %2
br label %15
15: ; preds = %14, %10
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [30 x i8] c"### Error closing output: %s\0A\00"
@errno = global i32 0
define i32 @disconnect_socket(i32 %0) {
%2 = tail call i32 @close(i32 %0)
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i32, i32* @errno
%7 = tail call i32 @strerror(i32 %6)
%8 = tail call i32 @fprint_err(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %1, %5
%10 = phi i32 [ 1, %5 ], [ 0, %1 ]
ret i32 %10
}
void RTDbgModLineAdd(void) {}


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

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

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

LLVM IR (-O2):
define void @RTDbgModLineAdd() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gen_call(char *);
int /*<<< orphan*/ gen_pop();
gen_sub() {
  gen_pop();
  gen_call("ccsub");
}


x86 assembly (clang, -O0):
<gen_sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <gen_pop@plt>
lea    0xeca(%rip),%rdi
call   1040 <gen_call@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_sub>:
push   %rax
xor    %eax,%eax
call   1030 <gen_pop@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1040 <gen_call@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"ccsub\00"
define i32 @gen_sub() {
%1 = tail call i32 (...) @gen_pop()
%2 = tail call i32 @gen_call(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Type definitions */
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ strftime(char *, int, char *, struct tm const *);
char *asctime_r(const struct tm *restrict tm, char *restrict buf) {
  strftime(buf, 26, "%a %b %d %H:%M:%S %Y\n", tm);
  return buf;
}


x86 assembly (clang, -O0):
<asctime_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1a,%esi
lea    0xecc(%rip),%rdx
call   1030 <strftime@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asctime_r>:
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rcx
lea    0xee2(%rip),%rdx
mov    %rsi,%rdi
mov    $0x1a,%esi
call   1030 <strftime@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [22 x i8] c"%a %b %d %H:%M:%S %Y\0A\00"
define i8* @asctime_r(%struct.tm* noalias %0, i8* noalias %1) {
%3 = alloca %struct.tm*
%4 = alloca i8*
store %struct.tm* %0, %struct.tm** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load %struct.tm*, %struct.tm** %3
%7 = call i32 @strftime(i8* %5, i32 26, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), %struct.tm* %6)
%8 = load i8*, i8** %4
ret i8* %8
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [22 x i8] c"%a %b %d %H:%M:%S %Y\0A\00"
define i8* @asctime_r(%struct.tm* noalias %0, i8* noalias returned %1) {
%3 = tail call i32 @strftime(i8* %1, i32 26, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), %struct.tm* %0)
ret i8* %1
}
int xisblank(int c) { return (c == (int)' ' || c == (int)'\t'); }


x86 assembly (clang, -O0):
<xisblank>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1120 <xisblank+0x20>
cmpl   $0x9,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xisblank>:
cmp    $0x20,%edi
sete   %al
cmp    $0x9,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @xisblank(i32 %0) {
%2 = icmp eq i32 %0, 32
%3 = icmp eq i32 %0, 9
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
extern __attribute__((__simd__("notinbranch"))) int simd_attr(void) {
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @simd_attr() {
ret i32 0
}
int char_convert(char value) {
  int int_value = (int)value - 64;
  if (int_value > 32) {
    int_value -= 32;
  }
  return int_value;
}


x86 assembly (clang, -O0):
<char_convert>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
sub    $0x40,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jle    1127 <char_convert+0x27>
mov    -0x8(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<char_convert>:
xor    %eax,%eax
cmp    $0x61,%dil
setl   %al
shl    $0x5,%eax
add    %edi,%eax
add    $0xffffffa0,%eax
ret

LLVM IR (-O0):
define i32 @char_convert(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = sub nsw i32 %5, 64
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp sgt i32 %7, 32
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 32
store i32 %11, i32* %3
br label %12
12: ; preds = %9, %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @char_convert(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = icmp sgt i8 %0, 96
%4 = select i1 %3, i32 -96, i32 -64
%5 = add nsw i32 %4, %2
ret i32 %5
}
regx0indreg1_set(r0, r1, x0, x1, p0, p1) float r0, r1;
float *p0, *p1;
{ (p0[x0]) = (*p1); }


x86 assembly (clang, -O0):
<regx0indreg1_set>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm1,-0x30(%rbp)
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm1,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x10(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<regx0indreg1_set>:
movss  (%rcx),%xmm0
movslq %edi,%rax
movss  %xmm0,(%rdx,%rax,4)
ret

LLVM IR (-O0):
define i32 @regx0indreg1_set(double %0, double %1, i32 %2, i32 %3, float* %4, float* %5) {
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca float*
%13 = alloca float*
%14 = fptrunc double %0 to float
%15 = fptrunc double %1 to float
store float %14, float* %8
store float %15, float* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store float* %4, float** %12
store float* %5, float** %13
%16 = load float*, float** %13
%17 = load float, float* %16
%18 = load float*, float** %12
%19 = load i32, i32* %10
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds float, float* %18, i64 %20
store float %17, float* %21
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
define i32 @regx0indreg1_set(double %0, double %1, i32 %2, i32 %3, float* nocapture writeonly %4, float* nocapture %5) {
%7 = load float, float* %5
%8 = sext i32 %2 to i64
%9 = getelementptr inbounds float, float* %4, i64 %8
store float %7, float* %9
ret i32 undef
}
/* Variables and functions */
size_t strlen(const char *s) {
  size_t len = 0;
  while (*(s++) != 0)
    ++len;
  return len;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
je     113c <strlen+0x3c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111f <strlen+0x1f>
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
lea    0x1(%rcx),%rax
cmpb   $0x0,0x1(%rdi,%rcx,1)
mov    %rax,%rcx
jne    1110 <strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add i64 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i64 [ 0, %1 ], [ %8, %4 ]
ret i64 %12
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, char, int);
char *makeStr(char x, int len) {
  char z[1000], *pt;
  pt = z;
  memset(pt, '\x00', 1000);
  memset(pt, x, len);
  pt = z;
  return pt;
}


x86 assembly (clang, -O0):
<makeStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x3f0(%rbp),%rax
mov    %rax,-0x3f8(%rbp)
mov    -0x3f8(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1030 <memset@plt>
mov    -0x3f8(%rbp),%rdi
mov    -0x1(%rbp),%al
mov    -0x8(%rbp),%edx
movsbl %al,%esi
call   1030 <memset@plt>
lea    -0x3f0(%rbp),%rax
mov    %rax,-0x3f8(%rbp)
mov    -0x3f8(%rbp),%rax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeStr>:
push   %rbp
push   %r14
push   %rbx
sub    $0x3f0,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1030 <memset@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <memset@plt>
mov    %r14,%rax
add    $0x3f0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @makeStr(i8 signext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
%5 = alloca [1000 x i8]
%6 = alloca i8*
store i8 %0, i8* %3
store i32 %1, i32* %4
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
store i8* %7, i8** %6
%8 = load i8*, i8** %6
%9 = call i32 @memset(i8* %8, i8 signext 0, i32 1000)
%10 = load i8*, i8** %6
%11 = load i8, i8* %3
%12 = load i32, i32* %4
%13 = call i32 @memset(i8* %10, i8 signext %11, i32 %12)
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
store i8* %14, i8** %6
%15 = load i8*, i8** %6
ret i8* %15
}

LLVM IR (-O2):
define i8* @makeStr(i8 signext %0, i32 %1) {
%3 = alloca [1000 x i8]
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i8 signext 0, i32 1000)
%6 = call i32 @memset(i8* %4, i8 signext %0, i32 %1)
ret i8* %4
}
void Hw32xDelay(int ticks) {
  unsigned long ct = (*(volatile unsigned long *)0x2000402C) + ticks;
  while ((*(volatile unsigned long *)0x2000402C) < ct)
    ;
}


x86 assembly (clang, -O0):
<Hw32xDelay>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x2000402c,%eax
mov    (%rax),%rax
movslq -0x4(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    $0x2000402c,%eax
mov    (%rax),%rax
cmp    -0x10(%rbp),%rax
jae    1131 <Hw32xDelay+0x31>
jmp    111a <Hw32xDelay+0x1a>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Hw32xDelay>:
movslq %edi,%rax
add    0x2000402c,%rax
20
nopl   0x0(%rax,%rax,1)
mov    0x2000402c,%rcx
20
cmp    %rax,%rcx
jb     1110 <Hw32xDelay+0x10>
ret

LLVM IR (-O0):
define void @Hw32xDelay(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
%4 = load volatile i64, i64* inttoptr (i64 536887340 to i64*)
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = add i64 %4, %6
store i64 %7, i64* %3
br label %8
8: ; preds = %12, %1
%9 = load volatile i64, i64* inttoptr (i64 536887340 to i64*)
%10 = load i64, i64* %3
%11 = icmp ult i64 %9, %10
br i1 %11, label %12, label %13
12: ; preds = %8
br label %8
13: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @Hw32xDelay(i32 %0) {
%2 = load volatile i64, i64* inttoptr (i64 536887340 to i64*)
%3 = sext i32 %0 to i64
%4 = add i64 %2, %3
br label %5
5: ; preds = %5, %1
%6 = load volatile i64, i64* inttoptr (i64 536887340 to i64*)
%7 = icmp ult i64 %6, %4
br i1 %7, label %5, label %8
8: ; preds = %5
ret void
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
scalar_t__ S_ISREG(int /*<<< orphan*/);
scalar_t__ stat(char const *, struct stat *);
bool isfile(const char *path) {
  struct stat st_buf;
  if (stat(path, &st_buf) < 0)
    return false;
  return S_ISREG(st_buf.st_mode) != 0;
}


x86 assembly (clang, -O0):
<isfile>:
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
jge    114f <isfile+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    1166 <isfile+0x46>
mov    -0x18(%rbp),%edi
call   1040 <S_ISREG@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isfile>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
test   %rax,%rax
js     1143 <isfile+0x23>
mov    (%rsp),%edi
call   1040 <S_ISREG@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @isfile(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 slt i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %15
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%11 = load i32, i32* %10
%12 = call i64 @S_ISREG(i32 %11)
%13 = icmp ne i64 %12, 0
%14 = zext i1 %13 to i32
store i32 %14, i32* %2
br label %15
15: ; preds = %9, %8
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @isfile(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp slt i64 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = call i64 @S_ISREG(i32 %8)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %1, %6
%13 = phi i32 [ %11, %6 ], [ 0, %1 ]
ret i32 %13
}
int fun1009() { return 1009; }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    $0x3f1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    $0x3f1,%eax
ret

LLVM IR (-O0):
define i32 @fun1009() {
ret i32 1009
}

LLVM IR (-O2):
define i32 @fun1009() {
ret i32 1009
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double, double, double);
main() {
  printf("\n%10.1f %10.1f %10.1f", 5.0, 13.5, 133.9);
  printf("\n%10.1f %10.1f %10.1f", 305.0, 1200.9, 3005.3);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xf15(%rip),%rdi
movsd  0xef5(%rip),%xmm0
movsd  0xef5(%rip),%xmm1
movsd  0xef5(%rip),%xmm2
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
movsd  0xeb9(%rip),%xmm0
movsd  0xeb9(%rip),%xmm1
movsd  0xeb9(%rip),%xmm2
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf18(%rip),%rbx
movsd  0xee0(%rip),%xmm0
movsd  0xee0(%rip),%xmm1
movsd  0xee0(%rip),%xmm2
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xed8(%rip),%xmm0
movsd  0xed8(%rip),%xmm1
movsd  0xed8(%rip),%xmm2
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"\0A%10.1f %10.1f %10.1f\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double 5.000000e+00, double 1.350000e+01, double 1.339000e+02)
%2 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double 3.050000e+02, double 1.200900e+03, double 3.005300e+03)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"\0A%10.1f %10.1f %10.1f\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double 5.000000e+00, double 1.350000e+01, double 1.339000e+02)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double 3.050000e+02, double 1.200900e+03, double 3.005300e+03)
ret i32 0
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
scalar_t__ S_ISDIR(int /*<<< orphan*/);
int stat(char *, struct stat *);
int isadir(char *f) {
  struct stat info;
  return (stat(f, &info) != -1 && S_ISDIR(info.st_mode));
}


x86 assembly (clang, -O0):
<isadir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <stat@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
mov    %al,-0x11(%rbp)
je     115b <isadir+0x3b>
mov    -0x10(%rbp),%edi
call   1030 <S_ISDIR@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isadir>:
push   %rax
mov    %rsp,%rsi
call   1040 <stat@plt>
cmp    $0xffffffff,%eax
je     1143 <isadir+0x23>
mov    (%rsp),%edi
call   1030 <S_ISDIR@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @isadir(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %12, label %6
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = tail call i64 @S_ISDIR(i32 %8)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %6, %1
%13 = phi i32 [ 0, %1 ], [ %11, %6 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ ReloadPosition(int);
void LoadNextPositionProc() { ReloadPosition(1); }


x86 assembly (clang, -O0):
<LoadNextPositionProc>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <ReloadPosition@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<LoadNextPositionProc>:
mov    $0x1,%edi
jmp    1030 <ReloadPosition@plt>

LLVM IR (-O0):
define void @LoadNextPositionProc() {
%1 = call i32 @ReloadPosition(i32 1)
ret void
}

LLVM IR (-O2):
define void @LoadNextPositionProc() {
%1 = tail call i32 @ReloadPosition(i32 1)
ret void
}
long f1(long a) { return a & 0xff000000L; }


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movabs $0xff000000,%rax
and    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
mov    %rdi,%rax
and    $0xff000000,%eax
ret

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

LLVM IR (-O2):
define i64 @f1(i64 %0) {
%2 = and i64 %0, 4278190080
ret i64 %2
}
int main() {
  char *ptr;
  int i;
  for (i = 0; i < 3000; i++) {
    ptr = sbrk(1);
    if (ptr == (void *)-1) {
      printf("sbrk() failed!\n");
      return 0;
    }
    *ptr = 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xbb8,-0x14(%rbp)
jge    1195 <main+0x75>
mov    $0x1,%edi
mov    $0x0,%al
call   1040 <sbrk@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    $0xffffffffffffffff,%rax
cmp    %rax,-0x10(%rbp)
jne    1180 <main+0x60>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    119c <main+0x7c>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1136 <main+0x16>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xbb8,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x1,%edi
xor    %eax,%eax
call   1040 <sbrk@plt>
cltq
cmp    $0xffffffffffffffff,%rax
je     114e <main+0x2e>
movb   $0x0,(%rax)
add    $0xffffffff,%ebx
jne    1130 <main+0x10>
jmp    115a <main+0x3a>
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"sbrk() failed!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %17, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 3000
br i1 %6, label %7, label %20
7: ; preds = %4
%8 = call i32 (i32, ...) bitcast (i32 (...)* @sbrk to i32 (i32, ...)*)(i32 1)
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %2
%11 = load i8*, i8** %2
%12 = icmp eq i8* %11, inttoptr (i64 -1 to i8*)
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %21
15: ; preds = %7
%16 = load i8*, i8** %2
store i8 0, i8* %16
br label %17
17: ; preds = %15
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %4
20: ; preds = %4
store i32 0, i32* %1
br label %21
21: ; preds = %20, %13
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@str = [15 x i8] c"sbrk() failed!\00"
define i32 @main() {
br label %1
1: ; preds = %0, %9
%2 = phi i32 [ 0, %0 ], [ %10, %9 ]
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @sbrk to i32 (i32, ...)*)(i32 1)
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i8* %5, inttoptr (i64 -1 to i8*)
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
br label %12
9: ; preds = %1
store i8 0, i8* %5
%10 = add nuw nsw i32 %2, 1
%11 = icmp eq i32 %10, 3000
br i1 %11, label %12, label %1
12: ; preds = %9, %7
ret i32 0
}
void finn_vec2_create(float *result, float x, float y) {
  result[0] = x;
  result[1] = y;
}


x86 assembly (clang, -O0):
<finn_vec2_create>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<finn_vec2_create>:
movss  %xmm0,(%rdi)
movss  %xmm1,0x4(%rdi)
ret

LLVM IR (-O0):
define void @finn_vec2_create(float* %0, float %1, float %2) {
%4 = alloca float*
%5 = alloca float
%6 = alloca float
store float* %0, float** %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %5
%8 = load float*, float** %4
%9 = getelementptr inbounds float, float* %8, i64 0
store float %7, float* %9
%10 = load float, float* %6
%11 = load float*, float** %4
%12 = getelementptr inbounds float, float* %11, i64 1
store float %10, float* %12
ret void
}

LLVM IR (-O2):
define void @finn_vec2_create(float* nocapture writeonly %0, float %1, float %2) {
store float %1, float* %0
%4 = getelementptr inbounds float, float* %0, i64 1
store float %2, float* %4
ret void
}
int valueAt(int myArray[], int index) { return myArray[index]; }


x86 assembly (clang, -O0):
<valueAt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<valueAt>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @valueAt(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %5, i64 %7
%9 = load i32, i32* %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @valueAt(i32* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr, "Usage:  jfs_format <volumename>\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"Usage: jfs_format <volumename>\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"Usage: jfs_format <volumename>\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
int isBorder(int i, int j) {
  if (i == 0 || j == 0 || i == 1000 || j == 1000)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isBorder>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1138 <isBorder+0x38>
cmpl   $0x0,-0xc(%rbp)
je     1138 <isBorder+0x38>
cmpl   $0x3e8,-0x8(%rbp)
je     1138 <isBorder+0x38>
cmpl   $0x3e8,-0xc(%rbp)
jne    1144 <isBorder+0x44>
movl   $0x1,-0x4(%rbp)
jmp    114b <isBorder+0x4b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isBorder>:
test   %edi,%edi
sete   %al
test   %esi,%esi
sete   %cl
or     %al,%cl
cmp    $0x3e8,%edi
sete   %al
cmp    $0x3e8,%esi
sete   %dl
or     %al,%dl
or     %cl,%dl
movzbl %dl,%eax
ret

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

LLVM IR (-O2):
define i32 @isBorder(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
%4 = icmp eq i32 %1, 0
%5 = or i1 %3, %4
%6 = icmp eq i32 %0, 1000
%7 = or i1 %6, %5
%8 = icmp eq i32 %1, 1000
%9 = or i1 %8, %7
%10 = zext i1 %9 to i32
ret i32 %10
}
int hts_bin_bot(int bin, int n_lvls) {
  int l, b;
  for (l = 0, b = bin; b; ++l, b = (((b)-1) >> 3))
    ;
  return (bin - (((1 << (((l) << 1) + (l))) - 1) / 7)) << (n_lvls - l) * 3;
}


x86 assembly (clang, -O0):
<hts_bin_bot>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1140 <hts_bin_bot+0x40>
jmp    1126 <hts_bin_bot+0x26>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
sar    $0x3,%eax
mov    %eax,-0x10(%rbp)
jmp    1117 <hts_bin_bot+0x17>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
add    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
sub    %ecx,%eax
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
imul   $0x3,%ecx,%ecx
shl    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hts_bin_bot>:
xor    %edx,%edx
test   %edi,%edi
je     1122 <hts_bin_bot+0x22>
mov    %edi,%eax
nopl   0x0(%rax,%rax,1)
add    $0x1,%edx
add    $0xffffffff,%eax
mov    %eax,%ecx
sar    $0x3,%ecx
cmp    $0x7,%eax
mov    %ecx,%eax
ja     1110 <hts_bin_bot+0x10>
lea    (%rdx,%rdx,2),%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
not    %eax
movslq %eax,%rcx
imul   $0x6db6db6d,%rcx,%rax
shr    $0x20,%rax
sub    %ecx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x2,%eax
add    %ecx,%eax
add    %edi,%eax
sub    %edx,%esi
lea    (%rsi,%rsi,2),%ecx
shl    %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @hts_bin_bot(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %11, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %9, %4 ], [ %0, %2 ]
%6 = phi i32 [ %7, %4 ], [ 0, %2 ]
%7 = add nuw nsw i32 %6, 1
%8 = add nsw i32 %5, -1
%9 = ashr i32 %8, 3
%10 = icmp ult i32 %8, 8
br i1 %10, label %11, label %4
11: ; preds = %4, %2
%12 = phi i32 [ 0, %2 ], [ %7, %4 ]
%13 = mul i32 %12, 3
%14 = shl nsw i32 -1, %13
%15 = xor i32 %14, -1
%16 = sdiv i32 %15, -7
%17 = add i32 %16, %0
%18 = sub nsw i32 %1, %12
%19 = mul nsw i32 %18, 3
%20 = shl i32 %17, %19
ret i32 %20
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int clear_quaddobl_tracker(void) {
  int fail, *a, *b;
  double *c;
  fail = _ada_use_c2phc(511, a, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<clear_quaddobl_tracker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x1ff,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_quaddobl_tracker>:
mov    $0x1ff,%edi
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @clear_quaddobl_tracker() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca double*
%5 = load i32*, i32** %2
%6 = load i32*, i32** %3
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc(i32 511, i32* %5, i32* %6, double* %7)
store i32 %8, i32* %1
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
define i32 @clear_quaddobl_tracker() {
%1 = tail call i32 @_ada_use_c2phc(i32 511, i32* undef, i32* undef, double* undef)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ ispunct(int);
void t_ispunct_0xed() {
  Assert_real((ispunct(237) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_ispunct.c",
              1190, ("ispunct should be 0 for 0xed"));
}


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

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

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

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_ispunct.c\00"
@.str.1 = [29 x i8] c"ispunct should be 0 for 0xed\00"
define void @t_ispunct_0xed() {
%1 = tail call i64 @ispunct(i32 237)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1190, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int main(int argc, char **argv) {
  if (argc == 1) {
    return 10;
  }
  if (argc == 2) {
    return 10;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1128 <main+0x28>
movl   $0xa,-0x4(%rbp)
jmp    1145 <main+0x45>
cmpl   $0x2,-0x8(%rbp)
jne    113e <main+0x3e>
movl   $0xa,-0x4(%rbp)
jmp    1145 <main+0x45>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
add    $0xffffffff,%edi
xor    %ecx,%ecx
cmp    $0x2,%edi
mov    $0xa,%eax
cmovae %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = add i32 %0, -1
%4 = icmp ult i32 %3, 2
%5 = select i1 %4, i32 10, i32 0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void quote_calc4_error(const char *s) { fprintf(stderr, "%s\n", s); }


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

x86 assembly (clang, -O2):
<quote_calc4_error>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @quote_calc4_error(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 ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @quote_calc4_error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ uxmi_color_fg(int);
void uxmi_sysinit_testrc(int rc) {
  if (rc) {
    uxmi_color_fg(12);
    printf("\t\t\t FAILED \n");
  } else {
    uxmi_color_fg(10);
    printf("\t\t\t OK \n");
  }
  return;
}


x86 assembly (clang, -O0):
<uxmi_sysinit_testrc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1150 <uxmi_sysinit_testrc+0x30>
mov    $0xc,%edi
call   1040 <uxmi_color_fg@plt>
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
jmp    1166 <uxmi_sysinit_testrc+0x46>
mov    $0xa,%edi
call   1040 <uxmi_color_fg@plt>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uxmi_sysinit_testrc>:
push   %rbx
xor    %eax,%eax
test   %edi,%edi
setne  %al
lea    0xa(%rax,%rax,1),%edi
lea    0xecd(%rip),%rax
lea    0xece(%rip),%rbx
cmove  %rax,%rbx
call   1040 <uxmi_color_fg@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [8 x i8] c"\09\09\09 OK \00"
@str.2 = [12 x i8] c"\09\09\09 FAILED \00"
define void @uxmi_sysinit_testrc(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i32 10, i32 12
%4 = select i1 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.2, i64 0, i64 0)
%5 = tail call i32 @uxmi_color_fg(i32 %3)
%6 = tail call i32 @puts(i8* dereferenceable(1) %4)
ret void
}