xunge/DecIR huggingface dataset:
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ rmdir(char const *);
int dir_remove_action(const char *filename, struct stat *statbuf,
                      void *userdata, int depth) {
  if (!depth)
    return 1;
  rmdir(filename);
  return 1;
}


x86 assembly (clang, -O0):
<dir_remove_action>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    113d <dir_remove_action+0x2d>
movl   $0x1,-0x4(%rbp)
jmp    114d <dir_remove_action+0x3d>
mov    -0x10(%rbp),%rdi
call   1030 <rmdir@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dir_remove_action>:
test   %ecx,%ecx
je     111e <dir_remove_action+0xe>
push   %rax
call   1030 <rmdir@plt>
add    $0x8,%rsp
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @dir_remove_action(i8* nocapture %0, %struct.stat* nocapture readnone %1, i8* nocapture readnone %2, i32 %3) {
%5 = icmp eq i32 %3, 0
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 @rmdir(i8* %0)
br label %8
8: ; preds = %4, %6
ret i32 1
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int syscon_read_multprec_system(int deci) {
  int *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(440, &deci, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<syscon_read_multprec_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x1b8,%edi
lea    -0x4(%rbp),%rsi
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):
<syscon_read_multprec_system>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x1b8,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @syscon_read_multprec_system(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @_ada_use_c2phc4c(i32 440, i32* %2, i32* undef, double* undef, i32 0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ wm_debug(char *);
void grow_right() { wm_debug("Growing right."); }


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"Growing right.\00"
define void @grow_right() {
%1 = call i32 @wm_debug(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"Growing right.\00"
define void @grow_right() {
%1 = tail call i32 @wm_debug(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}
int iscntrl(int c) { return ((c >= 1) && (c <= 31)); }


x86 assembly (clang, -O0):
<iscntrl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x1,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <iscntrl+0x20>
cmpl   $0x1f,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iscntrl>:
add    $0xffffffff,%edi
xor    %eax,%eax
cmp    $0x1f,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @iscntrl(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 31
%4 = zext i1 %3 to i32
ret i32 %4
}
int do_661() { return 661; }


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

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

LLVM IR (-O0):
define i32 @do_661() {
ret i32 661
}

LLVM IR (-O2):
define i32 @do_661() {
ret i32 661
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char t = 50;
  char *z1 = &t;
  void *z2 = z1;
  unsigned int *pi = z2;
  printf("pi = %u\n", *pi);
  if (*pi == 50) {
    printf("UNSAFE\n");
    goto ERROR;
  }
  printf("SAFE\n");
  return (0);
ERROR:
  return (-1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x32,-0x5(%rbp)
lea    -0x5(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
cmpl   $0x32,(%rax)
jne    116f <main+0x5f>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1189 <main+0x79>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1190 <main+0x80>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
mov    $0x32,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"pi = %u\0A\00"
@str = [7 x i8] c"UNSAFE\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 50)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
long lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
long filelength(int stream) {
  long cur, result;
  cur = lseek(stream, (off_t)0, SEEK_CUR);
  result = lseek(stream, (off_t)0, SEEK_END);
  lseek(stream, (off_t)cur, SEEK_SET);
  return result;
}


x86 assembly (clang, -O0):
<filelength>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebb(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <lseek@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eac(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <lseek@plt>
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    %eax,%esi
mov    0x2e77(%rip),%rax
mov    (%rax),%edx
call   1030 <lseek@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filelength>:
push   %r15
push   %r14
push   %rbx
mov    %edi,%ebx
mov    0x2ec2(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <lseek@plt>
mov    %rax,%r14
mov    0x2eb7(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <lseek@plt>
mov    %rax,%r15
mov    0x2e8a(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14d,%esi
call   1030 <lseek@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@SEEK_CUR = global i32 0
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i64 @filelength(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* @SEEK_CUR
%7 = call i64 @lseek(i32 %5, i32 0, i32 %6)
store i64 %7, i64* %3
%8 = load i32, i32* %2
%9 = load i32, i32* @SEEK_END
%10 = call i64 @lseek(i32 %8, i32 0, i32 %9)
store i64 %10, i64* %4
%11 = load i32, i32* %2
%12 = load i64, i64* %3
%13 = trunc i64 %12 to i32
%14 = load i32, i32* @SEEK_SET
%15 = call i64 @lseek(i32 %11, i32 %13, i32 %14)
%16 = load i64, i64* %4
ret i64 %16
}

LLVM IR (-O2):
@SEEK_CUR = global i32 0
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i64 @filelength(i32 %0) {
%2 = load i32, i32* @SEEK_CUR
%3 = tail call i64 @lseek(i32 %0, i32 0, i32 %2)
%4 = load i32, i32* @SEEK_END
%5 = tail call i64 @lseek(i32 %0, i32 0, i32 %4)
%6 = trunc i64 %3 to i32
%7 = load i32, i32* @SEEK_SET
%8 = tail call i64 @lseek(i32 %0, i32 %6, i32 %7)
ret i64 %5
}
void rt_clear(struct rt_t *rt) {}


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

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

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

LLVM IR (-O2):
%struct.rt_t = type opaque
define void @rt_clear(%struct.rt_t* nocapture %0) {
ret void
}
int ctz32(unsigned int a) { return __builtin_ctz(a); }


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

x86 assembly (clang, -O2):
<ctz32>:
bsf    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @ctz32(i32 %0) {
%2 = tail call i32 @llvm.cttz.i32(i32 %0, i1 true)
ret i32 %2
}
void char2addr(void) {}


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

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

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

LLVM IR (-O2):
define void @char2addr() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isbdigit(int);
void t_isbdigit_0xc1() {
  Assert_real((isbdigit(193) == 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_isbdigit.c",
              970, ("isbdigit should be 0 for 0xc1"));
}


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

x86 assembly (clang, -O2):
<t_isbdigit_0xc1>:
push   %rax
mov    $0xc1,%edi
call   1040 <isbdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x3ca,%edx
pop    %rax
jmp    1030 <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_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0xc1\00"
define void @t_isbdigit_0xc1() {
%1 = call i64 @isbdigit(i32 193)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 970, i8* getelementptr inbounds ([30 x i8], [30 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_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0xc1\00"
define void @t_isbdigit_0xc1() {
%1 = tail call i64 @isbdigit(i32 193)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 970, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
long fac1(int n) {
  extern long som1;
  if (n <= 1)
    return som1;
  else {
    som1 = som1 * n;
    fac1(--n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<fac1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jg     1138 <fac1+0x28>
mov    0x2ebc(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    116a <fac1+0x5a>
mov    0x2ea9(%rip),%rax
mov    (%rax),%rcx
movslq -0xc(%rbp),%rax
imul   %rax,%rcx
mov    0x2e97(%rip),%rax
mov    %rcx,(%rax)
mov    -0xc(%rbp),%edi
add    $0xffffffff,%edi
mov    %edi,-0xc(%rbp)
call   1030 <fac1@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fac1>:
mov    0x2ee1(%rip),%rcx
mov    (%rcx),%rax
cmp    $0x2,%edi
jl     1136 <fac1+0x36>
mov    %edi,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
imul   %rdx,%rax
lea    -0x1(%rdx),%rsi
cmp    $0x3,%rdx
mov    %rsi,%rdx
jae    1120 <fac1+0x20>
mov    %rax,(%rcx)
xor    %eax,%eax
ret

LLVM IR (-O0):
@som1 = external global i64
define i64 @fac1(i32 %0) {
%2 = alloca i64
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sle i32 %4, 1
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i64, i64* @som1
store i64 %7, i64* %2
br label %17
8: ; preds = %1
%9 = load i64, i64* @som1
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = mul nsw i64 %9, %11
store i64 %12, i64* @som1
%13 = load i32, i32* %3
%14 = add nsw i32 %13, -1
store i32 %14, i32* %3
%15 = call i64 @fac1(i32 %14)
br label %16
16: ; preds = %8
store i64 0, i64* %2
br label %17
17: ; preds = %16, %6
%18 = load i64, i64* %2
ret i64 %18
}

LLVM IR (-O2):
@som1 = external global i64
define i64 @fac1(i32 %0) {
%2 = load i64, i64* @som1
%3 = icmp slt i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = zext i32 %0 to i64
br label %9
6: ; preds = %9
store i64 %12, i64* @som1
br label %7
7: ; preds = %6, %1
%8 = phi i64 [ 0, %6 ], [ %2, %1 ]
ret i64 %8
9: ; preds = %4, %9
%10 = phi i64 [ %5, %4 ], [ %13, %9 ]
%11 = phi i64 [ %2, %4 ], [ %12, %9 ]
%12 = mul nsw i64 %11, %10
%13 = add nsw i64 %10, -1
%14 = icmp ult i64 %10, 3
br i1 %14, label %6, label %9
}
int EMaxInt(int a, int b) { return (a > b) ? a : b; }


x86 assembly (clang, -O0):
<EMaxInt>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <EMaxInt+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <EMaxInt+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMaxInt>:
mov    %esi,%eax
cmp    %esi,%edi
cmovg  %edi,%eax
ret

LLVM IR (-O0):
define i32 @EMaxInt(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 = icmp sgt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @EMaxInt(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ h2o__fatal(char *);
void *realloc(void *, size_t);
void *h2o_mem_realloc(void *oldp, size_t sz) {
  void *newp = realloc(oldp, sz);
  if (newp == NULL) {
    h2o__fatal("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/cubicdaiya/h2o/refs/heads/"
               "master/lib/common/h2o/memory.h"
               ":"
               "338"
               ":"
               "no memory");
    return oldp;
  }
  return newp;
}


x86 assembly (clang, -O0):
<h2o_mem_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1165 <h2o_mem_realloc+0x45>
lea    0xead(%rip),%rdi
call   1030 <h2o__fatal@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116d <h2o_mem_realloc+0x4d>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<h2o_mem_realloc>:
push   %rbx
mov    %rdi,%rbx
call   1040 <realloc@plt>
test   %rax,%rax
je     1130 <h2o_mem_realloc+0x10>
pop    %rbx
ret
lea    0xec9(%rip),%rdi
call   1030 <h2o__fatal@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [161 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/cubicdaiya/h2o/refs/heads/master/lib/common/h2o/memory.h:338:no memory\00"
define i8* @h2o_mem_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
%7 = load i8*, i8** %4
%8 = load i64, i64* %5
%9 = call i8* @realloc(i8* %7, i64 %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = call i32 @h2o__fatal(i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str, i64 0, i64 0))
%14 = load i8*, i8** %4
store i8* %14, i8** %3
br label %17
15: ; preds = %2
%16 = load i8*, i8** %6
store i8* %16, i8** %3
br label %17
17: ; preds = %15, %12
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
@.str = [161 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/cubicdaiya/h2o/refs/heads/master/lib/common/h2o/memory.h:338:no memory\00"
define i8* @h2o_mem_realloc(i8* %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @h2o__fatal(i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %2, %5
%8 = phi i8* [ %0, %5 ], [ %3, %2 ]
ret i8* %8
}
int euclid(int m, int n) {
  int t;
  while (n != 0) {
    t = m % n;
    m = n;
    n = t;
  }
  return m;
}


x86 assembly (clang, -O0):
<euclid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112f <euclid+0x2f>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    110a <euclid+0xa>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<euclid>:
mov    %edi,%eax
test   %esi,%esi
je     111d <euclid+0x1d>
mov    %esi,%edx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <euclid+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @euclid(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %6, %4 ], [ %0, %2 ]
%6 = phi i32 [ %7, %4 ], [ %1, %2 ]
%7 = srem i32 %5, %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %6, %4 ]
ret i32 %10
}
int main(void) {
  int x = 5;
  float *p = (float *)&x;
  *p;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x5,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca float*
store i32 5, i32* %1
%3 = bitcast i32* %1 to float*
store float* %3, float** %2
%4 = load float*, float** %2
%5 = load float, float* %4
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void g_key_file_load_from_data_dirs() {}


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

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

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

LLVM IR (-O2):
define void @g_key_file_load_from_data_dirs() {
ret void
}
char *strcpy(char *s1, const char *s2) {
  int i;
  for (i = 0; s2[i] != '\0'; i++) {
    s1[i] = s2[i];
  }
  s1[i] = '\0';
  return s1;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     114c <strcpy+0x4c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <strcpy+0x13>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
test   %cl,%cl
je     1127 <strcpy+0x27>
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
mov    %cl,(%rax,%rdx,1)
movzbl 0x1(%rsi,%rdx,1),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1110 <strcpy+0x10>
mov    %edx,%ecx
movb   $0x0,(%rax,%rcx,1)
ret
xor    %ecx,%ecx
movb   $0x0,(%rax,%rcx,1)
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %9, %5 ], [ 0, %2 ]
%7 = phi i8 [ %11, %5 ], [ %3, %2 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 %7, i8* %8
%9 = add nuw nsw i64 %6, 1
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5
%14 = and i64 %9, 4294967295
br label %15
15: ; preds = %13, %2
%16 = phi i64 [ 0, %2 ], [ %14, %13 ]
%17 = getelementptr inbounds i8, i8* %0, i64 %16
store i8 0, i8* %17
ret i8* %0
}
int async_os_initialize(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @async_os_initialize() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ test_coq_comment_entities();
int /*<<< orphan*/ test_coq_comments();
void all_coq_tests() {
  test_coq_comments();
  test_coq_comment_entities();
}


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

x86 assembly (clang, -O2):
<all_coq_tests>:
push   %rax
xor    %eax,%eax
call   1040 <test_coq_comments@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <test_coq_comment_entities@plt>

LLVM IR (-O0):
define void @all_coq_tests() {
%1 = call i32 (...) @test_coq_comments()
%2 = call i32 (...) @test_coq_comment_entities()
ret void
}

LLVM IR (-O2):
define void @all_coq_tests() {
%1 = tail call i32 (...) @test_coq_comments()
%2 = tail call i32 (...) @test_coq_comment_entities()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PrintGoldenRatio();
int main(int argc, const char *argv[]) {
  PrintGoldenRatio();
  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)
mov    $0x0,%al
call   1030 <PrintGoldenRatio@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @PrintGoldenRatio()
ret i32 0
}
/* Variables and functions */
double logf(float const);
float log10f(const float x) { return logf(x) * 0.4342944819; }


x86 assembly (clang, -O0):
<log10f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <logf@plt>
movsd  0xed1(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log10f>:
push   %rax
call   1030 <logf@plt>
mulsd  0xee2(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @log10f(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call double @logf(float %3)
%5 = fmul double %4, 0x3FDBCB7B1526003A
%6 = fptrunc double %5 to float
ret float %6
}

LLVM IR (-O2):
define float @log10f(float %0) {
%2 = tail call double @logf(float %0)
%3 = fmul double %2, 0x3FDBCB7B1526003A
%4 = fptrunc double %3 to float
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ R_PolyBlend();
void R_Flash(void) { R_PolyBlend(); }


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

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

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

LLVM IR (-O2):
define void @R_Flash() {
%1 = tail call i32 (...) @R_PolyBlend()
ret void
}
/* Variables and functions */
unsigned char TstActMov(int);
unsigned char RunHea(void) {
  unsigned char UcRst;
  UcRst = 0x00000002L;
  UcRst |= TstActMov(0x00);
  UcRst |= TstActMov(0x01);
  return (UcRst);
}


x86 assembly (clang, -O0):
<RunHea>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x2,-0x1(%rbp)
xor    %edi,%edi
call   1030 <TstActMov@plt>
movzbl %al,%ecx
movzbl -0x1(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x1(%rbp)
mov    $0x1,%edi
call   1030 <TstActMov@plt>
movzbl %al,%ecx
movzbl -0x1(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RunHea>:
push   %rbx
xor    %edi,%edi
call   1030 <TstActMov@plt>
mov    %eax,%ebx
mov    $0x1,%edi
call   1030 <TstActMov@plt>
or     %bl,%al
or     $0x2,%al
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i8 @RunHea() {
%1 = alloca i8
store i8 2, i8* %1
%2 = call zeroext i8 @TstActMov(i32 0)
%3 = zext i8 %2 to i32
%4 = load i8, i8* %1
%5 = zext i8 %4 to i32
%6 = or i32 %5, %3
%7 = trunc i32 %6 to i8
store i8 %7, i8* %1
%8 = call zeroext i8 @TstActMov(i32 1)
%9 = zext i8 %8 to i32
%10 = load i8, i8* %1
%11 = zext i8 %10 to i32
%12 = or i32 %11, %9
%13 = trunc i32 %12 to i8
store i8 %13, i8* %1
%14 = load i8, i8* %1
ret i8 %14
}

LLVM IR (-O2):
define zeroext i8 @RunHea() {
%1 = tail call zeroext i8 @TstActMov(i32 0)
%2 = tail call zeroext i8 @TstActMov(i32 1)
%3 = or i8 %1, %2
%4 = or i8 %3, 2
ret i8 %4
}
int re_assemble_3(int as3) {
  return (((as3 & 4) << (13 - 2)) | ((as3 & 3) << (13 + 1)));
}


x86 assembly (clang, -O0):
<re_assemble_3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x4,%eax
shl    $0xb,%eax
mov    -0x4(%rbp),%ecx
and    $0x3,%ecx
shl    $0xe,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<re_assemble_3>:
mov    %edi,%ecx
and    $0x4,%ecx
shl    $0xb,%ecx
shl    $0xe,%edi
movzwl %di,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @re_assemble_3(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 4
%5 = shl i32 %4, 11
%6 = load i32, i32* %2
%7 = and i32 %6, 3
%8 = shl i32 %7, 14
%9 = or i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @re_assemble_3(i32 %0) {
%2 = shl i32 %0, 11
%3 = and i32 %2, 8192
%4 = shl i32 %0, 14
%5 = and i32 %4, 49152
%6 = or i32 %3, %5
ret i32 %6
}
int glmMinIndex2f(float a, float b, int i1, int i2) {
  if (a < b)
    return i1;
  return i2;
}


x86 assembly (clang, -O0):
<glmMinIndex2f>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1132 <glmMinIndex2f+0x32>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1138 <glmMinIndex2f+0x38>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmMinIndex2f>:
ucomiss %xmm0,%xmm1
mov    %edi,%eax
cmovbe %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @glmMinIndex2f(float %0, float %1, i32 %2, i32 %3) {
%5 = fcmp olt float %0, %1
%6 = select i1 %5, i32 %2, i32 %3
ret i32 %6
}
/* Variables and functions */
double __dmod(double, double);
double intr_wrap_389(double p1, double p2) { return __dmod(p1, p2); }


x86 assembly (clang, -O0):
<intr_wrap_389>:
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   1030 <__dmod@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intr_wrap_389>:
jmp    1030 <__dmod@plt>

LLVM IR (-O0):
define double @intr_wrap_389(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 @__dmod(double %5, double %6)
ret double %7
}

LLVM IR (-O2):
define double @intr_wrap_389(double %0, double %1) {
%3 = tail call double @__dmod(double %0, double %1)
ret double %3
}
/* Variables and functions */
int cos(double);
int fabs(double);
double cosc(double x) { return (fabs(x) < 1e-10) ? 0.0 : (1 - cos(x)) / x; }


x86 assembly (clang, -O0):
<cosc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xebd(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    115a <cosc+0x3a>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    117b <cosc+0x5b>
movsd  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cosc>:
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <fabs@plt>
test   %eax,%eax
jle    114e <cosc+0x2e>
movsd  (%rsp),%xmm0
call   1040 <cos@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
divsd  (%rsp),%xmm0
pop    %rax
ret
xorps  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @cosc(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @fabs(double %3)
%5 = sitofp i32 %4 to double
%6 = fcmp olt double %5, 1.000000e-10
br i1 %6, label %7, label %8
7: ; preds = %1
br label %15
8: ; preds = %1
%9 = load double, double* %2
%10 = call i32 @cos(double %9)
%11 = sub nsw i32 1, %10
%12 = sitofp i32 %11 to double
%13 = load double, double* %2
%14 = fdiv double %12, %13
br label %15
15: ; preds = %8, %7
%16 = phi double [ 0.000000e+00, %7 ], [ %14, %8 ]
ret double %16
}

LLVM IR (-O2):
define double @cosc(double %0) {
%2 = tail call i32 @fabs(double %0)
%3 = icmp slt i32 %2, 1
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = tail call i32 @cos(double %0)
%6 = sub nsw i32 1, %5
%7 = sitofp i32 %6 to double
%8 = fdiv double %7, %0
br label %9
9: ; preds = %1, %4
%10 = phi double [ %8, %4 ], [ 0.000000e+00, %1 ]
ret double %10
}
int skip_at_beginning(int id, const char *args) { return -1; }


x86 assembly (clang, -O0):
<skip_at_beginning>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @skip_at_beginning(i32 %0, i8* nocapture readnone %1) {
ret i32 -1
}
float invProd(float x, float y) { return x + y - x * y; }


x86 assembly (clang, -O0):
<invProd>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm1
addss  -0x8(%rbp),%xmm1
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<invProd>:
movaps %xmm0,%xmm2
addss  %xmm1,%xmm2
mulss  %xmm1,%xmm0
subss  %xmm0,%xmm2
movaps %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @invProd(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 = fadd float %5, %6
%8 = load float, float* %3
%9 = load float, float* %4
%10 = fneg float %8
%11 = call float @llvm.fmuladd.f32(float %10, float %9, float %7)
ret float %11
}

LLVM IR (-O2):
define float @invProd(float %0, float %1) {
%3 = fadd float %0, %1
%4 = fneg float %0
%5 = tail call float @llvm.fmuladd.f32(float %4, float %1, float %3)
ret float %5
}
int test_imm_D4int64_highword_reg(long long val) {
  return ((val >> 32) & (0xD4 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_D4int64_highword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x20,%rdx
and    $0xd4,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_D4int64_highword_reg>:
movabs $0xd400000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_D4int64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 32
%5 = and i64 %4, 212
%6 = icmp ne i64 %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_D4int64_highword_reg(i64 %0) {
%2 = and i64 %0, 910533066752
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ putchr(int /*<<< orphan*/);
void print_string(const char *buffer) {
  while (*buffer)
    putchr(*buffer++);
}


x86 assembly (clang, -O0):
<print_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <print_string+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <putchr@plt>
jmp    111c <print_string+0xc>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @print_string(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @putchr(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
int parse_recv_data(int len, char *data) {
  if (len <= 1)
    return len;
  if (data[0] == '$') {
    if (data[1] >= '0' && data[1] <= '9')
      return 101;
  }
  return 100;
}


x86 assembly (clang, -O0):
<parse_recv_data>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     1120 <parse_recv_data+0x20>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116a <parse_recv_data+0x6a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x24,%eax
jne    1163 <parse_recv_data+0x63>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x30,%eax
jl     115e <parse_recv_data+0x5e>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x39,%eax
jg     115e <parse_recv_data+0x5e>
movl   $0x65,-0x4(%rbp)
jmp    116a <parse_recv_data+0x6a>
jmp    1163 <parse_recv_data+0x63>
movl   $0x64,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_recv_data>:
mov    %edi,%eax
cmp    $0x2,%edi
jl     1121 <parse_recv_data+0x21>
cmpb   $0x24,(%rsi)
jne    111c <parse_recv_data+0x1c>
mov    0x1(%rsi),%cl
add    $0xd0,%cl
mov    $0x65,%eax
cmp    $0xa,%cl
jb     1121 <parse_recv_data+0x21>
mov    $0x64,%eax
ret

LLVM IR (-O0):
define i32 @parse_recv_data(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i32, i32* %4
%7 = icmp sle i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %4
store i32 %9, i32* %3
br label %31
10: ; preds = %2
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 36
br i1 %15, label %16, label %30
16: ; preds = %10
%17 = load i8*, i8** %5
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp sge i32 %20, 48
br i1 %21, label %22, label %29
22: ; preds = %16
%23 = load i8*, i8** %5
%24 = getelementptr inbounds i8, i8* %23, i64 1
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp sle i32 %26, 57
br i1 %27, label %28, label %29
28: ; preds = %22
store i32 101, i32* %3
br label %31
29: ; preds = %22, %16
br label %30
30: ; preds = %29, %10
store i32 100, i32* %3
br label %31
31: ; preds = %30, %28, %8
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
define i32 @parse_recv_data(i32 %0, i8* nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = load i8, i8* %1
%6 = icmp eq i8 %5, 36
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %1, i64 1
%9 = load i8, i8* %8
%10 = add i8 %9, -48
%11 = icmp ult i8 %10, 10
br i1 %11, label %13, label %12
12: ; preds = %7, %4
br label %13
13: ; preds = %7, %2, %12
%14 = phi i32 [ 100, %12 ], [ %0, %2 ], [ 101, %7 ]
ret i32 %14
}
int compare1(double **x, double **y) {
  if (x[0][1] < y[0][1])
    return -1;
  else if (x[0][1] > y[0][1])
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<compare1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movsd  0x8(%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    113a <compare1+0x3a>
movl   $0xffffffff,-0x4(%rbp)
jmp    116b <compare1+0x6b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
ucomisd 0x8(%rax),%xmm0
jbe    1164 <compare1+0x64>
movl   $0x1,-0x4(%rbp)
jmp    116b <compare1+0x6b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare1>:
mov    (%rdi),%rax
movsd  0x8(%rax),%xmm0
mov    (%rsi),%rax
movsd  0x8(%rax),%xmm1
xor    %ecx,%ecx
ucomisd %xmm1,%xmm0
seta   %cl
ucomisd %xmm0,%xmm1
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @compare1(double** %0, double** %1) {
%3 = alloca i32
%4 = alloca double**
%5 = alloca double**
store double** %0, double*** %4
store double** %1, double*** %5
%6 = load double**, double*** %4
%7 = getelementptr inbounds double*, double** %6, i64 0
%8 = load double*, double** %7
%9 = getelementptr inbounds double, double* %8, i64 1
%10 = load double, double* %9
%11 = load double**, double*** %5
%12 = getelementptr inbounds double*, double** %11, i64 0
%13 = load double*, double** %12
%14 = getelementptr inbounds double, double* %13, i64 1
%15 = load double, double* %14
%16 = fcmp olt double %10, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 -1, i32* %3
br label %32
18: ; preds = %2
%19 = load double**, double*** %4
%20 = getelementptr inbounds double*, double** %19, i64 0
%21 = load double*, double** %20
%22 = getelementptr inbounds double, double* %21, i64 1
%23 = load double, double* %22
%24 = load double**, double*** %5
%25 = getelementptr inbounds double*, double** %24, i64 0
%26 = load double*, double** %25
%27 = getelementptr inbounds double, double* %26, i64 1
%28 = load double, double* %27
%29 = fcmp ogt double %23, %28
br i1 %29, label %30, label %31
30: ; preds = %18
store i32 1, i32* %3
br label %32
31: ; preds = %18
store i32 0, i32* %3
br label %32
32: ; preds = %31, %30, %17
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
define i32 @compare1(double** nocapture %0, double** nocapture %1) {
%3 = load double*, double** %0
%4 = getelementptr inbounds double, double* %3, i64 1
%5 = load double, double* %4
%6 = load double*, double** %1
%7 = getelementptr inbounds double, double* %6, i64 1
%8 = load double, double* %7
%9 = fcmp olt double %5, %8
%10 = fcmp ogt double %5, %8
%11 = zext i1 %10 to i32
%12 = select i1 %9, i32 -1, i32 %11
ret i32 %12
}
char *disk_name(int disk) {
  if (disk & 0x80)
    return (disk & 1) ? "hdb" : "hda";
  return (disk & 1) ? "fdb" : "fda";
}


x86 assembly (clang, -O0):
<disk_name>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     113c <disk_name+0x3c>
mov    -0xc(%rbp),%edx
and    $0x1,%edx
lea    0xedf(%rip),%rax
lea    0xed4(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    115b <disk_name+0x5b>
mov    -0xc(%rbp),%edx
and    $0x1,%edx
lea    0xec3(%rip),%rax
lea    0xeb8(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<disk_name>:
test   $0x1,%dil
lea    0xef9(%rip),%rax
lea    0xeee(%rip),%rcx
cmove  %rax,%rcx
lea    0xeef(%rip),%rdx
lea    0xee4(%rip),%rax
cmove  %rdx,%rax
test   $0x80,%dil
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"hdb\00"
@.str.1 = [4 x i8] c"hda\00"
@.str.2 = [4 x i8] c"fdb\00"
@.str.3 = [4 x i8] c"fda\00"
define i8* @disk_name(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, 128
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %1
%8 = load i32, i32* %3
%9 = and i32 %8, 1
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i64
%12 = select i1 %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
store i8* %12, i8** %2
br label %19
13: ; preds = %1
%14 = load i32, i32* %3
%15 = and i32 %14, 1
%16 = icmp ne i32 %15, 0
%17 = zext i1 %16 to i64
%18 = select i1 %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
store i8* %18, i8** %2
br label %19
19: ; preds = %13, %7
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
@.str = [4 x i8] c"hdb\00"
@.str.1 = [4 x i8] c"hda\00"
@.str.2 = [4 x i8] c"fdb\00"
@.str.3 = [4 x i8] c"fda\00"
define i8* @disk_name(i32 %0) {
%2 = and i32 %0, 128
%3 = icmp eq i32 %2, 0
%4 = and i32 %0, 1
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
%7 = select i1 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%8 = select i1 %3, i8* %7, i8* %6
ret i8* %8
}