xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ bar(int);
void foo(int x) {
  switch (x)
    ;
  bar(x);
}


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

x86 assembly (clang, -O2):
<foo>:
jmp    1030 <bar@plt>

LLVM IR (-O0):
define void @foo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %4 [
]
4: ; preds = %1
%5 = load i32, i32* %2
%6 = call i32 @bar(i32 %5)
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0) {
%2 = tail call i32 @bar(i32 %0)
ret void
}
/* Variables and functions */
void glmCompMult3fs(float out[3], const float x[3], float y) {
  for (size_t i = 0; i < 3; ++i)
    out[i] = x[i] * y;
}


x86 assembly (clang, -O0):
<glmCompMult3fs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x3,-0x20(%rbp)
jae    1154 <glmCompMult3fs+0x54>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mulss  -0x14(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1119 <glmCompMult3fs+0x19>
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmCompMult3fs>:
movss  (%rsi),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,(%rdi)
movss  0x4(%rsi),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,0x4(%rdi)
mulss  0x8(%rsi),%xmm0
movss  %xmm0,0x8(%rdi)
ret

LLVM IR (-O0):
define void @glmCompMult3fs(float* %0, float* %1, float %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float
%7 = alloca i64
store float* %0, float** %4
store float* %1, float** %5
store float %2, float* %6
store i64 0, i64* %7
br label %8
8: ; preds = %21, %3
%9 = load i64, i64* %7
%10 = icmp ult i64 %9, 3
br i1 %10, label %11, label %24
11: ; preds = %8
%12 = load float*, float** %5
%13 = load i64, i64* %7
%14 = getelementptr inbounds float, float* %12, i64 %13
%15 = load float, float* %14
%16 = load float, float* %6
%17 = fmul float %15, %16
%18 = load float*, float** %4
%19 = load i64, i64* %7
%20 = getelementptr inbounds float, float* %18, i64 %19
store float %17, float* %20
br label %21
21: ; preds = %11
%22 = load i64, i64* %7
%23 = add i64 %22, 1
store i64 %23, i64* %7
br label %8
24: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @glmCompMult3fs(float* nocapture writeonly %0, float* nocapture %1, float %2) {
%4 = load float, float* %1
%5 = fmul float %4, %2
store float %5, float* %0
%6 = getelementptr inbounds float, float* %1, i64 1
%7 = load float, float* %6
%8 = fmul float %7, %2
%9 = getelementptr inbounds float, float* %0, i64 1
store float %8, float* %9
%10 = getelementptr inbounds float, float* %1, i64 2
%11 = load float, float* %10
%12 = fmul float %11, %2
%13 = getelementptr inbounds float, float* %0, i64 2
store float %12, float* %13
ret void
}
/* Variables and functions */
float coulomb_elem(char, char);
float kinetic_elem(char, char);
float hamiltonian_elem(char i, char j) {
  return coulomb_elem(i, j) + kinetic_elem(i, j);
}


x86 assembly (clang, -O0):
<hamiltonian_elem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    -0x1(%rbp),%al
movsbl %al,%edi
movsbl -0x2(%rbp),%esi
call   1030 <coulomb_elem@plt>
movss  %xmm0,-0x8(%rbp)
mov    -0x1(%rbp),%al
movsbl %al,%edi
movsbl -0x2(%rbp),%esi
call   1040 <kinetic_elem@plt>
movaps %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
addss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hamiltonian_elem>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <coulomb_elem@plt>
movss  %xmm0,0x4(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <kinetic_elem@plt>
addss  0x4(%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define float @hamiltonian_elem(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = load i8, i8* %4
%7 = call float @coulomb_elem(i8 signext %5, i8 signext %6)
%8 = load i8, i8* %3
%9 = load i8, i8* %4
%10 = call float @kinetic_elem(i8 signext %8, i8 signext %9)
%11 = fadd float %7, %10
ret float %11
}

LLVM IR (-O2):
define float @hamiltonian_elem(i8 signext %0, i8 signext %1) {
%3 = tail call float @coulomb_elem(i8 signext %0, i8 signext %1)
%4 = tail call float @kinetic_elem(i8 signext %0, i8 signext %1)
%5 = fadd float %3, %4
ret float %5
}
int dblRevCmp(const void *f1, const void *f2) {
  return (*((double *)f1) > *((double *)f2)   ? 1
          : *((double *)f1) < *((double *)f2) ? -1
                                              : 0);
}


x86 assembly (clang, -O0):
<dblRevCmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    112f <dblRevCmp+0x2f>
mov    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1150 <dblRevCmp+0x50>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
xor    %eax,%eax
mov    $0xffffffff,%ecx
ucomisd %xmm1,%xmm0
cmova  %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @dblRevCmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fcmp ogt double %4, %6
%8 = fcmp olt double %4, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
/* Type definitions */
struct timeval {
  int tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
unsigned long cur_time_millis(void) {
  struct timeval timeval;
  gettimeofday(&timeval, NULL);
  return (long)timeval.tv_sec * 1000 + (timeval.tv_usec / 1000);
}


x86 assembly (clang, -O0):
<cur_time_millis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,-0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cur_time_millis>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,0x10(%rsp),%rcx
movslq 0x8(%rsp),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
cltq
add    %rcx,%rax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define i64 @cur_time_millis() {
%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 1
%5 = load i64, i64* %4
%6 = mul nsw i64 %5, 1000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 1000
%10 = sext i32 %9 to i64
%11 = add nsw i64 %6, %10
ret i64 %11
}
/* Type definitions */
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
int ab_accept4(int, struct sockaddr *, int /*<<< orphan*/ *,
               int /*<<< orphan*/);
int ab_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen) {
  return ab_accept4(sockfd, addr, addrlen, 0);
}


x86 assembly (clang, -O0):
<ab_accept>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
xor    %ecx,%ecx
call   1030 <ab_accept4@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ab_accept>:
xor    %ecx,%ecx
jmp    1030 <ab_accept4@plt>

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
define i32 @ab_accept(i32 %0, %struct.sockaddr* %1, i32* %2) {
%4 = alloca i32
%5 = alloca %struct.sockaddr*
%6 = alloca i32*
store i32 %0, i32* %4
store %struct.sockaddr* %1, %struct.sockaddr** %5
store i32* %2, i32** %6
%7 = load i32, i32* %4
%8 = load %struct.sockaddr*, %struct.sockaddr** %5
%9 = load i32*, i32** %6
%10 = call i32 @ab_accept4(i32 %7, %struct.sockaddr* %8, i32* %9, i32 0)
ret i32 %10
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
define i32 @ab_accept(i32 %0, %struct.sockaddr* %1, i32* %2) {
%4 = tail call i32 @ab_accept4(i32 %0, %struct.sockaddr* %1, i32* %2, i32 0)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, const char *argv[]) {
  printf("hello world!\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"hello world!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [13 x i8] c"hello world!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int PAPI_stop(int, long long *);
void PAPIF_STOP(int *EventSet, long long *values, int *check) {
  *check = PAPI_stop(*EventSet, values);
}


x86 assembly (clang, -O0):
<PAPIF_STOP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
call   1030 <PAPI_stop@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PAPIF_STOP>:
push   %rbx
mov    %rdx,%rbx
mov    (%rdi),%edi
call   1030 <PAPI_stop@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @PAPIF_STOP(i32* nocapture %0, i64* %1, i32* nocapture writeonly %2) {
%4 = load i32, i32* %0
%5 = tail call i32 @PAPI_stop(i32 %4, i64* %1)
store i32 %5, i32* %2
ret void
}
/* Type definitions */
struct c_log_subproc {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct c_log_subproc *);
int c_log_subproc_close(void *cookie) {
  struct c_log_subproc *cls = (struct c_log_subproc *)cookie;
  free(cls);
  return 0;
}


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

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

LLVM IR (-O0):
%struct.c_log_subproc = type { i32 }
define i32 @c_log_subproc_close(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.c_log_subproc*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to %struct.c_log_subproc*
store %struct.c_log_subproc* %5, %struct.c_log_subproc** %3
%6 = load %struct.c_log_subproc*, %struct.c_log_subproc** %3
%7 = call i32 @free(%struct.c_log_subproc* %6)
ret i32 0
}

LLVM IR (-O2):
%struct.c_log_subproc = type { i32 }
define i32 @c_log_subproc_close(i8* nocapture %0) {
%2 = bitcast i8* %0 to %struct.c_log_subproc*
%3 = tail call i32 @free(%struct.c_log_subproc* %2)
ret i32 0
}
int eat(const unsigned char snake[8], const unsigned char x,
        const unsigned char y) {
  unsigned char j = snake[y] & (1 << x);
  if (j == (1 << x))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<eat>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x10(%rbp)
mov    %cl,-0x11(%rbp)
mov    %al,-0x12(%rbp)
mov    -0x10(%rbp),%rax
movzbl -0x12(%rbp),%ecx
movzbl (%rax,%rcx,1),%eax
movzbl -0x11(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
mov    %al,-0x13(%rbp)
movzbl -0x13(%rbp),%eax
movzbl -0x11(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
jne    1156 <eat+0x56>
movl   $0x1,-0x4(%rbp)
jmp    115d <eat+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<eat>:
mov    %esi,%ecx
mov    $0x1,%esi
shl    %cl,%esi
mov    %edx,%eax
mov    (%rdi,%rax,1),%al
and    %sil,%al
movzbl %al,%ecx
xor    %eax,%eax
cmp    %ecx,%esi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @eat(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = zext i8 %2 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = zext i8 %1 to i32
%8 = shl nuw i32 1, %7
%9 = trunc i32 %8 to i8
%10 = and i8 %6, %9
%11 = zext i8 %10 to i32
%12 = icmp eq i32 %8, %11
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void memory_free(void *p) {
  if (p) {
    free(p);
  }
}


x86 assembly (clang, -O0):
<memory_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <memory_free+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memory_free>:
test   %rdi,%rdi
je     111a <memory_free+0xa>
jmp    1030 <free@plt>
ret

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

LLVM IR (-O2):
define void @memory_free(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int pd_getpagesize();
int pd_getpagemask() {
  int pagesize, pagemask, temp;
  pagesize = pd_getpagesize();
  for (pagemask = 0, temp = pagesize; temp != 1;) {
    temp = (temp >> 1);
    pagemask = (pagemask << 1) + 1;
  }
  return pagemask;
}


x86 assembly (clang, -O0):
<pd_getpagemask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <pd_getpagesize@plt>
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
je     1153 <pd_getpagemask+0x43>
mov    -0xc(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112f <pd_getpagemask+0x1f>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pd_getpagemask>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <pd_getpagesize@plt>
cmp    $0x1,%eax
je     113c <pd_getpagemask+0x2c>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
sar    %eax
add    %ebx,%ebx
add    $0x1,%ebx
cmp    $0x1,%eax
jne    1130 <pd_getpagemask+0x20>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @pd_getpagemask() {
%1 = tail call i32 (...) @pd_getpagesize()
%2 = icmp eq i32 %1, 1
br i1 %2, label %10, label %3
3: ; preds = %0, %3
%4 = phi i32 [ %6, %3 ], [ %1, %0 ]
%5 = phi i32 [ %8, %3 ], [ 0, %0 ]
%6 = ashr i32 %4, 1
%7 = shl i32 %5, 1
%8 = or i32 %7, 1
%9 = icmp eq i32 %6, 1
br i1 %9, label %10, label %3
10: ; preds = %3, %0
%11 = phi i32 [ 0, %0 ], [ %8, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ writeLED(char *, char *);
void removeTrigger() { writeLED("/trigger", "none"); }


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

x86 assembly (clang, -O2):
<removeTrigger>:
lea    0xee9(%rip),%rdi
lea    0xeeb(%rip),%rsi
jmp    1030 <writeLED@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"/trigger\00"
@.str.1 = [5 x i8] c"none\00"
define void @removeTrigger() {
%1 = call i32 @writeLED(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"/trigger\00"
@.str.1 = [5 x i8] c"none\00"
define void @removeTrigger() {
%1 = tail call i32 @writeLED(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int rand();
long rand_long() {
  int lower_32bit, upper_32bit;
  long rand_long;
  lower_32bit = rand();
  upper_32bit = rand();
  return (((long)upper_32bit << 32) + lower_32bit);
}


x86 assembly (clang, -O0):
<rand_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,-0x8(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x20,%rax
movslq -0x4(%rbp),%rcx
add    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_long>:
push   %rbx
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
shl    $0x20,%rax
movslq %ebx,%rcx
add    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @rand_long() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = call i32 (...) @rand()
store i32 %4, i32* %1
%5 = call i32 (...) @rand()
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = shl i64 %7, 32
%9 = load i32, i32* %1
%10 = sext i32 %9 to i64
%11 = add nsw i64 %8, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @rand_long() {
%1 = tail call i32 (...) @rand()
%2 = tail call i32 (...) @rand()
%3 = zext i32 %2 to i64
%4 = shl nuw i64 %3, 32
%5 = sext i32 %1 to i64
%6 = add nsw i64 %4, %5
ret i64 %6
}
int bar(int x) {
  int tem = x / 3;
  return tem / (0x7fffffff / 2);
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3fffffff,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @bar(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sdiv i32 %4, 3
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = sdiv i32 %6, 1073741823
ret i32 %7
}

LLVM IR (-O2):
define i32 @bar(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sscanf(char const *, char *, unsigned int *, unsigned int *,
                          unsigned int *);
unsigned long extract_version(const char *release) {
  unsigned major = 0;
  unsigned minor = 0;
  unsigned patch = 0;
  sscanf(release, "%u.%u.%u", &major, &minor, &patch);
  return major * 1000000ul + minor * 1000 + patch;
}


x86 assembly (clang, -O0):
<extract_version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec4(%rip),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1030 <sscanf@plt>
mov    -0xc(%rbp),%eax
imul   $0xf4240,%rax,%rax
imul   $0x3e8,-0x10(%rbp),%ecx
mov    %ecx,%ecx
add    %rcx,%rax
mov    -0x14(%rbp),%ecx
add    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_version>:
sub    $0x18,%rsp
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
lea    0xecd(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
call   1030 <sscanf@plt>
mov    0x14(%rsp),%eax
imul   $0x3e8,0x10(%rsp),%ecx
imul   $0xf4240,%rax,%rax
add    %rax,%rcx
mov    0xc(%rsp),%eax
add    %rcx,%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%u.%u.%u\00"
define i64 @extract_version(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%6 = load i8*, i8** %2
%7 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4, i32* %5)
%8 = load i32, i32* %3
%9 = zext i32 %8 to i64
%10 = mul i64 %9, 1000000
%11 = load i32, i32* %4
%12 = mul i32 %11, 1000
%13 = zext i32 %12 to i64
%14 = add i64 %10, %13
%15 = load i32, i32* %5
%16 = zext i32 %15 to i64
%17 = add i64 %14, %16
ret i64 %17
}

LLVM IR (-O2):
@.str = [9 x i8] c"%u.%u.%u\00"
define i64 @extract_version(i8* nocapture %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%8 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%9 = load i32, i32* %2
%10 = zext i32 %9 to i64
%11 = mul nuw nsw i64 %10, 1000000
%12 = load i32, i32* %3
%13 = mul i32 %12, 1000
%14 = zext i32 %13 to i64
%15 = add nuw nsw i64 %11, %14
%16 = load i32, i32* %4
%17 = zext i32 %16 to i64
%18 = add nuw nsw i64 %15, %17
ret i64 %18
}
/* Variables and functions */
int vectors_equal(double *, double *, int, int);
int test_double() {
  double x[] = {1.5, 2.0, 3.9};
  double y[] = {1.5, 2.0, 3.9};
  return vectors_equal(x, y, 3, sizeof(double));
}


x86 assembly (clang, -O0):
<test_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xee0(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xedd(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x3,%edx
mov    $0x8,%ecx
call   1030 <vectors_equal@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_double>:
sub    $0x38,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    %rax,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x3,%edx
mov    $0x8,%ecx
call   1030 <vectors_equal@plt>
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.test_double.x = [3 x double] [double 1.500000e+00, double 2.000000e+00, double 3.900000e+00]
@__const.test_double.y = [3 x double] [double 1.500000e+00, double 2.000000e+00, double 3.900000e+00]
define i32 @test_double() {
%1 = alloca [3 x double]
%2 = alloca [3 x double]
%3 = bitcast [3 x double]* %1 to i8*
%4 = bitcast [3 x double]* %2 to i8*
%5 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 0
%6 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
%7 = call i32 @vectors_equal(double* %5, double* %6, i32 3, i32 8)
ret i32 %7
}

LLVM IR (-O2):
@__const.test_double.y = [3 x double] [double 1.500000e+00, double 2.000000e+00, double 3.900000e+00]
define i32 @test_double() {
%1 = alloca [3 x double]
%2 = alloca [3 x double]
%3 = bitcast [3 x double]* %1 to i8*
%4 = bitcast [3 x double]* %2 to i8*
%5 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 0
%6 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
%7 = call i32 @vectors_equal(double* %5, double* %6, i32 3, i32 8)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i;
  for (i = 0; i < 256; i++)
    printf("%c", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jge    1150 <main+0x40>
mov    -0x8(%rbp),%esi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xee3(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x100,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 256
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
int test_imm_17int16_mem(short *val) {
  return ((*val) & (-0x17 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_17int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -23
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ err(int, char *, char const *);
int64_t check(int64_t ret, const char *msg) {
  if (ret == -1) {
    err(1, "%s", msg);
  }
  return ret;
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    113e <check+0x2e>
mov    -0x10(%rbp),%rdx
mov    $0x1,%edi
lea    0xec7(%rip),%rsi
call   1030 <err@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
push   %rbx
mov    %edi,%ebx
cmp    $0xffffffff,%edi
jne    112c <check+0x1c>
mov    %rsi,%rdx
lea    0xede(%rip),%rsi
mov    $0x1,%edi
call   1030 <err@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @check(i32 returned %0, i8* %1) {
%3 = icmp eq i32 %0, -1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %6
6: ; preds = %4, %2
ret i32 %0
}
int file1_fun1() { return 4711; }


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

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

LLVM IR (-O0):
define i32 @file1_fun1() {
ret i32 4711
}

LLVM IR (-O2):
define i32 @file1_fun1() {
ret i32 4711
}
int do_078() { return 78; }


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

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

LLVM IR (-O0):
define i32 @do_078() {
ret i32 78
}

LLVM IR (-O2):
define i32 @do_078() {
ret i32 78
}
/* Variables and functions */
int /*<<< orphan*/ pop();
void apply_pop(void) { pop(); }


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

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

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

LLVM IR (-O2):
define void @apply_pop() {
%1 = tail call i32 (...) @pop()
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
bool overflow(uint32_t a, uint32_t b, uint32_t r) {
  return ((a ^ b ^ 0x80000000UL) & (a ^ r)) >> 31;
}


x86 assembly (clang, -O0):
<overflow>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
cltq
movabs $0x80000000,%rcx
xor    %rcx,%rax
mov    -0x4(%rbp),%ecx
xor    -0xc(%rbp),%ecx
movslq %ecx,%rcx
and    %rcx,%rax
shr    $0x1f,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<overflow>:
xor    %edi,%esi
movslq %esi,%rax
mov    $0x80000000,%ecx
xor    %rax,%rcx
xor    %edi,%edx
movslq %edx,%rax
and    %rcx,%rax
shr    $0x1f,%rax
ret

LLVM IR (-O0):
define i32 @overflow(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = xor i32 %7, %8
%10 = sext i32 %9 to i64
%11 = xor i64 %10, 2147483648
%12 = load i32, i32* %4
%13 = load i32, i32* %6
%14 = xor i32 %12, %13
%15 = sext i32 %14 to i64
%16 = and i64 %11, %15
%17 = lshr i64 %16, 31
%18 = trunc i64 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @overflow(i32 %0, i32 %1, i32 %2) {
%4 = xor i32 %1, %0
%5 = sext i32 %4 to i64
%6 = xor i64 %5, 2147483648
%7 = xor i32 %2, %0
%8 = sext i32 %7 to i64
%9 = and i64 %6, %8
%10 = lshr i64 %9, 31
%11 = trunc i64 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int roundInt(float number) {
  float ret = (number >= 0) ? (number + 0.5) : (number - 0.5);
  assert((int)ret != -13.0f);
  return (int)ret;
}


x86 assembly (clang, -O0):
<roundInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     114d <roundInt+0x3d>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xec1(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1167 <roundInt+0x57>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xea2(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
cvttss2si -0x8(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  0xe82(%rip),%xmm1
ucomiss %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cvttss2si -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roundInt>:
push   %rbx
xorps  %xmm1,%xmm1
xor    %eax,%eax
ucomiss %xmm1,%xmm0
setb   %al
cvtss2sd %xmm0,%xmm0
lea    0xed9(%rip),%rcx
addsd  (%rcx,%rax,8),%xmm0
cvtsd2ss %xmm0,%xmm0
cvttss2si %xmm0,%ebx
xor    %edi,%edi
cmp    $0xfffffff3,%ebx
setne  %dil
call   1030 <assert@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @roundInt(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = fcmp oge float %4, 0.000000e+00
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load float, float* %2
%8 = fpext float %7 to double
%9 = fadd double %8, 5.000000e-01
br label %14
10: ; preds = %1
%11 = load float, float* %2
%12 = fpext float %11 to double
%13 = fsub double %12, 5.000000e-01
br label %14
14: ; preds = %10, %6
%15 = phi double [ %9, %6 ], [ %13, %10 ]
%16 = fptrunc double %15 to float
store float %16, float* %3
%17 = load float, float* %3
%18 = fptosi float %17 to i32
%19 = sitofp i32 %18 to float
%20 = fcmp une float %19, -1.300000e+01
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = load float, float* %3
%24 = fptosi float %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @roundInt(float %0) {
%2 = fcmp ult float %0, 0.000000e+00
%3 = fpext float %0 to double
%4 = select i1 %2, double -5.000000e-01, double 5.000000e-01
%5 = fadd double %4, %3
%6 = fptrunc double %5 to float
%7 = fptosi float %6 to i32
%8 = icmp ne i32 %7, -13
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
ret i32 %7
}
const char *pathcon_nm2_name_in(int i) {
  switch (i) {
  case 0:
    return "i0";
  case 1:
    return "i1";
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<pathcon_nm2_name_in>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     112b <pathcon_nm2_name_in+0x2b>
jmp    111a <pathcon_nm2_name_in+0x1a>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     113b <pathcon_nm2_name_in+0x3b>
jmp    114b <pathcon_nm2_name_in+0x4b>
lea    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <pathcon_nm2_name_in+0x53>
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <pathcon_nm2_name_in+0x53>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pathcon_nm2_name_in>:
xor    %ecx,%ecx
cmp    $0x1,%edi
lea    0xef7(%rip),%rax
cmove  %rax,%rcx
test   %edi,%edi
lea    0xee7(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"i0\00"
@.str.1 = [3 x i8] c"i1\00"
define i8* @pathcon_nm2_name_in(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 0, label %5
i32 1, label %6
]
5: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2
br label %8
6: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %8
7: ; preds = %1
store i8* null, i8** %2
br label %8
8: ; preds = %7, %6, %5
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [3 x i8] c"i0\00"
@.str.1 = [3 x i8] c"i1\00"
define i8* @pathcon_nm2_name_in(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* null
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3
ret i8* %5
}
/* Type definitions */
struct mibinfo {
  int dummy;
};

/* Variables and functions */
int x_format(char *, struct mibinfo *, void const *, size_t, char *, size_t);
int hex_format(struct mibinfo *m, const void *data, size_t data_size, char *buf,
               size_t len) {
  return x_format("x", m, data, data_size, buf, len);
}


x86 assembly (clang, -O0):
<hex_format>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
lea    0xeb9(%rip),%rdi
call   1030 <x_format@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex_format>:
mov    %r8,%r9
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xeda(%rip),%rdi
jmp    1030 <x_format@plt>

LLVM IR (-O0):
%struct.mibinfo = type { i32 }
@.str = [2 x i8] c"x\00"
define i32 @hex_format(%struct.mibinfo* %0, i8* %1, i64 %2, i8* %3, i64 %4) {
%6 = alloca %struct.mibinfo*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i64
store %struct.mibinfo* %0, %struct.mibinfo** %6
store i8* %1, i8** %7
store i64 %2, i64* %8
store i8* %3, i8** %9
store i64 %4, i64* %10
%11 = load %struct.mibinfo*, %struct.mibinfo** %6
%12 = load i8*, i8** %7
%13 = load i64, i64* %8
%14 = load i8*, i8** %9
%15 = load i64, i64* %10
%16 = call i32 @x_format(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %struct.mibinfo* %11, i8* %12, i64 %13, i8* %14, i64 %15)
ret i32 %16
}

LLVM IR (-O2):
%struct.mibinfo = type { i32 }
@.str = [2 x i8] c"x\00"
define i32 @hex_format(%struct.mibinfo* %0, i8* %1, i64 %2, i8* %3, i64 %4) {
%6 = tail call i32 @x_format(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %struct.mibinfo* %0, i8* %1, i64 %2, i8* %3, i64 %4)
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ clock_t;

/* Variables and functions */
int /*<<< orphan*/ clock();
clock_t start_timer(const char *name) {
  (void)name;
  return clock();
}


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

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

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

LLVM IR (-O2):
define i32 @start_timer(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @clock()
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ gen(char *);
void cgunscale(void) { gen("shrq\t$3,%rax"); }


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"shrq\09$3,%rax\00"
define void @cgunscale() {
%1 = call i32 @gen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"shrq\09$3,%rax\00"
define void @cgunscale() {
%1 = tail call i32 @gen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}
__attribute__((const)) int av_isdigit(int c) { return c >= '0' && c <= '9'; }


x86 assembly (clang, -O0):
<av_isdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x30,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <av_isdigit+0x20>
cmpl   $0x39,-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):
<av_isdigit>:
add    $0xffffffd0,%edi
xor    %eax,%eax
cmp    $0xa,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @av_isdigit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 48
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 57
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 @av_isdigit(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int access(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ isdir(char const *);
int fnameexist(const char *filename) {
  if (access(filename, 0) == -1)
    return (0);
  if (!isdir(filename))
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<fnameexist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1040 <access@plt>
cmp    $0xffffffff,%eax
jne    114c <fnameexist+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    1171 <fnameexist+0x51>
mov    -0x10(%rbp),%rdi
call   1030 <isdir@plt>
cmp    $0x0,%eax
jne    116a <fnameexist+0x4a>
movl   $0x1,-0x4(%rbp)
jmp    1171 <fnameexist+0x51>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnameexist>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
xor    %esi,%esi
call   1040 <access@plt>
cmp    $0xffffffff,%eax
je     1144 <fnameexist+0x24>
mov    %r14,%rdi
call   1030 <isdir@plt>
xor    %ebx,%ebx
test   %eax,%eax
sete   %bl
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @fnameexist(i8* %0) {
%2 = tail call i32 @access(i8* %0, i32 0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @isdir(i8* %0)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void oldmap(short **mp, short length) { free((char *)(char *)mp); }


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

x86 assembly (clang, -O2):
<oldmap>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @oldmap(i16** %0, i16 signext %1) {
%3 = alloca i16**
%4 = alloca i16
store i16** %0, i16*** %3
store i16 %1, i16* %4
%5 = load i16**, i16*** %3
%6 = bitcast i16** %5 to i8*
%7 = call i32 @free(i8* %6)
ret void
}

LLVM IR (-O2):
define void @oldmap(i16** nocapture %0, i16 signext %1) {
%3 = bitcast i16** %0 to i8*
%4 = tail call i32 @free(i8* %3)
ret void
}
/* Variables and functions */
void TestSwitch(int);
void TestJumps(void) {
  while (1) {
    continue;
    break;
  }
  return;
  return TestSwitch(1);
}


x86 assembly (clang, -O0):
<TestJumps>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <TestJumps+0x9>
jmp    1109 <TestJumps+0x9>

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

LLVM IR (-O0):
define void @TestJumps() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @TestJumps() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void error(const char *msg) {
  fprintf(stderr, "vanilla: %s\n", msg);
  abort();
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [13 x i8] c"vanilla: %s\0A\00"
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [13 x i8] c"vanilla: %s\0A\00"
define void @error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 (...) @abort()
unreachable
}