xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ cline(char *);
void cl_c(void) {
  cline("   stat = nc_close(ncid);");
  cline("   check_err(stat,__LINE__,__FILE__);");
  cline("   return 0;");
  cline("}");
}


x86 assembly (clang, -O0):
<cl_c>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <cline@plt>
lea    0xef3(%rip),%rdi
call   1030 <cline@plt>
lea    0xf0d(%rip),%rdi
call   1030 <cline@plt>
lea    0xf0e(%rip),%rdi
call   1030 <cline@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cl_c>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <cline@plt>
lea    0xef6(%rip),%rdi
call   1030 <cline@plt>
lea    0xf10(%rip),%rdi
call   1030 <cline@plt>
lea    0xf11(%rip),%rdi
pop    %rax
jmp    1030 <cline@plt>

LLVM IR (-O0):
@.str = [26 x i8] c" stat = nc_close(ncid);\00"
@.str.1 = [38 x i8] c" check_err(stat,__LINE__,__FILE__);\00"
@.str.2 = [13 x i8] c" return 0;\00"
@.str.3 = [2 x i8] c"}\00"
define void @cl_c() {
%1 = call i32 @cline(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @cline(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @cline(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @cline(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c" stat = nc_close(ncid);\00"
@.str.1 = [38 x i8] c" check_err(stat,__LINE__,__FILE__);\00"
@.str.2 = [13 x i8] c" return 0;\00"
@.str.3 = [2 x i8] c"}\00"
define void @cl_c() {
%1 = tail call i32 @cline(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @cline(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @cline(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @cline(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}
int usetc_(char *s, int c) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @usetc_(i8* nocapture readnone %0, i32 %1) {
ret i32 1
}
/* Variables and functions */
int FD_CLOEXEC;
int /*<<< orphan*/ F_GETFD;
int /*<<< orphan*/ F_SETFD;
int fcntl(int, int /*<<< orphan*/, int);
int set_cloexec(int fd) {
  int flags = fcntl(fd, F_GETFD, 0);
  flags |= FD_CLOEXEC;
  return fcntl(fd, F_SETFD, flags);
}


x86 assembly (clang, -O0):
<set_cloexec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eab(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea0(%rip),%rax
mov    (%rax),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e96(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
call   1030 <fcntl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_cloexec>:
push   %rbx
mov    %edi,%ebx
mov    0x2eb6(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    0x2eae(%rip),%rcx
or     (%rcx),%eax
mov    0x2ead(%rip),%rcx
mov    (%rcx),%esi
mov    %ebx,%edi
mov    %eax,%edx
pop    %rbx
jmp    1030 <fcntl@plt>

LLVM IR (-O0):
@F_GETFD = global i32 0
@FD_CLOEXEC = global i32 0
@F_SETFD = global i32 0
define i32 @set_cloexec(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @F_GETFD
%6 = call i32 @fcntl(i32 %4, i32 %5, i32 0)
store i32 %6, i32* %3
%7 = load i32, i32* @FD_CLOEXEC
%8 = load i32, i32* %3
%9 = or i32 %8, %7
store i32 %9, i32* %3
%10 = load i32, i32* %2
%11 = load i32, i32* @F_SETFD
%12 = load i32, i32* %3
%13 = call i32 @fcntl(i32 %10, i32 %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
@F_GETFD = global i32 0
@FD_CLOEXEC = global i32 0
@F_SETFD = global i32 0
define i32 @set_cloexec(i32 %0) {
%2 = load i32, i32* @F_GETFD
%3 = tail call i32 @fcntl(i32 %0, i32 %2, i32 0)
%4 = load i32, i32* @FD_CLOEXEC
%5 = or i32 %4, %3
%6 = load i32, i32* @F_SETFD
%7 = tail call i32 @fcntl(i32 %0, i32 %6, i32 %5)
ret i32 %7
}
/* Variables and functions */
double pow(double, int);
double test_func_5(double x) { return pow(x, 3) + x - 1; }


x86 assembly (clang, -O0):
<test_func_5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x3,%edi
call   1030 <pow@plt>
addsd  -0x8(%rbp),%xmm0
movsd  0xec7(%rip),%xmm1
subsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_func_5>:
push   %rax
movsd  %xmm0,(%rsp)
mov    $0x3,%edi
call   1030 <pow@plt>
addsd  (%rsp),%xmm0
addsd  0xed3(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @test_func_5(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @pow(double %3, i32 3)
%5 = load double, double* %2
%6 = fadd double %4, %5
%7 = fsub double %6, 1.000000e+00
ret double %7
}

LLVM IR (-O2):
define double @test_func_5(double %0) {
%2 = tail call double @pow(double %0, i32 3)
%3 = fadd double %2, %0
%4 = fadd double %3, -1.000000e+00
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void f(int one) {
  if (one != 1)
    abort();
}


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

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

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

LLVM IR (-O2):
define void @f(i32 %0) {
%2 = icmp eq i32 %0, 1
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
ret void
}
/* Type definitions */
struct timeval {
  unsigned int tv_sec;
  unsigned int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, struct timeval *);
void msleep(unsigned int msecs) {
  struct timeval timeout;
  timeout.tv_sec = msecs / 1000;
  timeout.tv_usec = (msecs % 1000) * 1000;
  select(1, NULL, NULL, NULL, &timeout);
}


x86 assembly (clang, -O0):
<msleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %ecx
imul   $0x3e8,%edx,%eax
mov    %eax,-0xc(%rbp)
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x10(%rbp),%r8
mov    %rcx,%rsi
mov    %rcx,%rdx
call   1030 <select@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msleep>:
push   %rax
mov    %edi,%eax
imul   $0x10624dd3,%rax,%rax
shr    $0x26,%rax
mov    %eax,(%rsp)
imul   $0x3e8,%eax,%eax
sub    %eax,%edi
imul   $0x3e8,%edi,%eax
mov    %eax,0x4(%rsp)
mov    %rsp,%r8
mov    $0x1,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <select@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define void @msleep(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timeval
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = udiv i32 %4, 1000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
store i32 %5, i32* %6
%7 = load i32, i32* %2
%8 = urem i32 %7, 1000
%9 = mul i32 %8, 1000
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
store i32 %9, i32* %10
%11 = call i32 @select(i32 1, i32* null, i32* null, i32* null, %struct.timeval* %3)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define void @msleep(i32 %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = udiv i32 %0, 1000
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
store i32 %4, i32* %5
%6 = urem i32 %0, 1000
%7 = mul nuw nsw i32 %6, 1000
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
store i32 %7, i32* %8
%9 = call i32 @select(i32 1, i32* null, i32* null, i32* null, %struct.timeval* %2)
ret void
}
int test_local(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @test_local() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ BIGNUM;

/* Variables and functions */
char *BN_bn2hex(int /*<<< orphan*/ *);
int /*<<< orphan*/ OPENSSL_free(char *);
unsigned char *pack(unsigned char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
unsigned char *simplePack(unsigned char *buffer_in, BIGNUM *bn) {
  char tempbuf[1024];
  char *s = BN_bn2hex(bn);
  sprintf(tempbuf, "%s", s);
  OPENSSL_free(s);
  unsigned char *next = pack(buffer_in, tempbuf);
  return next;
}


x86 assembly (clang, -O0):
<simplePack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <BN_bn2hex@plt>
mov    %rax,-0x418(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x418(%rbp),%rdx
lea    0xe88(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x418(%rbp),%rdi
call   1050 <OPENSSL_free@plt>
mov    -0x8(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1030 <pack@plt>
mov    %rax,-0x420(%rbp)
mov    -0x420(%rbp),%rax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<simplePack>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rdi,%r14
mov    %rsi,%rdi
call   1050 <BN_bn2hex@plt>
mov    %rax,%rbx
mov    %rsp,%r15
mov    %r15,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1060 <OPENSSL_free@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <pack@plt>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i8* @simplePack(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca [1024 x i8]
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %3
store i32* %1, i32** %4
%8 = load i32*, i32** %4
%9 = call i8* @BN_bn2hex(i32* %8)
store i8* %9, i8** %6
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%11 = load i8*, i8** %6
%12 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = load i8*, i8** %6
%14 = call i32 @OPENSSL_free(i8* %13)
%15 = load i8*, i8** %3
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%17 = call i8* @pack(i8* %15, i8* %16)
store i8* %17, i8** %7
%18 = load i8*, i8** %7
ret i8* %18
}

LLVM IR (-O2):
define i8* @simplePack(i8* %0, i32* %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = tail call i8* @BN_bn2hex(i32* %1)
%6 = call i8* @strcpy(i8* %4, i8* dereferenceable(1) %5)
%7 = call i32 @OPENSSL_free(i8* %5)
%8 = call i8* @pack(i8* %0, i8* %4)
ret i8* %8
}
long labs(long x) { return x < 0 ? -x : x; }


x86 assembly (clang, -O0):
<labs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1122 <labs+0x22>
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    112a <labs+0x2a>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @labs(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i64, i64* %2
%7 = sub nsw i64 0, %6
br label %10
8: ; preds = %1
%9 = load i64, i64* %2
br label %10
10: ; preds = %8, %5
%11 = phi i64 [ %7, %5 ], [ %9, %8 ]
ret i64 %11
}

LLVM IR (-O2):
define i64 @labs(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
ret i64 %2
}
void swap(int *vet, int j, int k) {
  double c;
  c = vet[j];
  vet[j] = vet[k];
  vet[k] = c;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
cvttsd2si -0x18(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

LLVM IR (-O0):
define void @swap(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32*, i32** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = load i32, i32* %11
%13 = sitofp i32 %12 to double
store double %13, double* %7
%14 = load i32*, i32** %4
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = load i32*, i32** %4
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %19, i64 %21
store i32 %18, i32* %22
%23 = load double, double* %7
%24 = fptosi double %23 to i32
%25 = load i32*, i32** %4
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
store i32 %24, i32* %28
ret void
}

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}
extern double PassDouble(double *dbl) { return *dbl; }


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

x86 assembly (clang, -O2):
<PassDouble>:
movsd  (%rdi),%xmm0
ret

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

LLVM IR (-O2):
define double @PassDouble(double* nocapture %0) {
%2 = load double, double* %0
ret double %2
}
_Bool db_count_furnish(int c, int t) {
  if (db_count_exists(c, t))
    return 0;
  db_count_insert(c, t);
  return 1;
}


x86 assembly (clang, -O0):
<db_count_furnish>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1030 <db_count_exists@plt>
cmp    $0x0,%eax
je     114d <db_count_furnish+0x2d>
movb   $0x0,-0x1(%rbp)
jmp    115e <db_count_furnish+0x3e>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1040 <db_count_insert@plt>
movb   $0x1,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db_count_furnish>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <db_count_exists@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    1142 <db_count_furnish+0x22>
mov    %ebp,%edi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <db_count_insert@plt>
test   %ebx,%ebx
sete   %al
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define zeroext i1 @db_count_furnish(i32 %0, i32 %1) {
%3 = alloca i1
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = call i32 (i32, i32, ...) bitcast (i32 (...)* @db_count_exists to i32 (i32, i32, ...)*)(i32 %6, i32 %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i1 false, i1* %3
br label %15
11: ; preds = %2
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = call i32 (i32, i32, ...) bitcast (i32 (...)* @db_count_insert to i32 (i32, i32, ...)*)(i32 %12, i32 %13)
store i1 true, i1* %3
br label %15
15: ; preds = %11, %10
%16 = load i1, i1* %3
ret i1 %16
}

LLVM IR (-O2):
define zeroext i1 @db_count_furnish(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @db_count_exists to i32 (i32, i32, ...)*)(i32 %0, i32 %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @db_count_insert to i32 (i32, i32, ...)*)(i32 %0, i32 %1)
br label %7
7: ; preds = %2, %5
ret i1 %4
}
__attribute__((always_)) int f1(int *p) { return *p; }


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

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

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

LLVM IR (-O2):
define i32 @f1(i32* nocapture %0) {
%2 = load i32, i32* %0
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void raise(char *error_msg) { printf("Raise Error:\n\t%s\n", error_msg); }


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

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

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

LLVM IR (-O2):
@.str = [18 x i8] c"Raise Error:\0A\09%s\0A\00"
define void @raise(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
char *monte_ivar_name(char *param, long pos) {
  switch (pos) {
  case 0:
    return ("var1");
    break;
  case 1:
    return ("var2");
    break;
  case 2:
    return ("var3");
    break;
  default:
    return ("empty");
  }
  return ("empty");
}


x86 assembly (clang, -O0):
<monte_ivar_name>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
test   %rax,%rax
je     1148 <monte_ivar_name+0x48>
jmp    1122 <monte_ivar_name+0x22>
mov    -0x20(%rbp),%rax
sub    $0x1,%rax
je     1158 <monte_ivar_name+0x58>
jmp    1135 <monte_ivar_name+0x35>
mov    -0x20(%rbp),%rax
sub    $0x2,%rax
je     1168 <monte_ivar_name+0x68>
jmp    1178 <monte_ivar_name+0x78>
lea    0xeb1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1183 <monte_ivar_name+0x83>
lea    0xea6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1183 <monte_ivar_name+0x83>
lea    0xe9b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1183 <monte_ivar_name+0x83>
lea    0xe90(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<monte_ivar_name>:
cmp    $0x2,%rsi
ja     1115 <monte_ivar_name+0x15>
lea    0xf0b(%rip),%rcx
movslq (%rcx,%rsi,4),%rax
add    %rcx,%rax
ret
lea    0xef3(%rip),%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"var1\00"
@.str.1 = [5 x i8] c"var2\00"
@.str.2 = [5 x i8] c"var3\00"
@.str.3 = [6 x i8] c"empty\00"
define i8* @monte_ivar_name(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
%6 = load i64, i64* %5
switch i64 %6, label %10 [
i64 0, label %7
i64 1, label %8
i64 2, label %9
]
7: ; preds = %2
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %3
br label %11
8: ; preds = %2
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %11
9: ; preds = %2
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %11
10: ; preds = %2
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %11
11: ; preds = %10, %9, %8, %7
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@.str = [5 x i8] c"var1\00"
@.str.1 = [5 x i8] c"var2\00"
@.str.2 = [5 x i8] c"var3\00"
@.str.3 = [6 x i8] c"empty\00"
@reltable.monte_ivar_name = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.monte_ivar_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.monte_ivar_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.monte_ivar_name to i64)) to i32)]
define i8* @monte_ivar_name(i8* nocapture readnone %0, i64 %1) {
%3 = icmp ult i64 %1, 3
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = shl i64 %1, 2
%6 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.monte_ivar_name to i8*), i64 %5)
br label %7
7: ; preds = %2, %4
%8 = phi i8* [ %6, %4 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %2 ]
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ gzclose(void *);
void gz_file_handler_close(void *file) { gzclose(file); }


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

x86 assembly (clang, -O2):
<gz_file_handler_close>:
jmp    1030 <gzclose@plt>

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

LLVM IR (-O2):
define void @gz_file_handler_close(i8* %0) {
%2 = tail call i32 @gzclose(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ afficher_zone(void *, size_t, int /*<<< orphan*/);
void afficher_zone_occupee(void *adresse, size_t taille, int free) {
  if (!free)
    afficher_zone(adresse, taille, 0);
}


x86 assembly (clang, -O0):
<afficher_zone_occupee>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    113c <afficher_zone_occupee+0x2c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1030 <afficher_zone@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<afficher_zone_occupee>:
test   %edx,%edx
je     1115 <afficher_zone_occupee+0x5>
ret
xor    %edx,%edx
jmp    1030 <afficher_zone@plt>

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

LLVM IR (-O2):
define void @afficher_zone_occupee(i8* %0, i64 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @afficher_zone(i8* %0, i64 %1, i32 0)
br label %7
7: ; preds = %5, %3
ret void
}
int compare_x_desc(const void *p1, const void *p2) {
  double x1 = **(double **)p1;
  double x2 = **(double **)p2;
  if (x1 != x2)
    return (x1 > x2) ? -1 : 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<compare_x_desc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jne    1147 <compare_x_desc+0x47>
jp     1147 <compare_x_desc+0x47>
jmp    116a <compare_x_desc+0x6a>
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mov    $0x1,%eax
mov    $0xffffffff,%ecx
ucomisd %xmm1,%xmm0
cmova  %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1171 <compare_x_desc+0x71>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_x_desc>:
mov    (%rdi),%rax
movsd  (%rax),%xmm0
mov    (%rsi),%rcx
xor    %eax,%eax
xor    %edx,%edx
ucomisd (%rcx),%xmm0
setbe  %dl
lea    -0x1(%rdx,%rdx,1),%ecx
cmovne %ecx,%eax
cmovp  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @compare_x_desc(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double
%7 = alloca double
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to double**
%10 = load double*, double** %9
%11 = load double, double* %10
store double %11, double* %6
%12 = load i8*, i8** %5
%13 = bitcast i8* %12 to double**
%14 = load double*, double** %13
%15 = load double, double* %14
store double %15, double* %7
%16 = load double, double* %6
%17 = load double, double* %7
%18 = fcmp une double %16, %17
br i1 %18, label %19, label %25
19: ; preds = %2
%20 = load double, double* %6
%21 = load double, double* %7
%22 = fcmp ogt double %20, %21
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 -1, i32 1
store i32 %24, i32* %3
br label %26
25: ; preds = %2
store i32 0, i32* %3
br label %26
26: ; preds = %25, %19
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @compare_x_desc(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double**
%4 = load double*, double** %3
%5 = load double, double* %4
%6 = bitcast i8* %1 to double**
%7 = load double*, double** %6
%8 = load double, double* %7
%9 = fcmp une double %5, %8
%10 = fcmp ogt double %5, %8
%11 = select i1 %10, i32 -1, i32 1
%12 = select i1 %9, i32 %11, i32 0
ret i32 %12
}
/* Variables and functions */
int f412(int *);
int f413(int *p) { return f412(p); }


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

x86 assembly (clang, -O2):
<f413>:
jmp    1030 <f412@plt>

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

LLVM IR (-O2):
define i32 @f413(i32* %0) {
%2 = tail call i32 @f412(i32* %0)
ret i32 %2
}
/* Type definitions */
struct sockaddr_un {
  int dummy;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ sa;

/* Variables and functions */
int ez_net_tcp_generic_accept(int, struct sockaddr *, int *);
int ez_net_unix_accept(int s) {
  int fd;
  struct sockaddr_un sa;
  socklen_t salen = sizeof(sa);
  fd = ez_net_tcp_generic_accept(s, (struct sockaddr *)&sa, &salen);
  if (fd < 0)
    return -1;
  return fd;
}


x86 assembly (clang, -O0):
<ez_net_unix_accept>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x4,-0x14(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <ez_net_tcp_generic_accept@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    114b <ez_net_unix_accept+0x3b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1151 <ez_net_unix_accept+0x41>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ez_net_unix_accept>:
sub    $0x18,%rsp
movl   $0x4,0xc(%rsp)
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1030 <ez_net_tcp_generic_accept@plt>
test   %eax,%eax
mov    $0xffffffff,%ecx
cmovs  %ecx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.sockaddr_un = type { i32 }
%struct.sockaddr = type { i32 }
define i32 @ez_net_unix_accept(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.sockaddr_un
%6 = alloca i32
store i32 %0, i32* %3
store i32 4, i32* %6
%7 = load i32, i32* %3
%8 = bitcast %struct.sockaddr_un* %5 to %struct.sockaddr*
%9 = call i32 @ez_net_tcp_generic_accept(i32 %7, %struct.sockaddr* %8, i32* %6)
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %1
store i32 -1, i32* %2
br label %15
13: ; preds = %1
%14 = load i32, i32* %4
store i32 %14, i32* %2
br label %15
15: ; preds = %13, %12
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
%struct.sockaddr_un = type { i32 }
%struct.sockaddr = type { i32 }
define i32 @ez_net_unix_accept(i32 %0) {
%2 = alloca %struct.sockaddr_un
%3 = alloca i32
%4 = bitcast %struct.sockaddr_un* %2 to i8*
%5 = bitcast i32* %3 to i8*
store i32 4, i32* %3
%6 = bitcast %struct.sockaddr_un* %2 to %struct.sockaddr*
%7 = call i32 @ez_net_tcp_generic_accept(i32 %0, %struct.sockaddr* %6, i32* %3)
%8 = icmp sgt i32 %7, -1
%9 = select i1 %8, i32 %7, i32 -1
ret i32 %9
}
void init_actomyosin(double *m, int n) {
  int i;
  for (i = 0; i < n; i++) {
  }
}


x86 assembly (clang, -O0):
<init_actomyosin>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1131 <init_actomyosin+0x31>
jmp    1123 <init_actomyosin+0x23>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <init_actomyosin+0x12>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @init_actomyosin(double* nocapture %0, i32 %1) {
ret void
}
void foo_2_1_1_2_2_1_1_1_1() {}


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

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

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

LLVM IR (-O2):
define void @foo_2_1_1_2_2_1_1_1_1() {
ret void
}
long lt(unsigned long a, unsigned long b) { return a < b; }


x86 assembly (clang, -O0):
<lt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
setb   %al
and    $0x1,%al
movzbl %al,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<lt>:
xor    %eax,%eax
cmp    %rsi,%rdi
setb   %al
ret

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

LLVM IR (-O2):
define i64 @lt(i64 %0, i64 %1) {
%3 = icmp ult i64 %0, %1
%4 = zext i1 %3 to i64
ret i64 %4
}
/* Variables and functions */
void *malloc(int);
void *hl_gc_alloc_finalizer(int size) { return malloc(size); }


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

x86 assembly (clang, -O2):
<hl_gc_alloc_finalizer>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @hl_gc_alloc_finalizer(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
ret i8* %2
}
/* Type definitions */
struct timeval {
  int tv_sec;
  long tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
long epoch_time() {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return tv.tv_sec * 1000000 + tv.tv_usec;
}


x86 assembly (clang, -O0):
<epoch_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,-0x10(%rbp),%eax
cltq
add    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<epoch_time>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movslq 0x8(%rsp),%rax
imul   $0xf4240,%rax,%rax
add    0x10(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define i64 @epoch_time() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = mul nsw i32 %4, 1000000
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%8 = load i64, i64* %7
%9 = add nsw i64 %6, %8
ret i64 %9
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define i64 @epoch_time() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000000
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%9 = load i64, i64* %8
%10 = add nsw i64 %9, %7
ret i64 %10
}
/* Variables and functions */
void HUlib_init(void) {}


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

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

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

LLVM IR (-O2):
define void @HUlib_init() {
ret void
}
int getPseudoRandom(int Z, int L, int I, int M) {
  return (((Z * L) % M) + I % M) % M;
}


x86 assembly (clang, -O0):
<getPseudoRandom>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    -0x14(%rbp),%eax
add    %edx,%eax
cltd
idivl  -0x10(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getPseudoRandom>:
mov    %edx,%r8d
mov    %edi,%eax
imul   %esi,%eax
cltd
idiv   %ecx
mov    %edx,%esi
mov    %r8d,%eax
cltd
idiv   %ecx
add    %edx,%esi
mov    %esi,%eax
cltd
idiv   %ecx
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @getPseudoRandom(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = mul nsw i32 %9, %10
%12 = load i32, i32* %8
%13 = srem i32 %11, %12
%14 = load i32, i32* %7
%15 = load i32, i32* %8
%16 = srem i32 %14, %15
%17 = add nsw i32 %13, %16
%18 = load i32, i32* %8
%19 = srem i32 %17, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @getPseudoRandom(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = mul nsw i32 %1, %0
%6 = srem i32 %5, %3
%7 = srem i32 %2, %3
%8 = add nsw i32 %7, %6
%9 = srem i32 %8, %3
ret i32 %9
}
/* Variables and functions */
unsigned int exynos_5410_gpio_read(unsigned int);
int /*<<< orphan*/ exynos_5410_gpio_write_mask(unsigned int, unsigned int,
                                               unsigned int);
void odroid_xu_gpio_toggle_20() {
  unsigned int bank_offset = 0x0C40;
  unsigned int bit_index = 4;
  unsigned int d = exynos_5410_gpio_read(bank_offset);
  d ^= (1U << bit_index);
  exynos_5410_gpio_write_mask(bank_offset, d, (1U << bit_index));
}


x86 assembly (clang, -O0):
<odroid_xu_gpio_toggle_20>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xc40,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <exynos_5410_gpio_read@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
call   1030 <exynos_5410_gpio_write_mask@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<odroid_xu_gpio_toggle_20>:
push   %rax
mov    $0xc40,%edi
call   1040 <exynos_5410_gpio_read@plt>
xor    $0x10,%eax
mov    $0xc40,%edi
mov    %eax,%esi
mov    $0x10,%edx
pop    %rax
jmp    1030 <exynos_5410_gpio_write_mask@plt>

LLVM IR (-O0):
define void @odroid_xu_gpio_toggle_20() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 3136, i32* %1
store i32 4, i32* %2
%4 = load i32, i32* %1
%5 = call i32 @exynos_5410_gpio_read(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = shl i32 1, %6
%8 = load i32, i32* %3
%9 = xor i32 %8, %7
store i32 %9, i32* %3
%10 = load i32, i32* %1
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = shl i32 1, %12
%14 = call i32 @exynos_5410_gpio_write_mask(i32 %10, i32 %11, i32 %13)
ret void
}

LLVM IR (-O2):
define void @odroid_xu_gpio_toggle_20() {
%1 = tail call i32 @exynos_5410_gpio_read(i32 3136)
%2 = xor i32 %1, 16
%3 = tail call i32 @exynos_5410_gpio_write_mask(i32 3136, i32 %2, i32 16)
ret void
}
int __IsNan(double d) {
  float f = d;
  if ((*((long *)&f) & 0x7f800000) == 0x7f800000 &&
      (*((long *)&f) & 0x007fffff) != 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<__IsNan>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x14(%rbp),%rax
and    $0x7f800000,%rax
cmp    $0x7f800000,%rax
jne    114d <__IsNan+0x4d>
mov    -0x14(%rbp),%rax
and    $0x7fffff,%rax
cmp    $0x0,%rax
je     114d <__IsNan+0x4d>
movl   $0x1,-0x4(%rbp)
jmp    1154 <__IsNan+0x54>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__IsNan>:
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rsp)
mov    -0x8(%rsp),%rax
mov    %eax,%ecx
not    %ecx
test   $0x7f800000,%ecx
sete   %cl
test   $0x7fffff,%eax
setne  %al
and    %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @__IsNan(double %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca float
store double %0, double* %3
%5 = load double, double* %3
%6 = fptrunc double %5 to float
store float %6, float* %4
%7 = bitcast float* %4 to i64*
%8 = load i64, i64* %7
%9 = and i64 %8, 2139095040
%10 = icmp eq i64 %9, 2139095040
br i1 %10, label %11, label %17
11: ; preds = %1
%12 = bitcast float* %4 to i64*
%13 = load i64, i64* %12
%14 = and i64 %13, 8388607
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %11
store i32 1, i32* %2
br label %18
17: ; preds = %11, %1
store i32 0, i32* %2
br label %18
18: ; preds = %17, %16
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @__IsNan(double %0) {
%2 = alloca float
%3 = bitcast float* %2 to i8*
%4 = fptrunc double %0 to float
store float %4, float* %2
%5 = bitcast float* %2 to i64*
%6 = load i64, i64* %5
%7 = and i64 %6, 2139095040
%8 = icmp eq i64 %7, 2139095040
%9 = and i64 %6, 8388607
%10 = icmp ne i64 %9, 0
%11 = and i1 %8, %10
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ puts(char *);
void usage() {
  puts("de-assemmble CHIPcon and SCHIP/CHIP-8 programs.");
  puts("USAGE: cc-dasm chip_file asm_file");
  puts("chip_file is binary CHIPcon, CHIP-8 or SCHIP file.");
  puts("asm_file  is name of output file.");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
lea    0xef9(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0f(%rip),%rdi
call   1030 <puts@plt>
lea    0xf36(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xefc(%rip),%rdi
call   1030 <puts@plt>
lea    0xf12(%rip),%rdi
call   1030 <puts@plt>
lea    0xf39(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"de-assemmble CHIPcon and SCHIP/CHIP-8 programs.\00"
@.str.1 = [34 x i8] c"USAGE: cc-dasm chip_file asm_file\00"
@.str.2 = [51 x i8] c"chip_file is binary CHIPcon, CHIP-8 or SCHIP file.\00"
@.str.3 = [34 x i8] c"asm_file is name of output file.\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = call i32 @puts(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @puts(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @puts(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @puts(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%5 = load i32, i32* @EXIT_FAILURE
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@.str = [48 x i8] c"de-assemmble CHIPcon and SCHIP/CHIP-8 programs.\00"
@.str.1 = [34 x i8] c"USAGE: cc-dasm chip_file asm_file\00"
@.str.2 = [51 x i8] c"chip_file is binary CHIPcon, CHIP-8 or SCHIP file.\00"
@.str.3 = [34 x i8] c"asm_file is name of output file.\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%5 = load i32, i32* @EXIT_FAILURE
%6 = tail call i32 @exit(i32 %5)
unreachable
}
void foo(int x) {
bad1:
#pragma omp target teams
  goto bad1;
  goto bad2;
#pragma omp target teams
  {
  bad2:;
  }
#pragma omp target teams
  {
    int i;
    goto ok1;
    for (i = 0; i < 10; ++i) {
    ok1:
      break;
    }
  }
  switch (x) {
#pragma omp target teams
    { case 0:; }
  }
}


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

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

LLVM IR (-O0):
define void @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
br label %4
4: ; preds = %4, %1
br label %4
5: ; No predecessors!
br label %11
6: ; No predecessors!
store i32 0, i32* %3
br label %7
7: ; preds = %12, %6
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %15
10: ; preds = %7
br label %11
11: ; preds = %10, %5
br label %15
12: ; No predecessors!
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %7
15: ; preds = %11, %7
%16 = load i32, i32* %2
switch i32 %16, label %18 [
i32 0, label %17
]
17: ; preds = %15
br label %18
18: ; preds = %17, %15
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
/* Type definitions */
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
int bind(int, struct sockaddr const *, int /*<<< orphan*/);
int /*<<< orphan*/ perr_exit(char *);
int Bind(int fd, const struct sockaddr *sa, socklen_t salen) {
  int n;
  if ((n = bind(fd, sa, salen)) < 0)
    perr_exit("bind error");
  return n;
}


x86 assembly (clang, -O0):
<Bind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <bind@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    1159 <Bind+0x39>
lea    0xeac(%rip),%rdi
call   1040 <perr_exit@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Bind>:
push   %rbx
call   1030 <bind@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1138 <Bind+0x18>
lea    0xecd(%rip),%rdi
call   1040 <perr_exit@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@.str = [11 x i8] c"bind error\00"
define i32 @Bind(i32 %0, %struct.sockaddr* %1, i32 %2) {
%4 = tail call i32 @bind(i32 %0, %struct.sockaddr* %1, i32 %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @perr_exit(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ nums;

/* Variables and functions */
int /*<<< orphan*/ merge_sort(int *, int);
int /*<<< orphan*/ print_int_array(char *, int *, int);
int main(int argc, char *argv[]) {
  int nums[] = {5, 2, 4, 7, 1, 3, 2, 6};
  extern int n;
  n = (sizeof(nums) / sizeof(nums[0]));
  merge_sort(nums, n - 1);
  print_int_array("Sorted nums:  ", nums, n);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec1(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2e7e(%rip),%rax
movl   $0x8,(%rax)
lea    -0x30(%rbp),%rdi
mov    0x2e6d(%rip),%rax
mov    (%rax),%esi
sub    $0x1,%esi
call   1030 <merge_sort@plt>
lea    -0x30(%rbp),%rsi
mov    0x2e58(%rip),%rax
mov    (%rax),%edx
lea    0xe8f(%rip),%rdi
call   1040 <print_int_array@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movaps 0xee2(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec6(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    0x2e9b(%rip),%rbx
movl   $0x8,(%rbx)
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x7,%esi
call   1030 <merge_sort@plt>
mov    (%rbx),%edx
lea    0xebc(%rip),%rdi
mov    %r14,%rsi
call   1040 <print_int_array@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.nums = [8 x i32] [i32 5, i32 2, i32 4, i32 7, i32 1, i32 3, i32 2, i32 6]
@n = external global i32
@.str = [15 x i8] c"Sorted nums: \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [8 x i32]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = bitcast [8 x i32]* %5 to i8*
store i32 8, i32* @n
%7 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 0
%8 = load i32, i32* @n
%9 = sub nsw i32 %8, 1
%10 = call i32 @merge_sort(i32* %7, i32 %9)
%11 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 0
%12 = load i32, i32* @n
%13 = call i32 @print_int_array(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* %11, i32 %12)
ret i32 0
}

LLVM IR (-O2):
@__const.main.nums = [8 x i32] [i32 5, i32 2, i32 4, i32 7, i32 1, i32 3, i32 2, i32 6]
@n = external global i32
@.str = [15 x i8] c"Sorted nums: \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [8 x i32]
%4 = bitcast [8 x i32]* %3 to i8*
store i32 8, i32* @n
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%6 = call i32 @merge_sort(i32* %5, i32 7)
%7 = load i32, i32* @n
%8 = call i32 @print_int_array(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* %5, i32 %7)
ret i32 0
}