xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ ENOMEM;
int /*<<< orphan*/ debug(char *);
int /*<<< orphan*/ errno;
scalar_t__ getenv(char *);
int sys_putenv(char *);
int putenv(char *string) {
  if (getenv("PUTENV_ALLOWED")) {
    return sys_putenv(string);
  }
  debug("putenv: ");
  errno = ENOMEM;
  return -1;
}


x86 assembly (clang, -O0):
<putenv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xebd(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     1163 <putenv+0x33>
mov    -0x10(%rbp),%rdi
call   1050 <sys_putenv@plt>
mov    %eax,-0x4(%rbp)
jmp    1188 <putenv+0x58>
lea    0xea5(%rip),%rdi
call   1040 <debug@plt>
mov    0x2e6a(%rip),%rax
mov    (%rax),%ecx
mov    0x2e59(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putenv>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     114e <putenv+0x1e>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <sys_putenv@plt>
lea    0xeba(%rip),%rdi
call   1040 <debug@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%eax
mov    0x2e6e(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"PUTENV_ALLOWED\00"
@.str.1 = [9 x i8] c"putenv: \00"
@ENOMEM = global i32 0
@errno = global i32 0
define i32 @putenv(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i64 @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = call i32 @sys_putenv(i8* %7)
store i32 %8, i32* %2
br label %12
9: ; preds = %1
%10 = call i32 @debug(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* @ENOMEM
store i32 %11, i32* @errno
store i32 -1, i32* %2
br label %12
12: ; preds = %9, %6
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@.str = [15 x i8] c"PUTENV_ALLOWED\00"
@.str.1 = [9 x i8] c"putenv: \00"
@ENOMEM = global i32 0
@errno = global i32 0
define i32 @putenv(i8* %0) {
%2 = tail call i64 @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @sys_putenv(i8* %0)
br label %9
6: ; preds = %1
%7 = tail call i32 @debug(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* @ENOMEM
store i32 %8, i32* @errno
br label %9
9: ; preds = %6, %4
%10 = phi i32 [ %5, %4 ], [ -1, %6 ]
ret i32 %10
}
regx0regx1_set(r0, r1, x0, x1, p0, p1) short r0, r1;
short *p0, *p1;
{ (p0[x0]) = (p1[x1]); }


x86 assembly (clang, -O0):
<regx0regx1_set>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,2),%dx
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dx,(%rax,%rcx,2)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<regx0regx1_set>:
movslq %ecx,%rax
movzwl (%r9,%rax,2),%eax
movslq %edx,%rcx
mov    %ax,(%r8,%rcx,2)
ret

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

LLVM IR (-O2):
define i32 @regx0regx1_set(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture writeonly %4, i16* nocapture %5) {
%7 = sext i32 %3 to i64
%8 = getelementptr inbounds i16, i16* %5, i64 %7
%9 = load i16, i16* %8
%10 = sext i32 %2 to i64
%11 = getelementptr inbounds i16, i16* %4, i64 %10
store i16 %9, i16* %11
ret i32 undef
}
div1(char x) { return x / -1; }


x86 assembly (clang, -O0):
<div1>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
mov    $0xffffffff,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @div1(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = sdiv i32 %4, -1
ret i32 %5
}

LLVM IR (-O2):
define i32 @div1(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = sub nsw i32 0, %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
void clear(char *line) { memset(line, 0, 256 + 1); }


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

x86 assembly (clang, -O2):
<clear>:
xor    %esi,%esi
mov    $0x101,%edx
jmp    1030 <memset@plt>

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

LLVM IR (-O2):
define void @clear(i8* %0) {
%2 = tail call i32 @memset(i8* %0, i32 0, i32 257)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ glFinish();
void qglFinish(void) { glFinish(); }


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

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

LLVM IR (-O0):
define void @qglFinish() {
%1 = call i32 (...) @glFinish()
ret void
}

LLVM IR (-O2):
define void @qglFinish() {
%1 = tail call i32 (...) @glFinish()
ret void
}
int immediate(int instruction) { return instruction & 0x0000ffff; }


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

x86 assembly (clang, -O2):
<immediate>:
movzwl %di,%eax
ret

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

LLVM IR (-O2):
define i32 @immediate(i32 %0) {
%2 = and i32 %0, 65535
ret i32 %2
}
/* Type definitions */
typedef int int16_t;

/* Variables and functions */
int read_bits(int);
int16_t read_value() {
  int16_t res = 0;
  res |= read_bits(4) << 8;
  res |= read_bits(8);
  if (res & 0x0800)
    res |= 0xF000;
  return res;
}


x86 assembly (clang, -O0):
<read_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1030 <read_bits@plt>
shl    $0x8,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0x8,%edi
call   1030 <read_bits@plt>
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x800,%eax
cmp    $0x0,%eax
je     115e <read_value+0x4e>
mov    -0x4(%rbp),%eax
or     $0xf000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_value>:
push   %rbx
mov    $0x4,%edi
call   1030 <read_bits@plt>
mov    %eax,%ebx
shl    $0x8,%ebx
mov    $0x8,%edi
call   1030 <read_bits@plt>
or     %ebx,%eax
mov    %eax,%ecx
or     $0xf000,%ecx
test   $0x800,%eax
cmovne %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @read_value() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @read_bits(i32 4)
%3 = shl i32 %2, 8
%4 = load i32, i32* %1
%5 = or i32 %4, %3
store i32 %5, i32* %1
%6 = call i32 @read_bits(i32 8)
%7 = load i32, i32* %1
%8 = or i32 %7, %6
store i32 %8, i32* %1
%9 = load i32, i32* %1
%10 = and i32 %9, 2048
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = load i32, i32* %1
%14 = or i32 %13, 61440
store i32 %14, i32* %1
br label %15
15: ; preds = %12, %0
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
define i32 @read_value() {
%1 = tail call i32 @read_bits(i32 4)
%2 = shl i32 %1, 8
%3 = tail call i32 @read_bits(i32 8)
%4 = or i32 %2, %3
%5 = and i32 %4, 2048
%6 = icmp eq i32 %5, 0
%7 = or i32 %4, 61440
%8 = select i1 %6, i32 %4, i32 %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, int, char const *, int);
void print_type(const char *type, int size) {
  printf("typedef %-16s    int%d;\n"
         "typedef unsigned %-9s  uint%d;\n",
         type, size, type, size);
}


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

x86 assembly (clang, -O2):
<print_type>:
mov    %esi,%edx
mov    %rdi,%rcx
lea    0xee4(%rip),%rdi
mov    %rcx,%rsi
mov    %edx,%r8d
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [56 x i8] c"typedef %-16s int%d;\0Atypedef unsigned %-9s uint%d;\0A\00"
define void @print_type(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6, i8* %7, i32 %8)
ret void
}

LLVM IR (-O2):
@.str = [56 x i8] c"typedef %-16s int%d;\0Atypedef unsigned %-9s uint%d;\0A\00"
define void @print_type(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i8* %0, i32 %1)
ret void
}
void fd51(int n) {
a : {
  typedef int(*b)[n];
P01A:
  goto P01A;
  {
    typedef int(*c)[n];
  P012A:
    goto P012A;
    0;
  }
p01B:
  goto p01B;
  goto a;
P01B:
  goto P01B;
  {
    typedef int(*d)[n];
  P013A:
    goto P013A;
    0;
  }
P01C:
  goto P01C;
  ;
  typedef int(*e)[n];
P014A:
  goto P014A;
  0;
};
P0B:
  goto P0B;
  {
    typedef int(*f)[n];
  P02A:
    goto P02A;
    {
      typedef int(*g)[n];
    P024A:
      goto P024A;
      0;
    };
  P02B:
    goto P02B;
    {
      typedef int(*h)[n];
    P025A:
      goto P025A;
      0;
    };
  P02C:
    goto P02C;
    ;
    typedef int(*i)[n];
  P026A:
    goto P026A;
    0;
  };
P0C:
  goto P0C;
  ;
  typedef int(*j)[n];
P03A:
  goto P03A;
  0;
P03B:
  goto P03B;
}


x86 assembly (clang, -O0):
<fd51>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
jmp    1107 <fd51+0x7>

x86 assembly (clang, -O2):
<fd51>:
jmp    1100 <fd51>

LLVM IR (-O0):
define void @fd51(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %1
%4 = load i32, i32* %2
%5 = zext i32 %4 to i64
br label %6
6: ; preds = %6, %3
br label %6
7: ; No predecessors!
%8 = load i32, i32* %2
%9 = zext i32 %8 to i64
br label %10
10: ; preds = %10, %7
br label %10
11: ; preds = %11
br label %11
12: ; preds = %12
br label %12
13: ; No predecessors!
%14 = load i32, i32* %2
%15 = zext i32 %14 to i64
br label %16
16: ; preds = %16, %13
br label %16
17: ; preds = %17
br label %17
18: ; No predecessors!
%19 = load i32, i32* %2
%20 = zext i32 %19 to i64
br label %21
21: ; preds = %21, %18
br label %21
22: ; preds = %22
br label %22
23: ; No predecessors!
%24 = load i32, i32* %2
%25 = zext i32 %24 to i64
br label %26
26: ; preds = %26, %23
br label %26
27: ; No predecessors!
%28 = load i32, i32* %2
%29 = zext i32 %28 to i64
br label %30
30: ; preds = %30, %27
br label %30
31: ; preds = %31
br label %31
32: ; No predecessors!
%33 = load i32, i32* %2
%34 = zext i32 %33 to i64
br label %35
35: ; preds = %35, %32
br label %35
36: ; preds = %36
br label %36
37: ; No predecessors!
%38 = load i32, i32* %2
%39 = zext i32 %38 to i64
br label %40
40: ; preds = %40, %37
br label %40
41: ; preds = %41
br label %41
42: ; No predecessors!
%43 = load i32, i32* %2
%44 = zext i32 %43 to i64
br label %45
45: ; preds = %45, %42
br label %45
46: ; preds = %46
br label %46
}

LLVM IR (-O2):
define void @fd51(i32 %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
unsigned short w_rev_word(unsigned short w) {
  unsigned short rev_w = 0;
  unsigned short mask = 0x00FF;
  unsigned char temp_b;
  temp_b = w & mask;
  rev_w += temp_b;
  rev_w <<= 8;
  mask <<= 8;
  temp_b = (unsigned char)((w & mask) >> 8);
  rev_w += temp_b;
  return rev_w;
}


x86 assembly (clang, -O0):
<w_rev_word>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movw   $0x0,-0x4(%rbp)
movw   $0xff,-0x6(%rbp)
movzwl -0x2(%rbp),%eax
movzwl -0x6(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0x7(%rbp)
movzbl -0x7(%rbp),%ecx
movzwl -0x4(%rbp),%eax
add    %ecx,%eax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
shl    $0x8,%eax
mov    %ax,-0x4(%rbp)
movzwl -0x6(%rbp),%eax
shl    $0x8,%eax
mov    %ax,-0x6(%rbp)
movzwl -0x2(%rbp),%eax
movzwl -0x6(%rbp),%ecx
and    %ecx,%eax
sar    $0x8,%eax
mov    %al,-0x7(%rbp)
movzbl -0x7(%rbp),%ecx
movzwl -0x4(%rbp),%eax
add    %ecx,%eax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<w_rev_word>:
mov    %edi,%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
define zeroext i16 @w_rev_word(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16
%4 = alloca i16
%5 = alloca i8
store i16 %0, i16* %2
store i16 0, i16* %3
store i16 255, i16* %4
%6 = load i16, i16* %2
%7 = zext i16 %6 to i32
%8 = load i16, i16* %4
%9 = zext i16 %8 to i32
%10 = and i32 %7, %9
%11 = trunc i32 %10 to i8
store i8 %11, i8* %5
%12 = load i8, i8* %5
%13 = zext i8 %12 to i32
%14 = load i16, i16* %3
%15 = zext i16 %14 to i32
%16 = add nsw i32 %15, %13
%17 = trunc i32 %16 to i16
store i16 %17, i16* %3
%18 = load i16, i16* %3
%19 = zext i16 %18 to i32
%20 = shl i32 %19, 8
%21 = trunc i32 %20 to i16
store i16 %21, i16* %3
%22 = load i16, i16* %4
%23 = zext i16 %22 to i32
%24 = shl i32 %23, 8
%25 = trunc i32 %24 to i16
store i16 %25, i16* %4
%26 = load i16, i16* %2
%27 = zext i16 %26 to i32
%28 = load i16, i16* %4
%29 = zext i16 %28 to i32
%30 = and i32 %27, %29
%31 = ashr i32 %30, 8
%32 = trunc i32 %31 to i8
store i8 %32, i8* %5
%33 = load i8, i8* %5
%34 = zext i8 %33 to i32
%35 = load i16, i16* %3
%36 = zext i16 %35 to i32
%37 = add nsw i32 %36, %34
%38 = trunc i32 %37 to i16
store i16 %38, i16* %3
%39 = load i16, i16* %3
ret i16 %39
}

LLVM IR (-O2):
define zeroext i16 @w_rev_word(i16 zeroext %0) {
%2 = tail call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}
/* Variables and functions */
scalar_t__ RAND_MAX;
scalar_t__ floor(int);
scalar_t__ rand();
int rdunif(int n) {
  return ((int)floor(n * (double)rand() / ((double)RAND_MAX + 1.0)));
}


x86 assembly (clang, -O0):
<rdunif>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
movsd  -0x10(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
mulsd  %xmm1,%xmm0
mov    0x2e97(%rip),%rax
cvtsi2sdq (%rax),%xmm1
movsd  0xea2(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <floor@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdunif>:
push   %rax
cvtsi2sd %edi,%xmm0
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1040 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mov    0x2ea8(%rip),%rax
cvtsi2sdq (%rax),%xmm1
addsd  0xeb3(%rip),%xmm1
mulsd  (%rsp),%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
pop    %rax
jmp    1030 <floor@plt>

LLVM IR (-O0):
@RAND_MAX = global i64 0
define i32 @rdunif(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to double
%5 = call i64 (...) @rand()
%6 = sitofp i64 %5 to double
%7 = fmul double %4, %6
%8 = load i64, i64* @RAND_MAX
%9 = sitofp i64 %8 to double
%10 = fadd double %9, 1.000000e+00
%11 = fdiv double %7, %10
%12 = fptosi double %11 to i32
%13 = call i64 @floor(i32 %12)
%14 = trunc i64 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define i32 @rdunif(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = tail call i64 (...) @rand()
%4 = sitofp i64 %3 to double
%5 = fmul double %2, %4
%6 = load i64, i64* @RAND_MAX
%7 = sitofp i64 %6 to double
%8 = fadd double %7, 1.000000e+00
%9 = fdiv double %5, %8
%10 = fptosi double %9 to i32
%11 = tail call i64 @floor(i32 %10)
%12 = trunc i64 %11 to i32
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ ftell(int /*<<< orphan*/ *);
void nocrash_ftell() {
  FILE *f;
  f = fopen("this_file_doesnt_exist", "r");
  if (f) {
    ftell(f);
    fclose(f);
  }
}


x86 assembly (clang, -O0):
<nocrash_ftell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xed1(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     116c <nocrash_ftell+0x3c>
mov    -0x8(%rbp),%rdi
call   1040 <ftell@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nocrash_ftell>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xed8(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     115d <nocrash_ftell+0x2d>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <ftell@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fclose@plt>
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [23 x i8] c"this_file_doesnt_exist\00"
@.str.1 = [2 x i8] c"r\00"
define void @nocrash_ftell() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i32 @ftell(i32* %1)
%5 = tail call i32 @fclose(i32* %1)
br label %6
6: ; preds = %3, %0
ret void
}
void ERR_get_string_table(void) {}


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

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

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

LLVM IR (-O2):
define void @ERR_get_string_table() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ vga__putch(char const);
void vga__puts(const char *s) {
  for (; *s != '\0'; s++)
    vga__putch(*s);
}


x86 assembly (clang, -O0):
<vga__puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1149 <vga__puts+0x39>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <vga__putch@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <vga__puts+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vga__puts>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <vga__puts+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <vga__putch@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <vga__puts+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @vga__puts(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 i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 @vga__putch(i8 signext %5)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
int rgbViewRestore(struct LSD_SceneNodeInst const *inst, void *instData) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.LSD_SceneNodeInst = type opaque
define i32 @rgbViewRestore(%struct.LSD_SceneNodeInst* %0, i8* %1) {
%3 = alloca %struct.LSD_SceneNodeInst*
%4 = alloca i8*
store %struct.LSD_SceneNodeInst* %0, %struct.LSD_SceneNodeInst** %3
store i8* %1, i8** %4
ret i32 0
}

LLVM IR (-O2):
%struct.LSD_SceneNodeInst = type opaque
define i32 @rgbViewRestore(%struct.LSD_SceneNodeInst* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ show_tickets_up(int);
int /*<<< orphan*/ shut_down();
void show_tickets_quit(int s) {
  show_tickets_up(s);
  printf("Shutting down\n");
  shut_down();
}


x86 assembly (clang, -O0):
<show_tickets_quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <show_tickets_up@plt>
lea    0xeb6(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <shut_down@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_tickets_quit>:
push   %rax
call   1030 <show_tickets_up@plt>
lea    0xec3(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <shut_down@plt>

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

LLVM IR (-O2):
@str = [14 x i8] c"Shutting down\00"
define void @show_tickets_quit(i32 %0) {
%2 = tail call i32 @show_tickets_up(i32 %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @shut_down()
ret void
}
int uintGreaterThan(const void *a, const void *b) {
  unsigned int an = *(unsigned int *)a;
  unsigned int bn = *(unsigned int *)b;
  if (an > bn)
    return 1;
  else if (an == bn)
    return 0;
  else
    return -1;
}


x86 assembly (clang, -O0):
<uintGreaterThan>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jbe    1136 <uintGreaterThan+0x36>
movl   $0x1,-0x4(%rbp)
jmp    1155 <uintGreaterThan+0x55>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    114e <uintGreaterThan+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    1155 <uintGreaterThan+0x55>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uintGreaterThan>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
xor    %edx,%edx
cmp    %ecx,%eax
setne  %dl
neg    %edx
cmp    %ecx,%eax
mov    $0x1,%eax
cmovbe %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @uintGreaterThan(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp ugt i32 %4, %6
%8 = icmp ne i32 %4, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
/* Variables and functions */
void g();
void f(void) {
  g();
  { void g(); }
}


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

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

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

LLVM IR (-O2):
define void @f() {
tail call void (...) @g()
ret void
}
int test_imm_FEint16_mem(short *val) {
  return ((*val) & (-0xFE << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_FEint16_mem>:
movzwl (%rdi),%eax
test   $0xff02,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_FEint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -254
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int Output_Consumer(const void *pOutput, unsigned int nOutputLen,
                    void *pUserData) {
  printf("%.*s", nOutputLen, pOutput);
  return 0;
}


x86 assembly (clang, -O0):
<Output_Consumer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rdx
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Output_Consumer>:
push   %rax
mov    %rdi,%rdx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%.*s\00"
define i32 @Output_Consumer(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 i32, i32* %5
%8 = load i8*, i8** %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %7, i8* %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%.*s\00"
define i32 @Output_Consumer(i8* %0, i32 %1, i8* nocapture readnone %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %1, i8* %0)
ret i32 0
}
/* Variables and functions */
scalar_t__ fdim(double, double);
float fdimf(float x, float y) { return (float)fdim((double)x, (double)y); }


x86 assembly (clang, -O0):
<fdimf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
call   1030 <fdim@plt>
cvtsi2ss %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdimf>:
push   %rax
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
call   1030 <fdim@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @fdimf(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 = fpext float %5 to double
%7 = load float, float* %4
%8 = fpext float %7 to double
%9 = call i64 @fdim(double %6, double %8)
%10 = sitofp i64 %9 to float
ret float %10
}

LLVM IR (-O2):
define float @fdimf(float %0, float %1) {
%3 = fpext float %0 to double
%4 = fpext float %1 to double
%5 = tail call i64 @fdim(double %3, double %4)
%6 = sitofp i64 %5 to float
ret float %6
}
/* Variables and functions */
short _BigShort(short);
short BigShort(short l) { return _BigShort(l); }


x86 assembly (clang, -O0):
<BigShort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edi
call   1030 <_BigShort@plt>
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BigShort>:
jmp    1030 <_BigShort@plt>

LLVM IR (-O0):
define signext i16 @BigShort(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = call signext i16 @_BigShort(i16 signext %3)
ret i16 %4
}

LLVM IR (-O2):
define signext i16 @BigShort(i16 signext %0) {
%2 = tail call signext i16 @_BigShort(i16 signext %0)
ret i16 %2
}
/* Variables and functions */
int getchar();
scalar_t__ islower(int);
int /*<<< orphan*/ redraw_screen();
int toupper(int);
readchar() {
  int c;
  while ((c = getchar()) == '\014')
    redraw_screen();
  return (islower(c) ? toupper(c) : c);
}


x86 assembly (clang, -O0):
<readchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x4(%rbp)
cmp    $0xc,%eax
jne    1167 <readchar+0x27>
mov    $0x0,%al
call   1060 <redraw_screen@plt>
jmp    1148 <readchar+0x8>
mov    -0x4(%rbp),%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
je     1189 <readchar+0x49>
mov    -0x4(%rbp),%edi
call   1040 <toupper@plt>
mov    %eax,-0x8(%rbp)
jmp    118f <readchar+0x4f>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readchar>:
push   %rbx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
cmp    $0xc,%eax
jne    1165 <readchar+0x25>
nop
xor    %eax,%eax
call   1060 <redraw_screen@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xc,%eax
je     1150 <readchar+0x10>
mov    %eax,%ebx
mov    %ebx,%edi
call   1030 <islower@plt>
test   %rax,%rax
je     1179 <readchar+0x39>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <toupper@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @readchar() {
%1 = alloca i32
br label %2
2: ; preds = %5, %0
%3 = call i32 (...) @getchar()
store i32 %3, i32* %1
%4 = icmp eq i32 %3, 12
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = call i32 (...) @redraw_screen()
br label %2
7: ; preds = %2
%8 = load i32, i32* %1
%9 = call i64 @islower(i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i32, i32* %1
%13 = call i32 @toupper(i32 %12)
br label %16
14: ; preds = %7
%15 = load i32, i32* %1
br label %16
16: ; preds = %14, %11
%17 = phi i32 [ %13, %11 ], [ %15, %14 ]
ret i32 %17
}

LLVM IR (-O2):
define i32 @readchar() {
%1 = tail call i32 (...) @getchar()
%2 = icmp eq i32 %1, 12
br i1 %2, label %3, label %7
3: ; preds = %0, %3
%4 = tail call i32 (...) @redraw_screen()
%5 = tail call i32 (...) @getchar()
%6 = icmp eq i32 %5, 12
br i1 %6, label %3, label %7
7: ; preds = %3, %0
%8 = phi i32 [ %1, %0 ], [ %5, %3 ]
%9 = tail call i64 @islower(i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %7
%12 = tail call i32 @toupper(i32 %8)
br label %13
13: ; preds = %7, %11
%14 = phi i32 [ %12, %11 ], [ %8, %7 ]
ret i32 %14
}
/* Variables and functions */
int OSDDummyUseBuffer(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @OSDDummyUseBuffer() {
ret i32 0
}
/* Variables and functions */
int max(unsigned int, unsigned int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  unsigned int aa = 8;
  unsigned int bb = 10;
  printf("max = %d\n", max(aa, bb));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x8,%edi
mov    $0xa,%esi
call   1040 <max@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"max = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 8, i32* %2
store i32 10, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = call i32 @max(i32 %4, i32 %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"max = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @max(i32 8, i32 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fwrite_safe(float *, int, int, int /*<<< orphan*/ *);
void dump_float_array(float *values, int length, FILE *fp) {
  fwrite_safe(values, sizeof(float), length, fp);
  return;
}


x86 assembly (clang, -O0):
<dump_float_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    $0x4,%esi
call   1030 <fwrite_safe@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_float_array>:
mov    %rdx,%rcx
mov    %esi,%edx
mov    $0x4,%esi
jmp    1030 <fwrite_safe@plt>

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

LLVM IR (-O2):
define void @dump_float_array(float* %0, i32 %1, i32* %2) {
%4 = tail call i32 @fwrite_safe(float* %0, i32 4, i32 %1, i32* %2)
ret void
}
int isBitset(int n, unsigned int pos) {
  int mask = 1 << (pos - 1);
  return (mask & n) != 0;
}


x86 assembly (clang, -O0):
<isBitset>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    -0x4(%rbp),%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isBitset>:
mov    %edi,%eax
lea    -0x1(%rsi),%ecx
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @isBitset(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = sub i32 %6, 1
%8 = shl i32 1, %7
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = load i32, i32* %3
%11 = and i32 %9, %10
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @isBitset(i32 %0, i32 %1) {
%3 = add i32 %1, -1
%4 = lshr i32 %0, %3
%5 = and i32 %4, 1
ret i32 %5
}
double Pow(x, y)
double x;
double y;
{ return errcheck(pow(x, y), "exponenciation"); }


x86 assembly (clang, -O0):
<Pow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1040 <pow@plt>
lea    0xeb8(%rip),%rdi
mov    $0x1,%al
call   1030 <errcheck@plt>
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pow>:
push   %rax
call   1040 <pow@plt>
lea    0xed3(%rip),%rdi
mov    $0x1,%al
call   1030 <errcheck@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [15 x i8] c"exponenciation\00"
define double @Pow(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = call double @pow(double %5, double %6)
%8 = call i32 (double, i8*, ...) bitcast (i32 (...)* @errcheck to i32 (double, i8*, ...)*)(double %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%9 = sitofp i32 %8 to double
ret double %9
}

LLVM IR (-O2):
@.str = [15 x i8] c"exponenciation\00"
define double @Pow(double %0, double %1) {
%3 = tail call double @pow(double %0, double %1)
%4 = tail call i32 (double, i8*, ...) bitcast (i32 (...)* @errcheck to i32 (double, i8*, ...)*)(double %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = sitofp i32 %4 to double
ret double %5
}
void g_utf8_get_char() {}


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

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

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

LLVM IR (-O2):
define void @g_utf8_get_char() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ US_DrawWindow(int const, int const, int, int);
void US_CenterWindow(int w, int h) {
  const int maxXtile = 320 / 8;
  const int maxYtile = 200 / 8;
  US_DrawWindow((maxXtile - w) / 2, (maxYtile - h) / 2, w, h);
}


x86 assembly (clang, -O0):
<US_CenterWindow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x28,-0xc(%rbp)
movl   $0x19,-0x10(%rbp)
mov    $0x28,%eax
sub    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    $0x19,%eax
sub    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
call   1030 <US_DrawWindow@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<US_CenterWindow>:
mov    %esi,%ecx
mov    %edi,%edx
mov    $0x28,%eax
sub    %edi,%eax
mov    %eax,%edi
shr    $0x1f,%edi
add    %eax,%edi
sar    %edi
mov    $0x19,%eax
sub    %esi,%eax
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
jmp    1030 <US_DrawWindow@plt>

LLVM IR (-O0):
define void @US_CenterWindow(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 40, i32* %5
store i32 25, i32* %6
%7 = load i32, i32* %3
%8 = sub nsw i32 40, %7
%9 = sdiv i32 %8, 2
%10 = load i32, i32* %4
%11 = sub nsw i32 25, %10
%12 = sdiv i32 %11, 2
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = call i32 @US_DrawWindow(i32 %9, i32 %12, i32 %13, i32 %14)
ret void
}

LLVM IR (-O2):
define void @US_CenterWindow(i32 %0, i32 %1) {
%3 = sub nsw i32 40, %0
%4 = sdiv i32 %3, 2
%5 = sub nsw i32 25, %1
%6 = sdiv i32 %5, 2
%7 = tail call i32 @US_DrawWindow(i32 %4, i32 %6, i32 %0, i32 %1)
ret void
}
/* Type definitions */
struct str {
  int dummy;
};

/* Variables and functions */
int str_appendn(struct str *, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
int str_append(struct str *str, const char *buf) {
  return str_appendn(str, buf, strlen(buf));
}


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

x86 assembly (clang, -O2):
<str_append>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <str_appendn@plt>

LLVM IR (-O0):
%struct.str = type { i32 }
define i32 @str_append(%struct.str* %0, i8* %1) {
%3 = alloca %struct.str*
%4 = alloca i8*
store %struct.str* %0, %struct.str** %3
store i8* %1, i8** %4
%5 = load %struct.str*, %struct.str** %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @str_appendn(%struct.str* %5, i8* %6, i32 %8)
ret i32 %9
}

LLVM IR (-O2):
%struct.str = type { i32 }
define i32 @str_append(%struct.str* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @str_appendn(%struct.str* %0, i8* %1, i32 %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void my_exit1(void) { printf("my exit1 ... \n"); }


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"my exit1 ... \00"
define void @my_exit1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct cpu_key {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ reiserfs_warning(char *);
void errcatch_decrement_key(struct cpu_key *key) {
  reiserfs_warning("green-16002: Invalid item type observed, run fsck ASAP\n");
}


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

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

LLVM IR (-O0):
%struct.cpu_key = type { i32 }
@.str = [56 x i8] c"green-16002: Invalid item type observed, run fsck ASAP\0A\00"
define void @errcatch_decrement_key(%struct.cpu_key* %0) {
%2 = alloca %struct.cpu_key*
store %struct.cpu_key* %0, %struct.cpu_key** %2
%3 = call i32 @reiserfs_warning(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.cpu_key = type { i32 }
@.str = [56 x i8] c"green-16002: Invalid item type observed, run fsck ASAP\0A\00"
define void @errcatch_decrement_key(%struct.cpu_key* nocapture readnone %0) {
%2 = tail call i32 @reiserfs_warning(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ g(int);
void gen_le32(int c) {
  g(c);
  g(c >> 8);
  g(c >> 16);
  g(c >> 24);
}


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

x86 assembly (clang, -O2):
<gen_le32>:
push   %rbx
mov    %edi,%ebx
call   1030 <g@plt>
mov    %ebx,%edi
sar    $0x8,%edi
call   1030 <g@plt>
mov    %ebx,%edi
sar    $0x10,%edi
call   1030 <g@plt>
sar    $0x18,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <g@plt>

LLVM IR (-O0):
define void @gen_le32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @g(i32 %3)
%5 = load i32, i32* %2
%6 = ashr i32 %5, 8
%7 = call i32 @g(i32 %6)
%8 = load i32, i32* %2
%9 = ashr i32 %8, 16
%10 = call i32 @g(i32 %9)
%11 = load i32, i32* %2
%12 = ashr i32 %11, 24
%13 = call i32 @g(i32 %12)
ret void
}

LLVM IR (-O2):
define void @gen_le32(i32 %0) {
%2 = tail call i32 @g(i32 %0)
%3 = ashr i32 %0, 8
%4 = tail call i32 @g(i32 %3)
%5 = ashr i32 %0, 16
%6 = tail call i32 @g(i32 %5)
%7 = ashr i32 %0, 24
%8 = tail call i32 @g(i32 %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isxdigit(int);
void t_isxdigit_0x65() {
  Assert_real((isxdigit(101)),
              "/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_isxdigit.c",
              510, ("isxdigit should be 1 for e"));
}


x86 assembly (clang, -O0):
<t_isxdigit_0x65>:
push   %rbp
mov    %rsp,%rbp
mov    $0x65,%edi
call   1030 <isxdigit@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x1fe,%edx
lea    0xf66(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isxdigit_0x65>:
push   %rax
mov    $0x65,%edi
call   1030 <isxdigit@plt>
lea    0xece(%rip),%rsi
lea    0xf70(%rip),%rcx
mov    %eax,%edi
mov    $0x1fe,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 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_isxdigit.c\00"
@.str.1 = [27 x i8] c"isxdigit should be 1 for e\00"
define void @t_isxdigit_0x65() {
%1 = call i32 @isxdigit(i32 101)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 510, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 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_isxdigit.c\00"
@.str.1 = [27 x i8] c"isxdigit should be 1 for e\00"
define void @t_isxdigit_0x65() {
%1 = tail call i32 @isxdigit(i32 101)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 510, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ api5(int, int, int, int, unsigned long, int);
void erase_char(int sid, int x, int y, unsigned long color, int update) {
  api5(1012, sid, x, y, color, update);
}


x86 assembly (clang, -O0):
<erase_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%r8
mov    -0x1c(%rbp),%r9d
mov    $0x3f4,%edi
call   1030 <api5@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<erase_char>:
mov    %r8d,%r9d
mov    %rcx,%r8
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
mov    $0x3f4,%edi
jmp    1030 <api5@plt>

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

LLVM IR (-O2):
define void @erase_char(i32 %0, i32 %1, i32 %2, i64 %3, i32 %4) {
%6 = tail call i32 @api5(i32 1012, i32 %0, i32 %1, i32 %2, i64 %3, i32 %4)
ret void
}