xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ __mmask8;
typedef int /*<<< orphan*/ __m128d;

/* Variables and functions */
int /*<<< orphan*/ _mm_mask_fpclass_sd_mask(int /*<<< orphan*/,
                                            int /*<<< orphan*/, int);
__mmask8 test_mm_mask_fpclass_sd_mask(__mmask8 __U, __m128d __A) {
  return _mm_mask_fpclass_sd_mask(__U, __A, 2);
}


x86 assembly (clang, -O0):
<test_mm_mask_fpclass_sd_mask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x2,%edx
call   1030 <_mm_mask_fpclass_sd_mask@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_mm_mask_fpclass_sd_mask>:
mov    $0x2,%edx
jmp    1030 <_mm_mask_fpclass_sd_mask@plt>

LLVM IR (-O0):
define i32 @test_mm_mask_fpclass_sd_mask(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 = call i32 @_mm_mask_fpclass_sd_mask(i32 %5, i32 %6, i32 2)
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_mm_mask_fpclass_sd_mask(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_mask_fpclass_sd_mask(i32 %0, i32 %1, i32 2)
ret i32 %3
}
/* Variables and functions */
int chdir(char const *);
int /*<<< orphan*/ err(int, char *, char const *);
char *name_get(unsigned int);
int /*<<< orphan*/ printf(char *, char const *);
void do_chdir(unsigned name) {
  const char *namestr;
  namestr = name_get(name);
  if (chdir(namestr) == -1) {
    err(1, "chdir: %s", namestr);
  }
  printf("chdir %s\n", namestr);
}


x86 assembly (clang, -O0):
<do_chdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <name_get@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <chdir@plt>
cmp    $0xffffffff,%eax
jne    117e <do_chdir+0x3e>
mov    -0x10(%rbp),%rdx
mov    $0x1,%edi
lea    0xe87(%rip),%rsi
call   1050 <err@plt>
mov    -0x10(%rbp),%rsi
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_chdir>:
push   %rbx
call   1060 <name_get@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <chdir@plt>
cmp    $0xffffffff,%eax
jne    116a <do_chdir+0x2a>
lea    0xea3(%rip),%rsi
mov    $0x1,%edi
mov    %rbx,%rdx
call   1050 <err@plt>
lea    0xe99(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str = [10 x i8] c"chdir: %s\00"
@.str.1 = [10 x i8] c"chdir %s\0A\00"
define void @do_chdir(i32 %0) {
%2 = tail call i8* @name_get(i32 %0)
%3 = tail call i32 @chdir(i8* %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %7
7: ; preds = %5, %1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret void
}
/* Variables and functions */
float fmin(float a, float b) { return (a < b ? a : b); }


x86 assembly (clang, -O0):
<fmin>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1130 <fmin+0x30>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    113a <fmin+0x3a>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmin>:
minss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @fmin(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp olt float %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load float, float* %3
br label %12
10: ; preds = %2
%11 = load float, float* %4
br label %12
12: ; preds = %10, %8
%13 = phi float [ %9, %8 ], [ %11, %10 ]
ret float %13
}

LLVM IR (-O2):
define float @fmin(float %0, float %1) {
%3 = fcmp olt float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}
/* Variables and functions */
float frand();
float rand_float(float min, float max) { return frand() * (max - min) + min; }


x86 assembly (clang, -O0):
<rand_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    $0x0,%al
call   1030 <frand@plt>
movss  -0x8(%rbp),%xmm2
subss  -0x4(%rbp),%xmm2
movss  -0x4(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_float>:
push   %rax
movss  %xmm1,0x4(%rsp)
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <frand@plt>
movss  (%rsp),%xmm1
movss  0x4(%rsp),%xmm2
subss  %xmm1,%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @rand_float(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = call float (...) @frand()
%6 = load float, float* %4
%7 = load float, float* %3
%8 = fsub float %6, %7
%9 = load float, float* %3
%10 = call float @llvm.fmuladd.f32(float %5, float %8, float %9)
ret float %10
}

LLVM IR (-O2):
define float @rand_float(float %0, float %1) {
%3 = tail call float (...) @frand()
%4 = fsub float %1, %0
%5 = tail call float @llvm.fmuladd.f32(float %3, float %4, float %0)
ret float %5
}
int strncmp(const char *cs, const char *ct, int count) {
  register int __res;
  __asm__("cld\n"
          "1:\tdecl %3\n\t"
          "js 2f\n\t"
          "lodsb\n\t"
          "scasb\n\t"
          "jne 3f\n\t"
          "testb %%al,%%al\n\t"
          "jne 1b\n"
          "2:\txorl %%eax,%%eax\n\t"
          "jmp 4f\n"
          "3:\tmovl $1,%%eax\n\t"
          "jl 4f\n\t"
          "negl %%eax\n"
          "4:"
          : "=a"(__res)
          : "D"(cs), "S"(ct), "c"(count));
  return __res;
}


x86 assembly (clang, -O0):
<strncmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%ecx
cld
dec    %ecx
js     1133 <strncmp+0x33>
lods   %ds:(%rsi),%al
scas   %es:(%rdi),%al
jne    113a <strncmp+0x3a>
test   %al,%al
jne    111b <strncmp+0x1b>
xor    %eax,%eax
jmp    1147 <strncmp+0x47>
mov    $0x1,%eax
jl     1147 <strncmp+0x47>
neg    %eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncmp>:
mov    %edx,%ecx
cld
dec    %ecx
js     110f <strncmp+0xf>
lods   %ds:(%rsi),%al
scas   %es:(%rdi),%al
jne    1113 <strncmp+0x13>
test   %al,%al
jne    1103 <strncmp+0x3>
xor    %eax,%eax
jmp    111c <strncmp+0x1c>
mov    $0x1,%eax
jl     111c <strncmp+0x1c>
neg    %eax
ret

LLVM IR (-O0):
define i32 @strncmp(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 asm "cld\0A1:\09decl $3\0A\09js 2f\0A\09lodsb\0A\09scasb\0A\09jne 3f\0A\09testb %al,%al\0A\09jne 1b\0A2:\09xorl %eax,%eax\0A\09jmp 4f\0A3:\09movl $$1,%eax\0A\09jl 4f\0A\09negl %eax\0A4:", "={ax},{di},{si},{cx},~{dirflag},~{fpsr},~{flags}"(i8* %8, i8* %9, i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
ret i32 %12
}

LLVM IR (-O2):
define i32 @strncmp(i8* readnone %0, i8* readnone %1, i32 %2) {
%4 = tail call i32 asm "cld\0A1:\09decl $3\0A\09js 2f\0A\09lodsb\0A\09scasb\0A\09jne 3f\0A\09testb %al,%al\0A\09jne 1b\0A2:\09xorl %eax,%eax\0A\09jmp 4f\0A3:\09movl $$1,%eax\0A\09jl 4f\0A\09negl %eax\0A4:", "={ax},{di},{si},{cx},~{dirflag},~{fpsr},~{flags}"(i8* %0, i8* %1, i32 %2)
ret i32 %4
}
unsigned long long bswap64(unsigned long long x) {
  asm("bswapl %%eax; bswapl %%edx; xchg %%eax, %%edx" : "=A"(x) : "0"(x));
  return x;
}


x86 assembly (clang, -O0):
<bswap64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
bswap  %eax
bswap  %edx
xchg   %eax,%edx
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bswap64>:
mov    %rdi,%rax
bswap  %eax
bswap  %edx
xchg   %eax,%edx
ret

LLVM IR (-O0):
define i64 @bswap64(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 asm "bswapl %eax; bswapl %edx; xchg %eax, %edx", "=A,0,~{dirflag},~{fpsr},~{flags}"(i64 %3)
store i64 %4, i64* %2
%5 = load i64, i64* %2
ret i64 %5
}

LLVM IR (-O2):
define i64 @bswap64(i64 %0) {
%2 = tail call i64 asm "bswapl %eax; bswapl %edx; xchg %eax, %edx", "=A,0,~{dirflag},~{fpsr},~{flags}"(i64 %0)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ addbyte(int);
void MMX_XOR(int dst_reg, int src_reg) {
  addbyte(0x66);
  addbyte(0x0f);
  addbyte(0xef);
  addbyte(0xc0 | (dst_reg << 3) | src_reg);
}


x86 assembly (clang, -O0):
<MMX_XOR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0xef,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
shl    $0x3,%edi
or     $0xc0,%edi
or     -0x8(%rbp),%edi
call   1030 <addbyte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MMX_XOR>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0xef,%edi
call   1030 <addbyte@plt>
shl    $0x3,%ebp
or     %ebx,%ebp
or     $0xc0,%ebp
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <addbyte@plt>

LLVM IR (-O0):
define void @MMX_XOR(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @addbyte(i32 102)
%6 = call i32 @addbyte(i32 15)
%7 = call i32 @addbyte(i32 239)
%8 = load i32, i32* %3
%9 = shl i32 %8, 3
%10 = or i32 192, %9
%11 = load i32, i32* %4
%12 = or i32 %10, %11
%13 = call i32 @addbyte(i32 %12)
ret void
}

LLVM IR (-O2):
define void @MMX_XOR(i32 %0, i32 %1) {
%3 = tail call i32 @addbyte(i32 102)
%4 = tail call i32 @addbyte(i32 15)
%5 = tail call i32 @addbyte(i32 239)
%6 = shl i32 %0, 3
%7 = or i32 %6, %1
%8 = or i32 %7, 192
%9 = tail call i32 @addbyte(i32 %8)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void pes_init(uint8_t *p_pes) {
  p_pes[0] = 0x0;
  p_pes[1] = 0x0;
  p_pes[2] = 0x1;
  p_pes[6] = 0x80;
  p_pes[7] = 0x0;
  p_pes[8] = 0x0;
}


x86 assembly (clang, -O0):
<pes_init>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0x4(%rax)
mov    -0x8(%rbp),%rax
movl   $0x1,0x8(%rax)
mov    -0x8(%rbp),%rax
movl   $0x80,0x18(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0x1c(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0x20(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<pes_init>:
movq   $0x0,(%rdi)
movl   $0x1,0x8(%rdi)
movq   $0x80,0x18(%rdi)
movl   $0x0,0x20(%rdi)
ret

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

LLVM IR (-O2):
define void @pes_init(i32* nocapture writeonly %0) {
store i32 0, i32* %0
%2 = getelementptr inbounds i32, i32* %0, i64 1
store i32 0, i32* %2
%3 = getelementptr inbounds i32, i32* %0, i64 2
store i32 1, i32* %3
%4 = getelementptr inbounds i32, i32* %0, i64 6
store i32 128, i32* %4
%5 = getelementptr inbounds i32, i32* %0, i64 7
store i32 0, i32* %5
%6 = getelementptr inbounds i32, i32* %0, i64 8
store i32 0, i32* %6
ret void
}
int test_imm_BFuint8_reg(unsigned char val) {
  return ((val) & (0xBF << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_BFuint8_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, 191
%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_BFuint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -65
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void help08(void) {
  printf("  p                 show PSW\n");
  printf("  p  <data>         set PSW to <data>\n");
}


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

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

LLVM IR (-O0):
@.str = [30 x i8] c" p show PSW\0A\00"
@.str.1 = [39 x i8] c" p <data> set PSW to <data>\0A\00"
define void @help08() {
%1 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [29 x i8] c" p show PSW\00"
@str.2 = [38 x i8] c" p <data> set PSW to <data>\00"
define void @help08() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Type definitions */
struct ascii85 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _ascii85_write_toneline(struct ascii85 *, char const *,
                                           size_t, size_t);
void ascii85_write_toneline(void *ctx, const char *buf, size_t ss,
                            size_t count) {
  _ascii85_write_toneline((struct ascii85 *)ctx, buf, ss, count);
}


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

x86 assembly (clang, -O2):
<ascii85_write_toneline>:
jmp    1030 <_ascii85_write_toneline@plt>

LLVM IR (-O0):
%struct.ascii85 = type { i32 }
define void @ascii85_write_toneline(i8* %0, i8* %1, i64 %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = load i8*, i8** %5
%10 = bitcast i8* %9 to %struct.ascii85*
%11 = load i8*, i8** %6
%12 = load i64, i64* %7
%13 = load i64, i64* %8
%14 = call i32 @_ascii85_write_toneline(%struct.ascii85* %10, i8* %11, i64 %12, i64 %13)
ret void
}

LLVM IR (-O2):
%struct.ascii85 = type { i32 }
define void @ascii85_write_toneline(i8* %0, i8* %1, i64 %2, i64 %3) {
%5 = bitcast i8* %0 to %struct.ascii85*
%6 = tail call i32 @_ascii85_write_toneline(%struct.ascii85* %5, i8* %1, i64 %2, i64 %3)
ret void
}
main(void) {
  char *cp = "\"å­\"";
  char *ecp1 = "\"À¯\"";
  char *ecp2 = "\"à¿\"";
  char *ecp3 = "\"í \"";
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
lea    0xeee(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xeec(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xee8(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xee6(%rip),%rax
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [9 x i8] c"\22\C3\A5\C2\AD\C2\97\22\00"
@.str.1 = [7 x i8] c"\22\C3\80\C2\AF\22\00"
@.str.2 = [9 x i8] c"\22\C3\A0\C2\9F\C2\BF\22\00"
@.str.3 = [9 x i8] c"\22\C3\AD\C2\A0\C2\80\22\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8** %4
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8** %5
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ iscntrl(int);
void t_iscntrl_0xb9() {
  Assert_real((iscntrl(185) == 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_iscntrl.c",
              930, ("iscntrl should be 0 for 0xb9"));
}


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

x86 assembly (clang, -O2):
<t_iscntrl_0xb9>:
push   %rax
mov    $0xb9,%edi
call   1030 <iscntrl@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x3a2,%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_iscntrl.c\00"
@.str.1 = [29 x i8] c"iscntrl should be 0 for 0xb9\00"
define void @t_iscntrl_0xb9() {
%1 = call i64 @iscntrl(i32 185)
%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 930, 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_iscntrl.c\00"
@.str.1 = [29 x i8] c"iscntrl should be 0 for 0xb9\00"
define void @t_iscntrl_0xb9() {
%1 = tail call i64 @iscntrl(i32 185)
%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 930, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int __le16;

/* Variables and functions */
int __cpu_to_le16(int);
int ieee80211_has_fromds(__le16 fc) {
  return (fc & __cpu_to_le16(0x0200)) != 0;
}


x86 assembly (clang, -O0):
<ieee80211_has_fromds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x200,%edi
call   1030 <__cpu_to_le16@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ieee80211_has_fromds>:
push   %rbx
mov    %edi,%ebx
mov    $0x200,%edi
call   1030 <__cpu_to_le16@plt>
xor    %ecx,%ecx
test   %ebx,%eax
setne  %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ieee80211_has_fromds(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @__cpu_to_le16(i32 512)
%5 = and i32 %3, %4
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @ieee80211_has_fromds(i32 %0) {
%2 = tail call i32 @__cpu_to_le16(i32 512)
%3 = and i32 %2, %0
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
int clamp(int x) {
  if (x < 0)
    x = 0;
  if (x > 255)
    x = 255;
  return x;
}


x86 assembly (clang, -O0):
<clamp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1118 <clamp+0x18>
movl   $0x0,-0x4(%rbp)
cmpl   $0xff,-0x4(%rbp)
jle    112c <clamp+0x2c>
movl   $0xff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp>:
xor    %ecx,%ecx
test   %edi,%edi
cmovns %edi,%ecx
cmp    $0xff,%ecx
mov    $0xff,%eax
cmovb  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @clamp(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = select i1 %2, i32 %0, i32 0
%4 = icmp ult i32 %3, 255
%5 = select i1 %4, i32 %3, i32 255
ret i32 %5
}
void ar2315_irq_init(void) {}


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

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

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

LLVM IR (-O2):
define void @ar2315_irq_init() {
ret void
}
unsigned index_offset(void *context, unsigned idx) {
  return idx + *((unsigned *)context);
}


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

x86 assembly (clang, -O2):
<index_offset>:
mov    %esi,%eax
add    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @index_offset(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
%8 = load i32, i32* %7
%9 = add i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @index_offset(i8* nocapture %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = add i32 %4, %1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ execlp(char *, char *, void *);
int fork();
int /*<<< orphan*/ wait(int *);
int clear() {
  int pid = fork();
  if (pid == 0) {
    execlp("clear", "clear", (void *)NULL);
  } else if (pid == -1) {
    return 1;
  } else {
    int status;
    wait(&status);
  }
  return 0;
}


x86 assembly (clang, -O0):
<clear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <fork@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1164 <clear+0x34>
lea    0xead(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    %rsi,%rdi
call   1030 <execlp@plt>
jmp    1188 <clear+0x58>
cmpl   $0xffffffff,-0x8(%rbp)
jne    117a <clear+0x4a>
movl   $0x1,-0x4(%rbp)
jmp    118f <clear+0x5f>
lea    -0xc(%rbp),%rdi
call   1040 <wait@plt>
jmp    1188 <clear+0x58>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1050 <fork@plt>
cmp    $0xffffffff,%eax
je     115a <clear+0x2a>
test   %eax,%eax
jne    1161 <clear+0x31>
lea    0xeb4(%rip),%rdi
xor    %ebx,%ebx
mov    %rdi,%rsi
xor    %edx,%edx
call   1030 <execlp@plt>
jmp    116d <clear+0x3d>
mov    $0x1,%ebx
jmp    116d <clear+0x3d>
lea    0xc(%rsp),%rdi
call   1040 <wait@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
define i32 @clear() {
%1 = alloca i32
%2 = tail call i32 (...) @fork()
switch i32 %2, label %5 [
i32 0, label %3
i32 -1, label %8
]
3: ; preds = %0
%4 = tail call i32 @execlp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* null)
br label %8
5: ; preds = %0
%6 = bitcast i32* %1 to i8*
%7 = call i32 @wait(i32* %1)
br label %8
8: ; preds = %3, %5, %0
%9 = phi i32 [ 1, %0 ], [ 0, %5 ], [ 0, %3 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ arch_loadarg(int, int);
void emit_loadarg(int arg, int reg) { arch_loadarg(arg, reg); }


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

x86 assembly (clang, -O2):
<emit_loadarg>:
jmp    1030 <arch_loadarg@plt>

LLVM IR (-O0):
define void @emit_loadarg(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 = call i32 @arch_loadarg(i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @emit_loadarg(i32 %0, i32 %1) {
%3 = tail call i32 @arch_loadarg(i32 %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fail(char *, char const *, int, char const *);
void atf_sanity_inv(const char *file, int line, const char *cond) {
  fail("Invariant check failed at %s:%d: %s", file, line, cond);
}


x86 assembly (clang, -O0):
<atf_sanity_inv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xecb(%rip),%rdi
call   1030 <fail@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atf_sanity_inv>:
mov    %rdx,%rcx
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee1(%rip),%rdi
jmp    1030 <fail@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"Invariant check failed at %s:%d: %s\00"
define void @atf_sanity_inv(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i8*, i8** %6
%10 = call i32 @fail(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %8, i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"Invariant check failed at %s:%d: %s\00"
define void @atf_sanity_inv(i8* %0, i32 %1, i8* %2) {
%4 = tail call i32 @fail(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int syscall(int, int /*<<< orphan*/, int /*<<< orphan*/);
int kswitch() {
  printf("Entering kernal to switch procs...\n");
  return syscall(4, 0, 0);
}


x86 assembly (clang, -O0):
<kswitch>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x4,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1040 <syscall@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kswitch>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x4,%edi
xor    %esi,%esi
xor    %edx,%edx
pop    %rax
jmp    1040 <syscall@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"Entering kernal to switch procs...\0A\00"
define i32 @kswitch() {
%1 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @syscall(i32 4, i32 0, i32 0)
ret i32 %2
}

LLVM IR (-O2):
@str = [35 x i8] c"Entering kernal to switch procs...\00"
define i32 @kswitch() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @syscall(i32 4, i32 0, i32 0)
ret i32 %2
}
double get_balanced_accuracy(double FPR, double TPR, long P, long N) {
  return (1 - FPR + TPR) / 2;
}


x86 assembly (clang, -O0):
<get_balanced_accuracy>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  0xeea(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  0xed0(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_balanced_accuracy>:
movsd  0xef8(%rip),%xmm2
subsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
mulsd  0xef0(%rip),%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @get_balanced_accuracy(double %0, double %1, i64 %2, i64 %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca i64
%8 = alloca i64
store double %0, double* %5
store double %1, double* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = load double, double* %5
%10 = fsub double 1.000000e+00, %9
%11 = load double, double* %6
%12 = fadd double %10, %11
%13 = fdiv double %12, 2.000000e+00
ret double %13
}

LLVM IR (-O2):
define double @get_balanced_accuracy(double %0, double %1, i64 %2, i64 %3) {
%5 = fsub double 1.000000e+00, %0
%6 = fadd double %5, %1
%7 = fmul double %6, 5.000000e-01
ret double %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long);
extern void fourth(unsigned long arg) { printf("fourth: 0x%x\n", arg); }


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

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

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

LLVM IR (-O2):
@.str = [14 x i8] c"fourth: 0x%x\0A\00"
define void @fourth(i64 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %0)
ret void
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int dobldobl_sample_to_new_slices(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(635, a, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<dobldobl_sample_to_new_slices>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x27b,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dobldobl_sample_to_new_slices>:
mov    $0x27b,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc4c@plt>

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

LLVM IR (-O2):
define i32 @dobldobl_sample_to_new_slices() {
%1 = tail call i32 @_ada_use_c2phc4c(i32 635, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ O_WRONLY;
int /*<<< orphan*/ close(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ write(int, int /*<<< orphan*/ *, int);
int main(int argc, char **argv) {
  int f = open(argv[1], O_WRONLY);
  int32_t pos = 0;
  write(f, &pos, sizeof(int32_t));
  close(f);
  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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e83(%rip),%rax
mov    (%rax),%esi
call   1050 <open@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    -0x14(%rbp),%edi
call   1040 <close@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    0x8(%rsi),%rdi
mov    0x2e98(%rip),%rax
mov    (%rax),%esi
call   1050 <open@plt>
mov    %eax,%ebx
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    %eax,%edi
mov    $0x4,%edx
call   1030 <write@plt>
mov    %ebx,%edi
call   1040 <close@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@O_WRONLY = 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
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = load i32, i32* @O_WRONLY
%12 = call i32 @open(i8* %10, i32 %11)
store i32 %12, i32* %6
store i32 0, i32* %7
%13 = load i32, i32* %6
%14 = call i32 @write(i32 %13, i32* %7, i32 4)
%15 = load i32, i32* %6
%16 = call i32 @close(i32 %15)
ret i32 0
}

LLVM IR (-O2):
@O_WRONLY = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = load i32, i32* @O_WRONLY
%7 = tail call i32 @open(i8* %5, i32 %6)
%8 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%9 = call i32 @write(i32 %7, i32* %3, i32 4)
%10 = tail call i32 @close(i32 %7)
ret i32 0
}
/* Variables and functions */
scalar_t__ sarprintf_std_ret(char *);
int sarwaitbar_std_close(void) {
  return sarprintf_std_ret(
             "|==================================================| 100%%\n") <
         0;
}


x86 assembly (clang, -O0):
<sarwaitbar_std_close>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <sarprintf_std_ret@plt>
cmp    $0x0,%rax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sarwaitbar_std_close>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <sarprintf_std_ret@plt>
shr    $0x3f,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [60 x i8] c"|==================================================| 100%%\0A\00"
define i32 @sarwaitbar_std_close() {
%1 = call i64 @sarprintf_std_ret(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%2 = icmp slt i64 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}

LLVM IR (-O2):
@.str = [60 x i8] c"|==================================================| 100%%\0A\00"
define i32 @sarwaitbar_std_close() {
%1 = tail call i64 @sarprintf_std_ret(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%2 = lshr i64 %1, 63
%3 = trunc i64 %2 to i32
ret i32 %3
}
int compareDouble(void *p1, void *p2) {
  double *n1 = (double *)p1;
  double *n2 = (double *)p2;
  return (*n1 - *n2);
}


x86 assembly (clang, -O0):
<compareDouble>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
subsd  (%rax),%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compareDouble>:
movsd  (%rdi),%xmm0
subsd  (%rsi),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @compareDouble(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca double*
%6 = alloca double*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to double*
store double* %8, double** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to double*
store double* %10, double** %6
%11 = load double*, double** %5
%12 = load double, double* %11
%13 = load double*, double** %6
%14 = load double, double* %13
%15 = fsub double %12, %14
%16 = fptosi double %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @compareDouble(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = bitcast i8* %1 to double*
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fsub double %5, %6
%8 = fptosi double %7 to i32
ret i32 %8
}
/* Variables and functions */
scalar_t__ IsLeapYear(int);
int GetDaysInMonth(int month, int nYear) {
  int nDaysPerMonthLocal[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  nDaysPerMonthLocal[1] = (IsLeapYear(nYear)) ? 29 : 28;
  return ((int)nDaysPerMonthLocal[month - 1]);
}


x86 assembly (clang, -O0):
<GetDaysInMonth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xec7(%rip),%rsi
mov    $0x30,%edx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%edi
call   1040 <IsLeapYear@plt>
mov    %rax,%rdx
mov    $0x1c,%eax
mov    $0x1d,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x40(%rbp,%rax,4),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetDaysInMonth>:
push   %rbx
sub    $0x30,%rsp
mov    %edi,%ebx
movaps 0xf02(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xee6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeca(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %esi,%edi
call   1030 <IsLeapYear@plt>
cmp    $0x1,%rax
mov    $0x1d,%eax
sbb    $0x0,%eax
mov    %eax,0x4(%rsp)
movslq %ebx,%rax
mov    -0x4(%rsp,%rax,4),%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.GetDaysInMonth.nDaysPerMonthLocal = [12 x i32] [i32 31, i32 28, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31]
define i32 @GetDaysInMonth(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [12 x i32]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = bitcast [12 x i32]* %5 to i8*
%7 = load i32, i32* %4
%8 = call i64 @IsLeapYear(i32 %7)
%9 = icmp ne i64 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 29, i32 28
%12 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 1
store i32 %11, i32* %12
%13 = load i32, i32* %3
%14 = sub nsw i32 %13, 1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 %15
%17 = load i32, i32* %16
ret i32 %17
}

LLVM IR (-O2):
@__const.GetDaysInMonth.nDaysPerMonthLocal = [12 x i32] [i32 31, i32 28, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31]
define i32 @GetDaysInMonth(i32 %0, i32 %1) {
%3 = alloca [12 x i32]
%4 = bitcast [12 x i32]* %3 to i8*
%5 = tail call i64 @IsLeapYear(i32 %1)
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i32 28, i32 29
%8 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 1
store i32 %7, i32* %8
%9 = add nsw i32 %0, -1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 %10
%12 = load i32, i32* %11
ret i32 %12
}
int shift(int i) { return 128 >> (i & 7); }


x86 assembly (clang, -O0):
<shift>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
and    $0x7,%ecx
mov    $0x80,%eax
sar    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<shift>:
mov    %edi,%ecx
and    $0x7,%cl
mov    $0x80,%eax
shr    %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @shift(i32 %0) {
%2 = and i32 %0, 7
%3 = lshr i32 128, %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main(int argc, const char *argv[]) {
  puts("Hello, World!");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"Hello, World!\00"
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 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello, World!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int padLine(int level) {
  int i;
  printf("\n");
  for (i = 0; i < level; i++)
    printf("    ");
}


x86 assembly (clang, -O0):
<padLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1154 <padLine+0x44>
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112e <padLine+0x1e>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<padLine>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %ebx,%ebx
jle    114d <padLine+0x2d>
lea    0xec5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0xffffffff,%ebx
jne    1140 <padLine+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str.1 = [5 x i8] c" \00"
define i32 @padLine(i32 %0) {
%2 = tail call i32 @putchar(i32 10)
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %9
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ 0, %1 ]
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %0
br i1 %8, label %9, label %4
9: ; preds = %4, %1
ret i32 undef
}
char *stpcpy(char *a, const char *b) {
  while (*b)
    *a++ = *b++;
  *a = 0;
  return (char *)a;
}


x86 assembly (clang, -O0):
<stpcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1140 <stpcpy+0x40>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    110c <stpcpy+0xc>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stpcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
test   %cl,%cl
je     1121 <stpcpy+0x21>
add    $0x1,%rsi
nopl   (%rax)
mov    %cl,(%rax)
add    $0x1,%rax
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <stpcpy+0x10>
movb   $0x0,(%rax)
ret

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

LLVM IR (-O2):
define i8* @stpcpy(i8* writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %9, %5 ], [ %1, %2 ]
%8 = phi i8* [ %10, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %6, i8* %8
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %0, %2 ], [ %10, %5 ]
store i8 0, i8* %14
ret i8* %14
}