xunge/DecIR huggingface dataset:
/* Type definitions */
struct msghdr {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ __socketcall(int, unsigned long *);
ssize_t __libc_sendmsg(int sockfd, const struct msghdr *msg, int flags) {
  unsigned long args[3];
  args[0] = sockfd;
  args[1] = (unsigned long)msg;
  args[2] = flags;
  return (__socketcall(16, args));
}


x86 assembly (clang, -O0):
<__libc_sendmsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movslq -0x4(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
movslq -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x30(%rbp),%rsi
mov    $0x10,%edi
call   1030 <__socketcall@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__libc_sendmsg>:
sub    $0x18,%rsp
movslq %edi,%rax
mov    %rax,(%rsp)
mov    %rsi,0x8(%rsp)
movslq %edx,%rax
mov    %rax,0x10(%rsp)
mov    %rsp,%rsi
mov    $0x10,%edi
call   1030 <__socketcall@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.msghdr = type { i32 }
define i32 @__libc_sendmsg(i32 %0, %struct.msghdr* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.msghdr*
%6 = alloca i32
%7 = alloca [3 x i64]
store i32 %0, i32* %4
store %struct.msghdr* %1, %struct.msghdr** %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [3 x i64], [3 x i64]* %7, i64 0, i64 0
store i64 %9, i64* %10
%11 = load %struct.msghdr*, %struct.msghdr** %5
%12 = ptrtoint %struct.msghdr* %11 to i64
%13 = getelementptr inbounds [3 x i64], [3 x i64]* %7, i64 0, i64 1
store i64 %12, i64* %13
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [3 x i64], [3 x i64]* %7, i64 0, i64 2
store i64 %15, i64* %16
%17 = getelementptr inbounds [3 x i64], [3 x i64]* %7, i64 0, i64 0
%18 = call i32 @__socketcall(i32 16, i64* %17)
ret i32 %18
}

LLVM IR (-O2):
%struct.msghdr = type { i32 }
define i32 @__libc_sendmsg(i32 %0, %struct.msghdr* %1, i32 %2) {
%4 = alloca [3 x i64]
%5 = bitcast [3 x i64]* %4 to i8*
%6 = sext i32 %0 to i64
%7 = getelementptr inbounds [3 x i64], [3 x i64]* %4, i64 0, i64 0
store i64 %6, i64* %7
%8 = ptrtoint %struct.msghdr* %1 to i64
%9 = getelementptr inbounds [3 x i64], [3 x i64]* %4, i64 0, i64 1
store i64 %8, i64* %9
%10 = sext i32 %2 to i64
%11 = getelementptr inbounds [3 x i64], [3 x i64]* %4, i64 0, i64 2
store i64 %10, i64* %11
%12 = call i32 @__socketcall(i32 16, i64* %7)
ret i32 %12
}
void pixel_add(unsigned char *pixel, unsigned char value) {
  if (*pixel + value > 255) {
    *pixel = 255;
  } else {
    *pixel += value;
  }
}


x86 assembly (clang, -O0):
<pixel_add>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0x9(%rbp),%ecx
add    %ecx,%eax
cmp    $0xff,%eax
jle    1132 <pixel_add+0x32>
mov    -0x8(%rbp),%rax
movb   $0xff,(%rax)
jmp    1141 <pixel_add+0x41>
movzbl -0x9(%rbp),%edx
mov    -0x8(%rbp),%rax
movzbl (%rax),%ecx
add    %edx,%ecx
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<pixel_add>:
movzbl (%rdi),%eax
add    %esi,%eax
cmp    $0xff,%eax
mov    $0xff,%ecx
cmovb  %eax,%ecx
mov    %cl,(%rdi)
ret

LLVM IR (-O0):
define void @pixel_add(i8* %0, i8 zeroext %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* %5
%7 = zext i8 %6 to i32
%8 = load i8, i8* %4
%9 = zext i8 %8 to i32
%10 = add nsw i32 %7, %9
%11 = icmp sgt i32 %10, 255
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load i8*, i8** %3
store i8 -1, i8* %13
br label %22
14: ; preds = %2
%15 = load i8, i8* %4
%16 = zext i8 %15 to i32
%17 = load i8*, i8** %3
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = add nsw i32 %19, %16
%21 = trunc i32 %20 to i8
store i8 %21, i8* %17
br label %22
22: ; preds = %14, %12
ret void
}

LLVM IR (-O2):
define void @pixel_add(i8* nocapture %0, i8 zeroext %1) {
%3 = load i8, i8* %0
%4 = zext i8 %3 to i32
%5 = zext i8 %1 to i32
%6 = add nuw nsw i32 %4, %5
%7 = icmp ult i32 %6, 255
%8 = select i1 %7, i32 %6, i32 255
%9 = trunc i32 %8 to i8
store i8 %9, i8* %0
ret void
}
/* Variables and functions */
scalar_t__ isdigit(int);
extern __attribute__((gnu_)) int isxdigit(int __c) {
  return isdigit(__c) || (__c >= 'a' && __c <= 'f') ||
         (__c >= 'A' && __c <= 'F');
}


x86 assembly (clang, -O0):
<isxdigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <isdigit@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    116d <isxdigit+0x5d>
cmpl   $0x61,-0x4(%rbp)
jl     114e <isxdigit+0x3e>
mov    $0x1,%al
cmpl   $0x66,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    116d <isxdigit+0x5d>
xor    %eax,%eax
cmpl   $0x41,-0x4(%rbp)
mov    %al,-0x6(%rbp)
jl     1167 <isxdigit+0x57>
cmpl   $0x46,-0x4(%rbp)
setle  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isxdigit>:
push   %rbx
mov    %edi,%ebx
call   1030 <isdigit@plt>
test   %rax,%rax
setne  %al
and    $0xffffffdf,%ebx
add    $0xffffffbf,%ebx
cmp    $0x6,%ebx
setb   %cl
or     %al,%cl
movzbl %cl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @isxdigit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @isdigit(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %20, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp sge i32 %7, 97
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %2
%11 = icmp sle i32 %10, 102
br i1 %11, label %20, label %12
12: ; preds = %9, %6
%13 = load i32, i32* %2
%14 = icmp sge i32 %13, 65
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp sle i32 %16, 70
br label %18
18: ; preds = %15, %12
%19 = phi i1 [ false, %12 ], [ %17, %15 ]
br label %20
20: ; preds = %18, %9, %1
%21 = phi i1 [ true, %9 ], [ true, %1 ], [ %19, %18 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @isxdigit(i32 %0) {
%2 = tail call i64 @isdigit(i32 %0)
%3 = icmp ne i64 %2, 0
%4 = and i32 %0, -33
%5 = add i32 %4, -65
%6 = icmp ult i32 %5, 6
%7 = or i1 %6, %3
%8 = zext i1 %7 to i32
ret i32 %8
}
int imax(int l, int r) {
  if (l > r)
    return (l);
  return (r);
}


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

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

LLVM IR (-O0):
define i32 @imax(i32 %0, i32 %1) {
%3 = alloca i32
%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 = icmp sgt i32 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32, i32* %4
store i32 %10, i32* %3
br label %13
11: ; preds = %2
%12 = load i32, i32* %5
store i32 %12, i32* %3
br label %13
13: ; preds = %11, %9
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @imax(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
int compare(const void *a, const void *b) {
  int int_a = *((int *)a);
  int int_b = *((int *)b);
  return (int_a > int_b) - (int_a < int_b);
}


x86 assembly (clang, -O0):
<compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x14(%rbp),%ecx
cmp    -0x18(%rbp),%ecx
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare>:
mov    (%rdi),%ecx
xor    %eax,%eax
xor    %edx,%edx
cmp    (%rsi),%ecx
setg   %al
setl   %dl
sub    %edx,%eax
ret

LLVM IR (-O0):
define i32 @compare(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
%9 = load i32, i32* %8
store i32 %9, i32* %5
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i32*
%12 = load i32, i32* %11
store i32 %12, i32* %6
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = icmp sgt i32 %13, %14
%16 = zext i1 %15 to i32
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = icmp slt i32 %17, %18
%20 = zext i1 %19 to i32
%21 = sub nsw i32 %16, %20
ret i32 %21
}

LLVM IR (-O2):
define i32 @compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp sgt i32 %4, %6
%8 = zext i1 %7 to i32
%9 = icmp slt i32 %4, %6
%10 = sext i1 %9 to i32
%11 = add nsw i32 %10, %8
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void world() { printf("world!\n"); }


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

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

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

LLVM IR (-O2):
@str = [7 x i8] c"world!\00"
define void @world() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ le32enc(unsigned char *, unsigned long);
extern void le64enc(void *buf, unsigned long long u) {
  unsigned char *p = (unsigned char *)buf;
  le32enc(p, (unsigned long)(u & 0xffffffffULL));
  le32enc(p + 4, (unsigned long)(u >> 32));
}


x86 assembly (clang, -O0):
<le64enc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
movabs $0xffffffff,%rsi
and    -0x10(%rbp),%rsi
call   1030 <le32enc@plt>
mov    -0x18(%rbp),%rdi
add    $0x4,%rdi
mov    -0x10(%rbp),%rsi
shr    $0x20,%rsi
call   1030 <le32enc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<le64enc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %r14d,%esi
call   1030 <le32enc@plt>
add    $0x4,%rbx
shr    $0x20,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <le32enc@plt>

LLVM IR (-O0):
define void @le64enc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = load i64, i64* %4
%9 = and i64 %8, 4294967295
%10 = call i32 @le32enc(i8* %7, i64 %9)
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i64 4
%13 = load i64, i64* %4
%14 = lshr i64 %13, 32
%15 = call i32 @le32enc(i8* %12, i64 %14)
ret void
}

LLVM IR (-O2):
define void @le64enc(i8* %0, i64 %1) {
%3 = and i64 %1, 4294967295
%4 = tail call i32 @le32enc(i8* %0, i64 %3)
%5 = getelementptr inbounds i8, i8* %0, i64 4
%6 = lshr i64 %1, 32
%7 = tail call i32 @le32enc(i8* %5, i64 %6)
ret void
}
int test_imm_D0int8_reg(signed char val) {
  return ((val) & (0xD0 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_D0int8_reg(i8 signext %0) {
%2 = and i8 %0, -48
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
float random_between(float, float);
void randomize_buffer(float *buf, int size, float lo, float hi) {
  int i;
  for (i = 0; i < size; i++) {
    buf[i] = random_between(lo, hi);
  }
}


x86 assembly (clang, -O0):
<randomize_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movss  %xmm0,-0x10(%rbp)
movss  %xmm1,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1166 <randomize_buffer+0x56>
movss  -0x10(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
call   1030 <random_between@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1130 <randomize_buffer+0x20>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomize_buffer>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
test   %esi,%esi
jle    1160 <randomize_buffer+0x50>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1030 <random_between@plt>
movss  %xmm0,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1140 <randomize_buffer+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @randomize_buffer(float* nocapture writeonly %0, i32 %1, float %2, float %3) {
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %14
6: ; preds = %4
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %12, %8 ]
%10 = tail call float @random_between(float %2, float %3)
%11 = getelementptr inbounds float, float* %0, i64 %9
store float %10, float* %11
%12 = add nuw nsw i64 %9, 1
%13 = icmp eq i64 %12, %7
br i1 %13, label %14, label %8
14: ; preds = %8, %4
ret void
}
/* Variables and functions */
int DT_DIR;
int get_file_type(char *);
int dir_exists(char *dir) {
  int r = get_file_type(dir);
  if (r == DT_DIR) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<dir_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <get_file_type@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2eae(%rip),%rcx
cmp    (%rcx),%eax
jne    1146 <dir_exists+0x36>
movl   $0x0,-0x4(%rbp)
jmp    114d <dir_exists+0x3d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dir_exists>:
push   %rax
call   1030 <get_file_type@plt>
mov    0x2ec3(%rip),%rdx
xor    %ecx,%ecx
cmp    (%rdx),%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@DT_DIR = global i32 0
define i32 @dir_exists(i8* %0) {
%2 = tail call i32 @get_file_type(i8* %0)
%3 = load i32, i32* @DT_DIR
%4 = icmp ne i32 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ Check();
int main() {
  Check();
  Check();
  Check();
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @Check()
%2 = call i32 (...) @Check()
%3 = call i32 (...) @Check()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @Check()
%2 = tail call i32 (...) @Check()
%3 = tail call i32 (...) @Check()
ret i32 0
}
/* Variables and functions */
int getpid();
int getppid();
int /*<<< orphan*/ printf(char *, int, int);
void printChild() {
  printf("I am the child. My PARENT pid: %d, and my pid: %d\n", getppid(),
         getpid());
}


x86 assembly (clang, -O0):
<printChild>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <getppid@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x4(%rbp),%esi
mov    %eax,%edx
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printChild>:
push   %rbx
xor    %eax,%eax
call   1050 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xeb8(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [51 x i8] c"I am the child. My PARENT pid: %d, and my pid: %d\0A\00"
define void @printChild() {
%1 = call i32 (...) @getppid()
%2 = call i32 (...) @getpid()
%3 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
ret void
}

LLVM IR (-O2):
@.str = [51 x i8] c"I am the child. My PARENT pid: %d, and my pid: %d\0A\00"
define void @printChild() {
%1 = tail call i32 (...) @getppid()
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print(int *, int);
int removeDuplicates(int *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  int a[] = {1, 1, 1, 2, 2, 3};
  int n = removeDuplicates(a, 0);
  print(a, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebd(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
call   1040 <removeDuplicates@plt>
mov    %eax,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1030 <print@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    0xee4(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <removeDuplicates@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <print@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [6 x i32] [i32 1, i32 1, i32 1, i32 2, i32 2, i32 3]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [6 x i32]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [6 x i32]* %6 to i8*
%9 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%10 = call i32 @removeDuplicates(i32* %9, i32 0)
store i32 %10, i32* %7
%11 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%12 = load i32, i32* %7
%13 = call i32 @print(i32* %11, i32 %12)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [6 x i32] [i32 1, i32 1, i32 1, i32 2, i32 2, i32 3]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [6 x i32]
%4 = bitcast [6 x i32]* %3 to i8*
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%6 = call i32 @removeDuplicates(i32* %5, i32 0)
%7 = call i32 @print(i32* %5, i32 %6)
ret i32 0
}
int test_imm_8Euint16_reg(unsigned short val) {
  return ((val) & (-0x8E << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_8Euint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffff72,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_8Euint16_reg>:
test   $0xff72,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_8Euint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -142
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned int state;
};
typedef TYPE_1__ XKeyReleasedEvent;

/* Variables and functions */
void set_XKeyReleasedEvent_state(void *_p, unsigned _v) {
  ((XKeyReleasedEvent *)_p)->state = (unsigned)_v;
}


x86 assembly (clang, -O0):
<set_XKeyReleasedEvent_state>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XKeyReleasedEvent_state(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XKeyReleasedEvent_state(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int foo(double, int, int, int /*<<< orphan*/, int);
int main() {
  if (foo(0.1, 1, 3, 0, 1) != 3)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xeb9(%rip),%xmm0
mov    $0x1,%ecx
mov    $0x3,%esi
xor    %edx,%edx
mov    %ecx,%edi
call   1040 <foo@plt>
cmp    $0x3,%eax
je     116a <main+0x3a>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xec7(%rip),%xmm0
mov    $0x1,%edi
mov    $0x3,%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1040 <foo@plt>
cmp    $0x3,%eax
jne    115b <main+0x2b>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @foo(double 1.000000e-01, i32 1, i32 3, i32 0, i32 1)
%3 = icmp ne i32 %2, 3
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(double 1.000000e-01, i32 1, i32 3, i32 0, i32 1)
%2 = icmp eq i32 %1, 3
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *prog) {
  fprintf(stderr,
          "\nUsage: %s -b <bootloader> -k <kernel> [-t <timeout> ] [-m "
          "<micnum> ] [-o <file>] [-h] \n"
          "\t-t    Timeout to use. Default is 60 seconds\n"
          "\t-m    Which MIC device to use. Default is 0\n"
          "\t-b    Path to the bootloader to boot with\n"
          "\t-k    Path to the kernel to boot with\n"
          "\t-o    Output to file\n"
          "\t-h    Print this message\n\n",
          prog);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<usage>:
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   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [310 x i8] c"\0AUsage: %s -b <bootloader> -k <kernel> [-t <timeout> ] [-m <micnum> ] [-o <file>] [-h] \0A\09-t Timeout to use. Default is 60 seconds\0A\09-m Which MIC device to use. Default is 0\0A\09-b Path to the bootloader to boot with\0A\09-k Path to the kernel to boot with\0A\09-o Output to file\0A\09-h Print this message\0A\0A\00"
@EXIT_SUCCESS = global i32 0
define void @usage(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 ([310 x i8], [310 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EXIT_SUCCESS
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [310 x i8] c"\0AUsage: %s -b <bootloader> -k <kernel> [-t <timeout> ] [-m <micnum> ] [-o <file>] [-h] \0A\09-t Timeout to use. Default is 60 seconds\0A\09-m Which MIC device to use. Default is 0\0A\09-b Path to the bootloader to boot with\0A\09-k Path to the kernel to boot with\0A\09-o Output to file\0A\09-h Print this message\0A\0A\00"
@EXIT_SUCCESS = global i32 0
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([310 x i8], [310 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_SUCCESS
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ putOvalPicture(double, double, double, double);
void putInnerOval(double cx, double cy, double rx, double ry) {
  putOvalPicture(cx, cy, rx * 2.0, ry * 2.0);
}


x86 assembly (clang, -O0):
<putInnerOval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xec2(%rip),%xmm2
mulsd  -0x18(%rbp),%xmm2
movsd  0xeb5(%rip),%xmm3
mulsd  -0x20(%rbp),%xmm3
call   1030 <putOvalPicture@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putInnerOval>:
addsd  %xmm2,%xmm2
addsd  %xmm3,%xmm3
jmp    1030 <putOvalPicture@plt>

LLVM IR (-O0):
define void @putInnerOval(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* %5
%10 = load double, double* %6
%11 = load double, double* %7
%12 = fmul double %11, 2.000000e+00
%13 = load double, double* %8
%14 = fmul double %13, 2.000000e+00
%15 = call i32 @putOvalPicture(double %9, double %10, double %12, double %14)
ret void
}

LLVM IR (-O2):
define void @putInnerOval(double %0, double %1, double %2, double %3) {
%5 = fmul double %2, 2.000000e+00
%6 = fmul double %3, 2.000000e+00
%7 = tail call i32 @putOvalPicture(double %0, double %1, double %5, double %6)
ret void
}
void yy_1_TemplateTailPart2(char *yytext, int yyleng) {
  ;
  ;
}


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

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

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

LLVM IR (-O2):
define void @yy_1_TemplateTailPart2(i8* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void PrintHelp() {
  printf("Usage: file_server  <portno>  <-dvh> -\n");
  printf("d: daemon mode -\n");
  printf("v: verbos mode -\n");
  printf("h: help -\n");
}


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

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

LLVM IR (-O0):
@.str = [40 x i8] c"Usage: file_server <portno> <-dvh> -\0A\00"
@.str.1 = [18 x i8] c"d: daemon mode -\0A\00"
@.str.2 = [18 x i8] c"v: verbos mode -\0A\00"
@.str.3 = [11 x i8] c"h: help -\0A\00"
define void @PrintHelp() {
%1 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [39 x i8] c"Usage: file_server <portno> <-dvh> -\00"
@str.4 = [17 x i8] c"d: daemon mode -\00"
@str.5 = [17 x i8] c"v: verbos mode -\00"
@str.6 = [10 x i8] c"h: help -\00"
define void @PrintHelp() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.6, i64 0, i64 0))
ret void
}
/* Variables and functions */
int printf(char *, short);
int main(void) {
  int a = 42;
  short b = {a + 1};
  return printf("%d\n", b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2a,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %ax,-0xa(%rbp)
lea    0xec9(%rip),%rdi
movswl -0xa(%rbp),%esi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
lea    0xee9(%rip),%rdi
mov    $0x2b,%esi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i16 signext 43)
ret i32 %1
}
fge(x, y) long long int x;
long long int y;
{
  if (x >= y)
    return 13;
  else
    return 140;
}


x86 assembly (clang, -O0):
<fge>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jl     1126 <fge+0x26>
movl   $0xd,-0x4(%rbp)
jmp    112d <fge+0x2d>
movl   $0x8c,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fge>:
cmp    %rsi,%rdi
mov    $0x8c,%ecx
mov    $0xd,%eax
cmovl  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @fge(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i32 140, i32 13
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void nonascii(char *what) {
  fprintf(stderr, "look: %s contains non-ASCII characters.\n", what);
  exit(1);
}


x86 assembly (clang, -O0):
<nonascii>:
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   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<nonascii>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [41 x i8] c"look: %s contains non-ASCII characters.\0A\00"
define void @nonascii(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 ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [41 x i8] c"look: %s contains non-ASCII characters.\0A\00"
define void @nonascii(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ do_pop();
int /*<<< orphan*/ do_rolldown();
int /*<<< orphan*/ do_unary2();
void do_app12(void) {
  do_unary2();
  do_rolldown();
  do_pop();
}


x86 assembly (clang, -O0):
<do_app12>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <do_unary2@plt>
mov    $0x0,%al
call   1050 <do_rolldown@plt>
mov    $0x0,%al
call   1030 <do_pop@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_app12>:
push   %rax
xor    %eax,%eax
call   1040 <do_unary2@plt>
xor    %eax,%eax
call   1050 <do_rolldown@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <do_pop@plt>

LLVM IR (-O0):
define void @do_app12() {
%1 = call i32 (...) @do_unary2()
%2 = call i32 (...) @do_rolldown()
%3 = call i32 (...) @do_pop()
ret void
}

LLVM IR (-O2):
define void @do_app12() {
%1 = tail call i32 (...) @do_unary2()
%2 = tail call i32 (...) @do_rolldown()
%3 = tail call i32 (...) @do_pop()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncat(char *, char *, int);
void debug(char *msg) {
  char debug_msg[100];
  strcpy(debug_msg, "[DEBUG] ");
  strncat(debug_msg, msg, 83);
  printf("%s\n", debug_msg);
  exit(-1);
}


x86 assembly (clang, -O0):
<debug>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x53,%edx
call   1050 <strncat@plt>
lea    -0x70(%rbp),%rsi
lea    0xe90(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<debug>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rdi,%rbx
lea    0xeaf(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x53,%edx
call   1050 <strncat@plt>
lea    0xe96(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"[DEBUG] \00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @debug(i8* %0) {
%2 = alloca i8*
%3 = alloca [100 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%7 = load i8*, i8** %2
%8 = call i32 @strncat(i8* %6, i8* %7, i32 83)
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [9 x i8] c"[DEBUG] \00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @debug(i8* %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @strncat(i8* %3, i8* %0, i32 83)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%7 = call i32 @exit(i32 -1)
unreachable
}
void foo_2_2_2_2_1_1_2_2_1() {}


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

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

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

LLVM IR (-O2):
define void @foo_2_2_2_2_1_1_2_2_1() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PrintErrorCode();
int dxl_read_word(int, int);
int getLoad(int Id) {
  int CurrentLoad;
  CurrentLoad = dxl_read_word(Id, 40);
  if (CurrentLoad >= 1024) {
    CurrentLoad = -(CurrentLoad - 1024);
  }
  CurrentLoad = CurrentLoad * 0.09765625;
  PrintErrorCode();
  return CurrentLoad;
}


x86 assembly (clang, -O0):
<getLoad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x28,%esi
call   1030 <dxl_read_word@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x400,-0x8(%rbp)
jl     1158 <getLoad+0x38>
mov    -0x8(%rbp),%ecx
sub    $0x400,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe9b(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <PrintErrorCode@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getLoad>:
push   %rbx
mov    $0x28,%esi
call   1030 <dxl_read_word@plt>
lea    -0x400(%rax),%ecx
neg    %ecx
cmp    $0x400,%eax
cmovl  %eax,%ecx
cvtsi2sd %ecx,%xmm0
mulsd  0xeb9(%rip),%xmm0
cvttsd2si %xmm0,%ebx
xor    %eax,%eax
call   1040 <PrintErrorCode@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @getLoad(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @dxl_read_word(i32 %4, i32 40)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp sge i32 %6, 1024
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* %3
%10 = sub nsw i32 %9, 1024
%11 = sub nsw i32 0, %10
store i32 %11, i32* %3
br label %12
12: ; preds = %8, %1
%13 = load i32, i32* %3
%14 = sitofp i32 %13 to double
%15 = fmul double %14, 0x3FB9000000000000
%16 = fptosi double %15 to i32
store i32 %16, i32* %3
%17 = call i32 (...) @PrintErrorCode()
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @getLoad(i32 %0) {
%2 = tail call i32 @dxl_read_word(i32 %0, i32 40)
%3 = icmp sgt i32 %2, 1023
%4 = sub i32 1024, %2
%5 = select i1 %3, i32 %4, i32 %2
%6 = sitofp i32 %5 to double
%7 = fmul double %6, 0x3FB9000000000000
%8 = fptosi double %7 to i32
%9 = tail call i32 (...) @PrintErrorCode()
ret i32 %8
}
int f() { return 2; }


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

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

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

LLVM IR (-O2):
define i32 @f() {
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ prinf(char *);
int main() {
  prinf("Hello World!\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"Hello World!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @prinf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello World!\0A\00"
define i32 @main() {
%1 = tail call i32 @prinf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int Thrd_Get_Byte(int);
int Thrd_Get_Word(int t) {
  int Val;
  int tmp;
  {
    Val = Thrd_Get_Byte(t);
    tmp = Thrd_Get_Byte(t);
    return ((Val << 8) | tmp);
  }
}


x86 assembly (clang, -O0):
<Thrd_Get_Word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <Thrd_Get_Byte@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <Thrd_Get_Byte@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x8,%eax
or     -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Thrd_Get_Word>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1030 <Thrd_Get_Byte@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1030 <Thrd_Get_Byte@plt>
shl    $0x8,%ebp
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @Thrd_Get_Word(i32 %0) {
%2 = tail call i32 @Thrd_Get_Byte(i32 %0)
%3 = tail call i32 @Thrd_Get_Byte(i32 %0)
%4 = shl i32 %2, 8
%5 = or i32 %4, %3
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void imprimir(int *vet, int tam) {
  int i;
  for (i = 0; i < tam; i++) {
    printf(" Vetor[%i]=%i \n", i, vet[i]);
  }
}


x86 assembly (clang, -O0):
<imprimir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115a <imprimir+0x4a>
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <imprimir+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imprimir>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1147 <imprimir+0x37>
mov    %rdi,%r14
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%edx
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <imprimir+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c" Vetor[%i]=%i \0A\00"
define void @imprimir(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = trunc i64 %7 to i32
%11 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %9)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ link_error();
void f14(unsigned long long int s) {
  if ((unsigned long int)s == 0)
    return;
  if (s == 0)
    link_error();
}


x86 assembly (clang, -O0):
<f14>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <f14+0x1c>
jmp    113e <f14+0x2e>
cmpq   $0x0,-0x8(%rbp)
jne    113e <f14+0x2e>
mov    $0x0,%al
call   1030 <link_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @f14(i64 %0) {
ret void
}
/* Type definitions */
struct pcibx_device {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ pcibx_write(struct pcibx_device *, int, int /*<<< orphan*/);
int /*<<< orphan*/ prsendinfo(char *);
void pcibx_cmd_clearbitstat(struct pcibx_device *dev) {
  prsendinfo("Clear 32/64 bit status");
  pcibx_write(dev, 0x77, 0);
}


x86 assembly (clang, -O0):
<pcibx_cmd_clearbitstat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1040 <prsendinfo@plt>
mov    -0x8(%rbp),%rdi
mov    $0x77,%esi
xor    %edx,%edx
call   1030 <pcibx_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pcibx_cmd_clearbitstat>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1040 <prsendinfo@plt>
mov    %rbx,%rdi
mov    $0x77,%esi
xor    %edx,%edx
pop    %rbx
jmp    1030 <pcibx_write@plt>

LLVM IR (-O0):
%struct.pcibx_device = type { i32 }
@.str = [23 x i8] c"Clear 32/64 bit status\00"
define void @pcibx_cmd_clearbitstat(%struct.pcibx_device* %0) {
%2 = alloca %struct.pcibx_device*
store %struct.pcibx_device* %0, %struct.pcibx_device** %2
%3 = call i32 @prsendinfo(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%4 = load %struct.pcibx_device*, %struct.pcibx_device** %2
%5 = call i32 @pcibx_write(%struct.pcibx_device* %4, i32 119, i32 0)
ret void
}

LLVM IR (-O2):
%struct.pcibx_device = type { i32 }
@.str = [23 x i8] c"Clear 32/64 bit status\00"
define void @pcibx_cmd_clearbitstat(%struct.pcibx_device* %0) {
%2 = tail call i32 @prsendinfo(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @pcibx_write(%struct.pcibx_device* %0, i32 119, i32 0)
ret void
}
void NewListener(int LSocketFd) {}


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

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

LLVM IR (-O0):
define void @NewListener(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @NewListener(i32 %0) {
ret void
}