xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
scalar_t__ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
void gt_xclose(int d) {
  if (close(d)) {
    perror("cannot close file descriptor");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<gt_xclose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
cmp    $0x0,%rax
je     1167 <gt_xclose+0x37>
lea    0xeac(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gt_xclose>:
push   %rax
call   1030 <close@plt>
test   %rax,%rax
jne    113d <gt_xclose+0xd>
pop    %rax
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"cannot close file descriptor\00"
@EXIT_FAILURE = global i32 0
define void @gt_xclose(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @close(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
10: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"cannot close file descriptor\00"
@EXIT_FAILURE = global i32 0
define void @gt_xclose(i32 %0) {
%2 = tail call i64 @close(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %1
ret void
}
/* Type definitions */
typedef scalar_t__ int_fast32_t;
typedef scalar_t__ int16_t;

/* Variables and functions */
scalar_t__ INT16_MAX;
scalar_t__ INT16_MIN;
__attribute__((always_)) int16_t clamp_s16(int_fast32_t x) {
  x = (x < INT16_MIN) ? INT16_MIN : x;
  x = (x > INT16_MAX) ? INT16_MAX : x;
  return x;
}


x86 assembly (clang, -O0):
<clamp_s16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2ec5(%rip),%rcx
cmp    (%rcx),%rax
jge    112f <clamp_s16+0x2f>
mov    0x2eb5(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
jmp    1137 <clamp_s16+0x37>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2e96(%rip),%rcx
cmp    (%rcx),%rax
jle    1166 <clamp_s16+0x66>
mov    0x2e86(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    116e <clamp_s16+0x6e>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp_s16>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%rax
cmp    %rdi,%rax
cmovle %rdi,%rax
mov    0x2ec8(%rip),%rcx
mov    (%rcx),%rcx
cmp    %rcx,%rax
cmovg  %rcx,%rax
ret

LLVM IR (-O0):
@INT16_MIN = global i64 0
@INT16_MAX = global i64 0
define i64 @clamp_s16(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = load i64, i64* @INT16_MIN
%5 = icmp slt i64 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i64, i64* @INT16_MIN
br label %10
8: ; preds = %1
%9 = load i64, i64* %2
br label %10
10: ; preds = %8, %6
%11 = phi i64 [ %7, %6 ], [ %9, %8 ]
store i64 %11, i64* %2
%12 = load i64, i64* %2
%13 = load i64, i64* @INT16_MAX
%14 = icmp sgt i64 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = load i64, i64* @INT16_MAX
br label %19
17: ; preds = %10
%18 = load i64, i64* %2
br label %19
19: ; preds = %17, %15
%20 = phi i64 [ %16, %15 ], [ %18, %17 ]
store i64 %20, i64* %2
%21 = load i64, i64* %2
ret i64 %21
}

LLVM IR (-O2):
@INT16_MIN = global i64 0
@INT16_MAX = global i64 0
define i64 @clamp_s16(i64 %0) {
%2 = load i64, i64* @INT16_MIN
%3 = icmp sgt i64 %2, %0
%4 = select i1 %3, i64 %2, i64 %0
%5 = load i64, i64* @INT16_MAX
%6 = icmp sgt i64 %4, %5
%7 = select i1 %6, i64 %5, i64 %4
ret i64 %7
}
float minf(float x, float y) { return x < y ? x : y; }


x86 assembly (clang, -O0):
<minf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1130 <minf+0x30>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    113a <minf+0x3a>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<minf>:
minss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @minf(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp olt float %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load float, float* %3
br label %12
10: ; preds = %2
%11 = load float, float* %4
br label %12
12: ; preds = %10, %8
%13 = phi float [ %9, %8 ], [ %11, %10 ]
ret float %13
}

LLVM IR (-O2):
define float @minf(float %0, float %1) {
%3 = fcmp olt float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}
/* Variables and functions */
int EXIT_FAILURE;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int failure(char *msg) {
  fprintf(stderr, "Error : %s\n", msg);
  return EXIT_FAILURE;
}


x86 assembly (clang, -O0):
<failure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<failure>:
push   %rax
mov    %rdi,%rdx
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ea8(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"Error : %s\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @failure(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 ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
ret i32 %6
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"Error : %s\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @failure(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
ret i32 %4
}
double dbl_raise(x, y)
double x;
int y;
{
  register int i = abs(y);
  double val = 1.0;
  while (--i >= 0)
    val *= x;
  if (y < 0)
    return (1.0 / val);
  return (val);
}


x86 assembly (clang, -O0):
<dbl_raise>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x18(%rbp)
movsd  0xecd(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jl     115e <dbl_raise+0x4e>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1138 <dbl_raise+0x28>
cmpl   $0x0,-0x14(%rbp)
jge    117f <dbl_raise+0x6f>
movsd  0xe90(%rip),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1189 <dbl_raise+0x79>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbl_raise>:
test   %edi,%edi
je     1131 <dbl_raise+0x31>
movapd %xmm0,%xmm1
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
add    $0x1,%eax
movsd  0xee6(%rip),%xmm0
nopw   0x0(%rax,%rax,1)
mulsd  %xmm1,%xmm0
add    $0xffffffff,%eax
cmp    $0x1,%eax
ja     1120 <dbl_raise+0x20>
test   %edi,%edi
js     113d <dbl_raise+0x3d>
ret
movsd  0xec7(%rip),%xmm0
test   %edi,%edi
jns    1130 <dbl_raise+0x30>
movsd  0xebb(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @dbl_raise(double %0, i32 %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store double %0, double* %4
store i32 %1, i32* %5
%8 = load i32, i32* %5
%9 = call i32 @abs(i32 %8)
store i32 %9, i32* %6
store double 1.000000e+00, double* %7
br label %10
10: ; preds = %14, %2
%11 = load i32, i32* %6
%12 = add nsw i32 %11, -1
store i32 %12, i32* %6
%13 = icmp sge i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load double, double* %4
%16 = load double, double* %7
%17 = fmul double %16, %15
store double %17, double* %7
br label %10
18: ; preds = %10
%19 = load i32, i32* %5
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load double, double* %7
%23 = fdiv double 1.000000e+00, %22
store double %23, double* %3
br label %26
24: ; preds = %18
%25 = load double, double* %7
store double %25, double* %3
br label %26
26: ; preds = %24, %21
%27 = load double, double* %3
ret double %27
}

LLVM IR (-O2):
define double @dbl_raise(double %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = tail call i32 @llvm.abs.i32(i32 %1, i1 true)
br label %6
6: ; preds = %4, %6
%7 = phi double [ %10, %6 ], [ 1.000000e+00, %4 ]
%8 = phi i32 [ %9, %6 ], [ %5, %4 ]
%9 = add nsw i32 %8, -1
%10 = fmul double %7, %0
%11 = icmp ugt i32 %8, 1
br i1 %11, label %6, label %12
12: ; preds = %6, %2
%13 = phi double [ 1.000000e+00, %2 ], [ %10, %6 ]
%14 = icmp slt i32 %1, 0
%15 = fdiv double 1.000000e+00, %13
%16 = select i1 %14, double %15, double %13
ret double %16
}
void kol_sleep(unsigned d) { asm volatile("int $0x40" ::"a"(5), "b"(d)); }


x86 assembly (clang, -O0):
<kol_sleep>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%ebx
mov    $0x5,%eax
int    $0x40
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<kol_sleep>:
push   %rbx
mov    %edi,%ebx
mov    $0x5,%eax
int    $0x40
pop    %rbx
ret

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

LLVM IR (-O2):
define void @kol_sleep(i32 %0) {
tail call void asm sideeffect "int $$0x40", "{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i32 5, i32 %0)
ret void
}
int prefix(const char *pfx, const char *string) {
  while (*pfx) {
    if (*pfx++ != *string++)
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<prefix>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1156 <prefix+0x56>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1151 <prefix+0x51>
movl   $0x0,-0x4(%rbp)
jmp    115d <prefix+0x5d>
jmp    110c <prefix+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<prefix>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rdi,%rax,1),%ecx
test   %cl,%cl
je     1127 <prefix+0x27>
lea    0x1(%rax),%rdx
cmp    (%rsi,%rax,1),%cl
mov    %rdx,%rax
je     1110 <prefix+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @prefix(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i8* [ %0, %2 ], [ %9, %8 ]
%5 = phi i8* [ %1, %2 ], [ %10, %8 ]
%6 = load i8, i8* %4
%7 = icmp eq i8 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %4, i64 1
%10 = getelementptr inbounds i8, i8* %5, i64 1
%11 = load i8, i8* %5
%12 = icmp eq i8 %6, %11
br i1 %12, label %3, label %13
13: ; preds = %3, %8
%14 = phi i32 [ 0, %8 ], [ 1, %3 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ error0(char *, char *);
void ac_ens(int v, char *vv) {
  if (!v) {
    error0("Ensure Assertion Violated.", vv);
  }
}


x86 assembly (clang, -O0):
<ac_ens>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1139 <ac_ens+0x29>
mov    -0x10(%rbp),%rsi
lea    0xecc(%rip),%rdi
call   1030 <error0@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ac_ens>:
test   %edi,%edi
je     1115 <ac_ens+0x5>
ret
lea    0xee4(%rip),%rdi
jmp    1030 <error0@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Ensure Assertion Violated.\00"
define void @ac_ens(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 ne i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = call i32 @error0(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %10
10: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"Ensure Assertion Violated.\00"
define void @ac_ens(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @error0(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %6
6: ; preds = %4, %2
ret void
}
/* Type definitions */
struct shuffle2_ctx {
  int dummy;
};
struct prime_current_block {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ do_early_prime_group_1_7(struct shuffle2_ctx *,
                                            struct prime_current_block *);
void do_early_prime_7(struct shuffle2_ctx *ctx,
                      struct prime_current_block *pcb) {
  do_early_prime_group_1_7(ctx, pcb);
}


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

x86 assembly (clang, -O2):
<do_early_prime_7>:
jmp    1030 <do_early_prime_group_1_7@plt>

LLVM IR (-O0):
%struct.shuffle2_ctx = type { i32 }
%struct.prime_current_block = type { i32 }
define void @do_early_prime_7(%struct.shuffle2_ctx* %0, %struct.prime_current_block* %1) {
%3 = alloca %struct.shuffle2_ctx*
%4 = alloca %struct.prime_current_block*
store %struct.shuffle2_ctx* %0, %struct.shuffle2_ctx** %3
store %struct.prime_current_block* %1, %struct.prime_current_block** %4
%5 = load %struct.shuffle2_ctx*, %struct.shuffle2_ctx** %3
%6 = load %struct.prime_current_block*, %struct.prime_current_block** %4
%7 = call i32 @do_early_prime_group_1_7(%struct.shuffle2_ctx* %5, %struct.prime_current_block* %6)
ret void
}

LLVM IR (-O2):
%struct.shuffle2_ctx = type { i32 }
%struct.prime_current_block = type { i32 }
define void @do_early_prime_7(%struct.shuffle2_ctx* %0, %struct.prime_current_block* %1) {
%3 = tail call i32 @do_early_prime_group_1_7(%struct.shuffle2_ctx* %0, %struct.prime_current_block* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ usleep(unsigned long);
void isleep(unsigned long millisecond) {
  usleep((millisecond << 10) - (millisecond << 4) - (millisecond << 3));
}


x86 assembly (clang, -O0):
<isleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
shl    $0xa,%rdi
mov    -0x8(%rbp),%rax
shl    $0x4,%rax
sub    %rax,%rdi
mov    -0x8(%rbp),%rax
shl    $0x3,%rax
sub    %rax,%rdi
call   1030 <usleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isleep>:
imul   $0x3e8,%rdi,%rdi
jmp    1030 <usleep@plt>

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

LLVM IR (-O2):
define void @isleep(i64 %0) {
%2 = mul i64 %0, 1000
%3 = tail call i32 @usleep(i64 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("\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 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @putchar(i32 10)
ret i32 0
}
int simulated_nested_loop_with_and(int p) {
  int k = 0;
  int t = 5;
  int j = 0;
  for (int i = 0; i < 5; i++) {
  B:
    t = 3;
    j++;
    if (k == 0 && j < 100) {
      goto B;
    }
  }
  return k;
}


x86 assembly (clang, -O0):
<simulated_nested_loop_with_and>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    116e <simulated_nested_loop_with_and+0x6e>
jmp    1132 <simulated_nested_loop_with_and+0x32>
movl   $0x3,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    115b <simulated_nested_loop_with_and+0x5b>
cmpl   $0x64,-0x10(%rbp)
jge    115b <simulated_nested_loop_with_and+0x5b>
jmp    1132 <simulated_nested_loop_with_and+0x32>
jmp    1160 <simulated_nested_loop_with_and+0x60>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1123 <simulated_nested_loop_with_and+0x23>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @simulated_nested_loop_with_and(i32 %0) {
ret i32 0
}
/* Variables and functions */
unsigned int sys_call(int, int /*<<< orphan*/, unsigned int, int /*<<< orphan*/,
                      int /*<<< orphan*/);
unsigned int gcd_set_opa(unsigned int val) {
  return sys_call(0x06, 0, val, 0, 0);
}


x86 assembly (clang, -O0):
<gcd_set_opa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x6,%edi
xor    %r8d,%r8d
mov    %r8d,%esi
mov    %r8d,%ecx
call   1030 <sys_call@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd_set_opa>:
mov    %edi,%edx
mov    $0x6,%edi
xor    %esi,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
jmp    1030 <sys_call@plt>

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

LLVM IR (-O2):
define i32 @gcd_set_opa(i32 %0) {
%2 = tail call i32 @sys_call(i32 6, i32 0, i32 %0, i32 0, i32 0)
ret i32 %2
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
scalar_t__ EAGAIN;
scalar_t__ errno;
int read(int, void *, size_t);
ssize_t io_read(int fd, void *buffer, size_t len) {
  ssize_t r = read(fd, buffer, len);
  if (r == -1 && errno != EAGAIN)
    return -3;
  return r;
}


x86 assembly (clang, -O0):
<io_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <read@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    1166 <io_read+0x56>
mov    0x2e99(%rip),%rax
mov    (%rax),%rax
mov    0x2e7f(%rip),%rcx
cmp    (%rcx),%rax
je     1166 <io_read+0x56>
movl   $0xfffffffd,-0x4(%rbp)
jmp    116c <io_read+0x5c>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_read>:
push   %rax
call   1030 <read@plt>
cmp    $0xffffffff,%eax
jne    1136 <io_read+0x26>
mov    0x2ebe(%rip),%rcx
mov    (%rcx),%rdx
mov    0x2ea4(%rip),%rsi
mov    $0xfffffffd,%ecx
cmp    (%rsi),%rdx
jne    1138 <io_read+0x28>
mov    %eax,%ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@errno = global i64 0
@EAGAIN = global i64 0
define i32 @io_read(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i64 %2, i64* %7
%9 = load i32, i32* %5
%10 = load i8*, i8** %6
%11 = load i64, i64* %7
%12 = call i32 @read(i32 %9, i8* %10, i64 %11)
store i32 %12, i32* %8
%13 = load i32, i32* %8
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %20
15: ; preds = %3
%16 = load i64, i64* @errno
%17 = load i64, i64* @EAGAIN
%18 = icmp ne i64 %16, %17
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 -3, i32* %4
br label %22
20: ; preds = %15, %3
%21 = load i32, i32* %8
store i32 %21, i32* %4
br label %22
22: ; preds = %20, %19
%23 = load i32, i32* %4
ret i32 %23
}

LLVM IR (-O2):
@errno = global i64 0
@EAGAIN = global i64 0
define i32 @io_read(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i32 @read(i32 %0, i8* %1, i64 %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = load i64, i64* @errno
%8 = load i64, i64* @EAGAIN
%9 = icmp eq i64 %7, %8
br i1 %9, label %10, label %11
10: ; preds = %6, %3
br label %11
11: ; preds = %6, %10
%12 = phi i32 [ %4, %10 ], [ -3, %6 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ execute_commands(char **, int);
int /*<<< orphan*/ free(char **);
char **get_commands(char *, int *);
int /*<<< orphan*/ remove_end_of_line(char *);
void execute_line(char *cmd_text) {
  char **commands = NULL;
  int num_commands = 0;
  remove_end_of_line(cmd_text);
  commands = get_commands(cmd_text, &num_commands);
  if (num_commands)
    execute_commands(commands, num_commands);
  free(commands);
}


x86 assembly (clang, -O0):
<execute_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <remove_end_of_line@plt>
mov    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <get_commands@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     118b <execute_line+0x4b>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <execute_commands@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execute_line>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movl   $0x0,0xc(%rsp)
call   1040 <remove_end_of_line@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <get_commands@plt>
mov    %rax,%rbx
mov    0xc(%rsp),%esi
test   %esi,%esi
je     1175 <execute_line+0x35>
mov    %rbx,%rdi
call   1050 <execute_commands@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @execute_line(i8* %0) {
%2 = alloca i8*
%3 = alloca i8**
%4 = alloca i32
store i8* %0, i8** %2
store i8** null, i8*** %3
store i32 0, i32* %4
%5 = load i8*, i8** %2
%6 = call i32 @remove_end_of_line(i8* %5)
%7 = load i8*, i8** %2
%8 = call i8** @get_commands(i8* %7, i32* %4)
store i8** %8, i8*** %3
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %1
%12 = load i8**, i8*** %3
%13 = load i32, i32* %4
%14 = call i32 @execute_commands(i8** %12, i32 %13)
br label %15
15: ; preds = %11, %1
%16 = load i8**, i8*** %3
%17 = call i32 @free(i8** %16)
ret void
}

LLVM IR (-O2):
define void @execute_line(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = tail call i32 @remove_end_of_line(i8* %0)
%5 = call i8** @get_commands(i8* %0, i32* %2)
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @execute_commands(i8** %5, i32 %6)
br label %10
10: ; preds = %8, %1
%11 = call i32 @free(i8** %5)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
char *snprintf_wrap(char *, char *, char *);
FILE *open_from_dir(char *path, char *filename) {
  char *realpath = snprintf_wrap("%s%s", path, filename);
  FILE *file = NULL;
  file = fopen(realpath, "rb");
  free(realpath);
  return file;
}


x86 assembly (clang, -O0):
<open_from_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xeb1(%rip),%rdi
call   1050 <snprintf_wrap@plt>
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe9a(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_from_dir>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xebf(%rip),%rdi
call   1050 <snprintf_wrap@plt>
mov    %rax,%rbx
lea    0xeb5(%rip),%rsi
mov    %rax,%rdi
call   1040 <fopen@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [3 x i8] c"rb\00"
define i32* @open_from_dir(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i8* @snprintf_wrap(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8)
store i8* %9, i8** %5
store i32* null, i32** %6
%10 = load i8*, i8** %5
%11 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %11, i32** %6
%12 = load i8*, i8** %5
%13 = call i32 @free(i8* %12)
%14 = load i32*, i32** %6
ret i32* %14
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [3 x i8] c"rb\00"
define noalias i32* @open_from_dir(i8* %0, i8* %1) {
%3 = tail call i8* @snprintf_wrap(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%4 = tail call i32* @fopen(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @free(i8* %3)
ret i32* %4
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
void sk_log_perror(char *str) { perror(str); }


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

x86 assembly (clang, -O2):
<sk_log_perror>:
jmp    1030 <perror@plt>

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

LLVM IR (-O2):
define void @sk_log_perror(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
ret void
}
int __attribute__((no, section("test_section"))) foo(int arg) {
  return 7 * arg;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
imul   $0x7,-0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
lea    0x0(,%rdi,8),%eax
sub    %edi,%eax
ret

LLVM IR (-O0):
define i32 @foo(i32 %0) section "test_section" {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 7, %3
ret i32 %4
}

LLVM IR (-O2):
define i32 @foo(i32 %0) section "test_section" {
%2 = mul nsw i32 %0, 7
ret i32 %2
}
void rop3_145_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  unsigned char stk4;
  stk4 = ~S;
  stk3 = T | stk4;
  stk2 = *D & stk3;
  stk1 = S ^ stk2;
  stk1 = ~stk1;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_145_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0x9(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xe(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xe(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xd(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_145_1_0>:
mov    %esi,%eax
not    %al
or     %al,%dl
mov    (%rdi),%cl
and    %cl,%dl
xor    %sil,%dl
not    %dl
and    %sil,%cl
and    %al,%dl
or     %cl,%dl
mov    %dl,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_145_1_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
%10 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%11 = load i8, i8* %5
%12 = zext i8 %11 to i32
%13 = xor i32 %12, -1
%14 = trunc i32 %13 to i8
store i8 %14, i8* %10
%15 = load i8, i8* %6
%16 = zext i8 %15 to i32
%17 = load i8, i8* %10
%18 = zext i8 %17 to i32
%19 = or i32 %16, %18
%20 = trunc i32 %19 to i8
store i8 %20, i8* %9
%21 = load i8*, i8** %4
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = load i8, i8* %9
%25 = zext i8 %24 to i32
%26 = and i32 %23, %25
%27 = trunc i32 %26 to i8
store i8 %27, i8* %8
%28 = load i8, i8* %5
%29 = zext i8 %28 to i32
%30 = load i8, i8* %8
%31 = zext i8 %30 to i32
%32 = xor i32 %29, %31
%33 = trunc i32 %32 to i8
store i8 %33, i8* %7
%34 = load i8, i8* %7
%35 = zext i8 %34 to i32
%36 = xor i32 %35, -1
%37 = trunc i32 %36 to i8
store i8 %37, i8* %7
%38 = load i8, i8* %7
%39 = zext i8 %38 to i32
%40 = load i8, i8* %5
%41 = zext i8 %40 to i32
%42 = xor i32 %41, -1
%43 = and i32 %39, %42
%44 = load i8*, i8** %4
%45 = load i8, i8* %44
%46 = zext i8 %45 to i32
%47 = load i8, i8* %5
%48 = zext i8 %47 to i32
%49 = and i32 %46, %48
%50 = or i32 %43, %49
%51 = trunc i32 %50 to i8
%52 = load i8*, i8** %4
store i8 %51, i8* %52
ret void
}

LLVM IR (-O2):
define void @rop3_145_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = xor i8 %1, -1
%5 = or i8 %4, %2
%6 = load i8, i8* %0
%7 = and i8 %6, %5
%8 = xor i8 %7, %1
%9 = xor i8 %8, -1
%10 = and i8 %6, %1
%11 = and i8 %9, %4
%12 = or i8 %11, %10
store i8 %12, i8* %0
ret void
}
XMapRaised() {}


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

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

LLVM IR (-O0):
define i32 @XMapRaised() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @XMapRaised() {
ret i32 undef
}
void RTUtf16CalcLatin1Len(void) {}


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

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

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

LLVM IR (-O2):
define void @RTUtf16CalcLatin1Len() {
ret void
}
int test_communications(int bn, int *padc, int *pser) { return (0); }


x86 assembly (clang, -O0):
<test_communications>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_communications(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
ret i32 0
}

LLVM IR (-O2):
define i32 @test_communications(i32 %0, i32* nocapture readnone %1, i32* nocapture readnone %2) {
ret i32 0
}
/* Variables and functions */
char *getExecutablePath();
char *mkString(char *, char *);
int /*<<< orphan*/ run(char *, int /*<<< orphan*/, int /*<<< orphan*/ *, int,
                       char **);
int main(int argc, char **argv) {
  char *binDir;
  char *exePath;
  binDir = getExecutablePath();
  exePath = mkString("%s/haddock.exe", binDir);
  run(exePath, 0, NULL, argc - 1, argv + 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getExecutablePath@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xeab(%rip),%rdi
call   1050 <mkString@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x10(%rbp),%r8
add    $0x8,%r8
xor    %esi,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <run@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <getExecutablePath@plt>
lea    0xeba(%rip),%rdi
mov    %rax,%rsi
call   1050 <mkString@plt>
add    $0xffffffff,%ebp
add    $0x8,%rbx
mov    %rax,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    %ebp,%ecx
mov    %rbx,%r8
call   1040 <run@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%s/haddock.exe\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = call i8* (...) @getExecutablePath()
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = call i8* @mkString(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = load i32, i32* %3
%12 = sub nsw i32 %11, 1
%13 = load i8**, i8*** %4
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = call i32 @run(i8* %10, i32 0, i32* null, i32 %12, i8** %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s/haddock.exe\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i8* (...) @getExecutablePath()
%4 = tail call i8* @mkString(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = add nsw i32 %0, -1
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = tail call i32 @run(i8* %4, i32 0, i32* null, i32 %5, i8** %6)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ perror(char *);
void openFile(FILE **file, char *filename, char *type) {
  if ((*file = fopen(filename, type)) == NULL) {
    perror(filename);
    exit(1);
  }
  return;
}


x86 assembly (clang, -O0):
<openFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <fopen@plt>
mov    -0x8(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
jne    1175 <openFile+0x45>
mov    -0x10(%rbp),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openFile>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1030 <fopen@plt>
mov    %rax,(%rbx)
test   %rax,%rax
je     1155 <openFile+0x25>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %r14,%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
define void @openFile(i32** %0, i8* %1, i8* %2) {
%4 = alloca i32**
%5 = alloca i8*
%6 = alloca i8*
store i32** %0, i32*** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %5
%8 = load i8*, i8** %6
%9 = call i32* @fopen(i8* %7, i8* %8)
%10 = load i32**, i32*** %4
store i32* %9, i32** %10
%11 = icmp eq i32* %9, null
br i1 %11, label %12, label %16
12: ; preds = %3
%13 = load i8*, i8** %5
%14 = call i32 @perror(i8* %13)
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @openFile(i32** nocapture writeonly %0, i8* nocapture %1, i8* nocapture %2) {
%4 = tail call i32* @fopen(i8* %1, i8* %2)
store i32* %4, i32** %0
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @perror(i8* %1)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CmdEndParagraph(int /*<<< orphan*/);
int /*<<< orphan*/ fprintRTF(char *);
void CmdPrintIndex(int code) {
  CmdEndParagraph(0);
  fprintRTF("\\page ");
  fprintRTF("{\\field{\\*\\fldinst{INDEX \\\\c 2}}{\\fldrslt{}}}");
}


x86 assembly (clang, -O0):
<CmdPrintIndex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %edi,%edi
call   1040 <CmdEndParagraph@plt>
lea    0xec7(%rip),%rdi
call   1030 <fprintRTF@plt>
lea    0xec2(%rip),%rdi
call   1030 <fprintRTF@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CmdPrintIndex>:
push   %rax
xor    %edi,%edi
call   1040 <CmdEndParagraph@plt>
lea    0xed1(%rip),%rdi
call   1030 <fprintRTF@plt>
lea    0xecc(%rip),%rdi
pop    %rax
jmp    1030 <fprintRTF@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"\\page \00"
@.str.1 = [46 x i8] c"{\\field{\\*\\fldinst{INDEX \\\\c 2}}{\\fldrslt{}}}\00"
define void @CmdPrintIndex(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @CmdEndParagraph(i32 0)
%4 = call i32 @fprintRTF(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @fprintRTF(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"\\page \00"
@.str.1 = [46 x i8] c"{\\field{\\*\\fldinst{INDEX \\\\c 2}}{\\fldrslt{}}}\00"
define void @CmdPrintIndex(i32 %0) {
%2 = tail call i32 @CmdEndParagraph(i32 0)
%3 = tail call i32 @fprintRTF(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @fprintRTF(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
struct timespec {
  int tv_sec;
  int tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
unsigned long alock_mtime() {
  struct timespec t;
  clock_gettime(CLOCK_MONOTONIC, &t);
  return t.tv_sec * 1000 + t.tv_nsec / 1000000;
}


x86 assembly (clang, -O0):
<alock_mtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1030 <clock_gettime@plt>
imul   $0x3e8,-0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alock_mtime>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1030 <clock_gettime@plt>
movslq (%rsp),%rax
imul   $0x3e8,%rax,%rcx
movslq 0x4(%rsp),%rax
imul   $0x431bde83,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x32,%rax
add    %edx,%eax
cltq
add    %rcx,%rax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
@CLOCK_MONOTONIC = global i32 0
define i64 @alock_mtime() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%6 = load i32, i32* %5
%7 = mul nsw i32 %6, 1000
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%9 = load i32, i32* %8
%10 = sdiv i32 %9, 1000000
%11 = add nsw i32 %10, %7
%12 = sext i32 %11 to i64
ret i64 %12
}
/* Variables and functions */
int /*<<< orphan*/ init_ptr_zero(int *, int /*<<< orphan*/);
void call_init_ptr_zero_good() {
  int x;
  init_ptr_zero(&x, 0);
  int y = x;
}


x86 assembly (clang, -O0):
<call_init_ptr_zero_good>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
xor    %esi,%esi
call   1030 <init_ptr_zero@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_init_ptr_zero_good>:
push   %rax
lea    0x4(%rsp),%rdi
xor    %esi,%esi
call   1030 <init_ptr_zero@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @call_init_ptr_zero_good() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @init_ptr_zero(i32* %1, i32 0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void PrintTreeBlanks(FILE *f, int count) {
  int i;
  for (i = 0; i < count; i++)
    fprintf(f, "  ");
}


x86 assembly (clang, -O0):
<PrintTreeBlanks>:
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    1150 <PrintTreeBlanks+0x40>
mov    -0x8(%rbp),%rdi
lea    0xec3(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <PrintTreeBlanks+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintTreeBlanks>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    114a <PrintTreeBlanks+0x3a>
mov    %esi,%ebx
mov    %rdi,%r14
lea    0xedb(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %r14,%rcx
call   1030 <fwrite@plt>
add    $0xffffffff,%ebx
jne    1130 <PrintTreeBlanks+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c" \00"
define void @PrintTreeBlanks(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 = %13, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %10
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
store i32 %15, i32* %5
br label %6
16: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c" \00"
define void @PrintTreeBlanks(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %9
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ 0, %2 ]
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 2, i64 1, i32* %0)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %1
br i1 %8, label %9, label %4
9: ; preds = %4, %2
ret void
}
/* Variables and functions */
char tolower(char);
void lowerstring(char *str) {
  char *pts;
  for (pts = str; *pts; pts++) {
    *pts = tolower(*pts);
  }
}


x86 assembly (clang, -O0):
<lowerstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1156 <lowerstring+0x46>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <lowerstring+0x14>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @lowerstring(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call signext i8 @tolower(i8 signext %5)
store i8 %7, i8* %6
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
unsigned long testRand(unsigned long previous) {
  return previous * 1103515245 + 12345;
}


x86 assembly (clang, -O0):
<testRand>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
imul   $0x41c64e6d,-0x8(%rbp),%rax
41
add    $0x3039,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<testRand>:
imul   $0x41c64e6d,%rdi,%rax
add    $0x3039,%rax
ret

LLVM IR (-O0):
define i64 @testRand(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = mul i64 %3, 1103515245
%5 = add i64 %4, 12345
ret i64 %5
}

LLVM IR (-O2):
define i64 @testRand(i64 %0) {
%2 = mul i64 %0, 1103515245
%3 = add i64 %2, 12345
ret i64 %3
}
void watchdog_nmi_disable_all(void) {}


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

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

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

LLVM IR (-O2):
define void @watchdog_nmi_disable_all() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ region_write(int, int, int, int);
void i2c_start(void) { region_write(((0xE1800000) + 4), 0x1, 5, 1); }


x86 assembly (clang, -O0):
<i2c_start>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe1800004,%edi
mov    $0x1,%ecx
mov    $0x5,%edx
mov    %ecx,%esi
call   1030 <region_write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_start>:
mov    $0xe1800004,%edi
mov    $0x1,%esi
mov    $0x5,%edx
mov    $0x1,%ecx
jmp    1030 <region_write@plt>

LLVM IR (-O0):
define void @i2c_start() {
%1 = call i32 @region_write(i32 -511705084, i32 1, i32 5, i32 1)
ret void
}

LLVM IR (-O2):
define void @i2c_start() {
%1 = tail call i32 @region_write(i32 -511705084, i32 1, i32 5, i32 1)
ret void
}