xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ memcpy(int *, int *, long);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, long);
int /*<<< orphan*/ serial_init(int);
int init(void) {
  extern int erodata, data_start, edata, bss_start, ebss;
  memcpy(&data_start, &erodata, (long)&edata - (long)&data_start);
  memset(&bss_start, 0, (long)&ebss - (long)&bss_start);
  serial_init(1);
  return 0;
}


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
mov    0x2e8d(%rip),%rdi
mov    0x2e76(%rip),%rdx
sub    %rdi,%rdx
mov    0x2e94(%rip),%rsi
call   1040 <memcpy@plt>
mov    0x2e78(%rip),%rdi
mov    0x2e89(%rip),%rdx
sub    %rdi,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    $0x1,%edi
call   1050 <serial_init@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<init>:
push   %rax
mov    0x2e90(%rip),%rdi
mov    0x2e79(%rip),%rdx
sub    %rdi,%rdx
mov    0x2e97(%rip),%rsi
call   1040 <memcpy@plt>
mov    0x2e7b(%rip),%rdi
mov    0x2e8c(%rip),%rdx
sub    %rdi,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    $0x1,%edi
call   1050 <serial_init@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@data_start = external global i32
@erodata = external global i32
@edata = external global i32
@bss_start = external global i32
@ebss = external global i32
define i32 @init() {
%1 = call i32 @memcpy(i32* @data_start, i32* @erodata, i64 sub nsw (i64 ptrtoint (i32* @edata to i64), i64 ptrtoint (i32* @data_start to i64)))
%2 = call i32 @memset(i32* @bss_start, i32 0, i64 sub nsw (i64 ptrtoint (i32* @ebss to i64), i64 ptrtoint (i32* @bss_start to i64)))
%3 = call i32 @serial_init(i32 1)
ret i32 0
}

LLVM IR (-O2):
@data_start = external global i32
@erodata = external global i32
@edata = external global i32
@bss_start = external global i32
@ebss = external global i32
define i32 @init() {
%1 = tail call i32 @memcpy(i32* @data_start, i32* @erodata, i64 sub (i64 ptrtoint (i32* @edata to i64), i64 ptrtoint (i32* @data_start to i64)))
%2 = tail call i32 @memset(i32* @bss_start, i32 0, i64 sub (i64 ptrtoint (i32* @ebss to i64), i64 ptrtoint (i32* @bss_start to i64)))
%3 = tail call i32 @serial_init(i32 1)
ret i32 0
}
void modif_rear_unit2MODIF_DOTALL() {}


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

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

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

LLVM IR (-O2):
define void @modif_rear_unit2MODIF_DOTALL() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ barrier();
void flush(void) {
  while (((*(volatile unsigned int *)0xc11084cc) & (1 << 22)) == 0) {
    barrier();
  }
}


x86 assembly (clang, -O0):
<flush>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <flush+0x9>
mov    $0xc11084cc,%eax
mov    (%rax),%eax
and    $0x400000,%eax
cmp    $0x0,%eax
jne    113a <flush+0x2a>
mov    $0x0,%al
call   1030 <barrier@plt>
jmp    1119 <flush+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<flush>:
push   %rbx
mov    $0xc11084cc,%ebx
testl  $0x400000,(%rbx)
jne    112f <flush+0x1f>
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <barrier@plt>
testl  $0x400000,(%rbx)
je     1120 <flush+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @flush() {
br label %1
1: ; preds = %5, %0
%2 = load volatile i32, i32* inttoptr (i64 3239085260 to i32*)
%3 = and i32 %2, 4194304
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @barrier()
br label %1
7: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @flush() {
%1 = load volatile i32, i32* inttoptr (i64 3239085260 to i32*)
%2 = and i32 %1, 4194304
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %0, %4
%5 = tail call i32 (...) @barrier()
%6 = load volatile i32, i32* inttoptr (i64 3239085260 to i32*)
%7 = and i32 %6, 4194304
%8 = icmp eq i32 %7, 0
br i1 %8, label %4, label %9
9: ; preds = %4, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void disposeServerSocket(int serverSocket) { (void)close(serverSocket); }


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

x86 assembly (clang, -O2):
<disposeServerSocket>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @disposeServerSocket(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
int adin_get_configuration(int opcode) {
  switch (opcode) {
  case 0:
    return 1;
  case 1:
    return 1;
  case 2:
    return 1;
  }
}


x86 assembly (clang, -O0):
<adin_get_configuration>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     113c <adin_get_configuration+0x3c>
jmp    111a <adin_get_configuration+0x1a>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     1148 <adin_get_configuration+0x48>
jmp    112b <adin_get_configuration+0x2b>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1154 <adin_get_configuration+0x54>
jmp    115b <adin_get_configuration+0x5b>
movl   $0x1,-0x4(%rbp)
jmp    115b <adin_get_configuration+0x5b>
movl   $0x1,-0x4(%rbp)
jmp    115b <adin_get_configuration+0x5b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @adin_get_configuration(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
]
5: ; preds = %1
store i32 1, i32* %2
br label %8
6: ; preds = %1
store i32 1, i32* %2
br label %8
7: ; preds = %1
store i32 1, i32* %2
br label %8
8: ; preds = %5, %6, %7, %1
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @adin_get_configuration(i32 %0) {
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ TtlRead(int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/);
uint32_t TtlReadLock(uint32_t index) {
  do {
  } while (0);
  return TtlRead(index, NULL, 0);
}


x86 assembly (clang, -O0):
<TtlReadLock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
jmp    1120 <TtlReadLock+0x10>
mov    -0x4(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1030 <TtlRead@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TtlReadLock>:
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <TtlRead@plt>

LLVM IR (-O0):
define i32 @TtlReadLock(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %1
br label %4
4: ; preds = %3
%5 = load i32, i32* %2
%6 = call i32 @TtlRead(i32 %5, i32* null, i32 0)
ret i32 %6
}

LLVM IR (-O2):
define i32 @TtlReadLock(i32 %0) {
%2 = tail call i32 @TtlRead(i32 %0, i32* null, i32 0)
ret i32 %2
}
/* Variables and functions */
float AngleNormalize360(float angle) {
  return (360.0 / 65536) * ((int)(angle * (65536 / 360.0)) & 65535);
}


x86 assembly (clang, -O0):
<AngleNormalize360>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeee(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
and    $0xffff,%eax
cvtsi2sd %eax,%xmm1
movsd  0xecd(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<AngleNormalize360>:
cvtss2sd %xmm0,%xmm0
mulsd  0xef4(%rip),%xmm0
cvttsd2si %xmm0,%eax
movzwl %ax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xee6(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @AngleNormalize360(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fmul double %4, 0x4066C16C16C16C17
%6 = fptosi double %5 to i32
%7 = and i32 %6, 65535
%8 = sitofp i32 %7 to double
%9 = fmul double 0x3F76800000000000, %8
%10 = fptrunc double %9 to float
ret float %10
}

LLVM IR (-O2):
define float @AngleNormalize360(float %0) {
%2 = fpext float %0 to double
%3 = fmul double %2, 0x4066C16C16C16C17
%4 = fptosi double %3 to i32
%5 = and i32 %4, 65535
%6 = sitofp i32 %5 to double
%7 = fmul double %6, 0x3F76800000000000
%8 = fptrunc double %7 to float
ret float %8
}
int hash_function(char const *p) {
  int value = 0;
  while (*p != '\0') {
    value = value * 31 + *p++;
    if (value > 2807303)
      value = value % 2807303;
  }
  return value;
}


x86 assembly (clang, -O0):
<hash_function>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115a <hash_function+0x5a>
imul   $0x1f,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x2ad607,-0xc(%rbp)
jle    1155 <hash_function+0x55>
mov    -0xc(%rbp),%eax
mov    $0x2ad607,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
jmp    110f <hash_function+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_function>:
mov    (%rdi),%cl
test   %cl,%cl
je     1150 <hash_function+0x50>
add    $0x1,%rdi
xor    %edx,%edx
mov    %edx,%eax
jmp    111d <hash_function+0x1d>
movzbl (%rdi),%ecx
add    $0x1,%rdi
mov    %eax,%edx
test   %cl,%cl
je     114f <hash_function+0x4f>
movsbl %cl,%ecx
shl    $0x5,%eax
sub    %edx,%eax
add    %ecx,%eax
cmp    $0x2ad608,%eax
jl     1110 <hash_function+0x10>
movslq %eax,%rcx
imul   $0x2fcf6981,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x33,%rcx
add    %edx,%ecx
imul   $0x2ad607,%ecx,%ecx
sub    %ecx,%eax
jmp    1110 <hash_function+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash_function(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %15, %4 ], [ %2, %1 ]
%6 = phi i32 [ %14, %4 ], [ 0, %1 ]
%7 = phi i8* [ %10, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = mul nsw i32 %6, 31
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = add nsw i32 %9, %8
%12 = icmp sgt i32 %11, 2807303
%13 = srem i32 %11, 2807303
%14 = select i1 %12, i32 %13, i32 %11
%15 = load i8, i8* %10
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %4
17: ; preds = %4, %1
%18 = phi i32 [ 0, %1 ], [ %14, %4 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ cgjump(int);
int /*<<< orphan*/ gentext();
void genjump(int dest) {
  gentext();
  cgjump(dest);
}


x86 assembly (clang, -O0):
<genjump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <gentext@plt>
mov    -0x4(%rbp),%edi
call   1030 <cgjump@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genjump>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <gentext@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <cgjump@plt>

LLVM IR (-O0):
define void @genjump(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @gentext()
%4 = load i32, i32* %2
%5 = call i32 @cgjump(i32 %4)
ret void
}

LLVM IR (-O2):
define void @genjump(i32 %0) {
%2 = tail call i32 (...) @gentext()
%3 = tail call i32 @cgjump(i32 %0)
ret void
}
/* Variables and functions */
char *strchr(char *, char);
int cleanresourceUnixToWin(char resource[]) {
  char *cp;
  if (strchr(resource, '/') != NULL) {
    while ((cp = strchr(resource, '/')) != NULL) {
      (*cp) = '\\';
    }
  }
}


x86 assembly (clang, -O0):
<cleanresourceUnixToWin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     1166 <cleanresourceUnixToWin+0x56>
jmp    1139 <cleanresourceUnixToWin+0x29>
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1161 <cleanresourceUnixToWin+0x51>
mov    -0x18(%rbp),%rax
movb   $0x5c,(%rax)
jmp    1139 <cleanresourceUnixToWin+0x29>
jmp    1166 <cleanresourceUnixToWin+0x56>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanresourceUnixToWin>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x2f,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1137 <cleanresourceUnixToWin+0x27>
movb   $0x5c,(%rax)
mov    %rbx,%rdi
jmp    1120 <cleanresourceUnixToWin+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @cleanresourceUnixToWin(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
br i1 %3, label %8, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %6, %4 ], [ %2, %1 ]
store i8 92, i8* %5
%6 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 47)
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %4
8: ; preds = %4, %1
ret i32 undef
}
void null_mute(int mute) {}


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

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

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

LLVM IR (-O2):
define void @null_mute(i32 %0) {
ret void
}
int left(int i) { return (2 * i); }


x86 assembly (clang, -O0):
<left>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<left>:
lea    (%rdi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @left(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}
int num_cmp(void *n1, void *n2) {
  int *na = n1, *nb = n2;
  return (*na < *nb) ? -1 : (*na > *nb) ? 1 : 0;
}


x86 assembly (clang, -O0):
<num_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jge    113b <num_cmp+0x3b>
mov    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1156 <num_cmp+0x56>
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmovg  %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<num_cmp>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

LLVM IR (-O0):
define i32 @num_cmp(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*
store i32* %8, i32** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %6
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = load i32*, i32** %6
%14 = load i32, i32* %13
%15 = icmp slt i32 %12, %14
br i1 %15, label %16, label %17
16: ; preds = %2
br label %25
17: ; preds = %2
%18 = load i32*, i32** %5
%19 = load i32, i32* %18
%20 = load i32*, i32** %6
%21 = load i32, i32* %20
%22 = icmp sgt i32 %19, %21
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 1, i32 0
br label %25
25: ; preds = %17, %16
%26 = phi i32 [ -1, %16 ], [ %24, %17 ]
ret i32 %26
}

LLVM IR (-O2):
define i32 @num_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp slt i32 %5, %6
%8 = icmp sgt i32 %5, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
int nextPos_0(int p) {
  int _tmp037;
  if (p == 0) {
    _tmp037 = 1;
  } else if (p == 1) {
    _tmp037 = 2;
  } else if (p == 2) {
    _tmp037 = 0;
  }
  return _tmp037;
}


x86 assembly (clang, -O0):
<nextPos_0>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    111d <nextPos_0+0x1d>
movl   $0x1,-0x8(%rbp)
jmp    114e <nextPos_0+0x4e>
cmpl   $0x1,-0x4(%rbp)
jne    1133 <nextPos_0+0x33>
movl   $0x2,-0x8(%rbp)
jmp    1149 <nextPos_0+0x49>
cmpl   $0x2,-0x4(%rbp)
jne    1144 <nextPos_0+0x44>
movl   $0x0,-0x8(%rbp)
jmp    1149 <nextPos_0+0x49>
jmp    114e <nextPos_0+0x4e>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nextPos_0>:
xor    %ecx,%ecx
cmp    $0x1,%edi
sete   %cl
add    $0x1,%ecx
xor    %eax,%eax
cmp    $0x2,%edi
cmovne %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @nextPos_0(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i32 2, i32 1
%4 = icmp eq i32 %0, 2
%5 = select i1 %4, i32 0, i32 %3
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void copy(void) {
  int i;
  extern char line[], longest[];
  i = 0;
  printf("Copying\n");
  while ((longest[i] = line[i]) != '\0') {
    ++i;
  }
}


x86 assembly (clang, -O0):
<copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
movslq -0x4(%rbp),%rcx
mov    0x2eb2(%rip),%rax
mov    (%rax,%rcx,1),%al
movslq -0x4(%rbp),%rdx
mov    0x2e94(%rip),%rcx
mov    %al,(%rcx,%rdx,1)
movsbl %al,%eax
cmp    $0x0,%eax
je     1161 <copy+0x51>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112b <copy+0x1b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
mov    0x2ec2(%rip),%rsi
mov    0x2eab(%rip),%rdx
nopl   (%rax)
movzbl (%rsi,%rax,1),%ecx
mov    %cl,(%rdx,%rax,1)
add    $0x1,%rax
test   %cl,%cl
jne    1130 <copy+0x20>
pop    %rax
ret

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

LLVM IR (-O2):
@line = external global [0 x i8]
@longest = external global [0 x i8]
@str = [8 x i8] c"Copying\00"
define void @copy() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %2, %0
%3 = phi i64 [ %8, %2 ], [ 0, %0 ]
%4 = getelementptr inbounds [0 x i8], [0 x i8]* @line, i64 0, i64 %3
%5 = load i8, i8* %4
%6 = getelementptr inbounds [0 x i8], [0 x i8]* @longest, i64 0, i64 %3
store i8 %5, i8* %6
%7 = icmp eq i8 %5, 0
%8 = add nuw i64 %3, 1
br i1 %7, label %9, label %2
9: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  if (argc != 2) {
    printf("I can not haz argument.\n");
    return 1;
  } else {
    printf("I can haz argument: %s\n", argv[1]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     114a <main+0x3a>
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1167 <main+0x57>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    113c <main+0x1c>
mov    0x8(%rsi),%rsi
lea    0xecf(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    114d <main+0x2d>
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"I can not haz argument.\0A\00"
@.str.1 = [24 x i8] c"I can haz argument: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %16
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %13)
br label %15
15: ; preds = %10
store i32 0, i32* %3
br label %16
16: ; preds = %15, %8
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@.str.1 = [24 x i8] c"I can haz argument: %s\0A\00"
@str = [24 x i8] c"I can not haz argument.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
br label %10
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %8)
br label %10
10: ; preds = %6, %4
%11 = phi i32 [ 1, %4 ], [ 0, %6 ]
ret i32 %11
}
int **alloc_grid(int width, int height) { return ((void *)0); }


x86 assembly (clang, -O0):
<alloc_grid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define noalias i32** @alloc_grid(i32 %0, i32 %1) {
ret i32** null
}
/* Type definitions */
typedef int /*<<< orphan*/ pem_password_cb;
typedef int /*<<< orphan*/ d2i_of_void;
typedef int /*<<< orphan*/ PKCS7;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *PEM_ASN1_read(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int /*<<< orphan*/ *, void **,
                                  int /*<<< orphan*/ *, void *);
int /*<<< orphan*/ PEM_STRING_PKCS7;
scalar_t__ d2i_PKCS7;
PKCS7 *PEM_read_PKCS7(FILE *fp, PKCS7 **x, pem_password_cb *cb, void *u) {
  return PEM_ASN1_read((d2i_of_void *)d2i_PKCS7, PEM_STRING_PKCS7, fp,
                       (void **)x, cb, u);
}


x86 assembly (clang, -O0):
<PEM_read_PKCS7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%rdi
mov    0x2eaf(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
call   1030 <PEM_ASN1_read@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PEM_read_PKCS7>:
mov    %rcx,%r9
mov    %rdx,%r8
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%rdi
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
jmp    1030 <PEM_ASN1_read@plt>

LLVM IR (-O0):
@d2i_PKCS7 = global i64 0
@PEM_STRING_PKCS7 = global i32 0
define i32* @PEM_read_PKCS7(i32* %0, i32** %1, i32* %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32**
%7 = alloca i32*
%8 = alloca i8*
store i32* %0, i32** %5
store i32** %1, i32*** %6
store i32* %2, i32** %7
store i8* %3, i8** %8
%9 = load i64, i64* @d2i_PKCS7
%10 = inttoptr i64 %9 to i32*
%11 = load i32, i32* @PEM_STRING_PKCS7
%12 = load i32*, i32** %5
%13 = load i32**, i32*** %6
%14 = bitcast i32** %13 to i8**
%15 = load i32*, i32** %7
%16 = load i8*, i8** %8
%17 = call i32* @PEM_ASN1_read(i32* %10, i32 %11, i32* %12, i8** %14, i32* %15, i8* %16)
ret i32* %17
}

LLVM IR (-O2):
@d2i_PKCS7 = global i64 0
@PEM_STRING_PKCS7 = global i32 0
define i32* @PEM_read_PKCS7(i32* %0, i32** %1, i32* %2, i8* %3) {
%5 = load i64, i64* @d2i_PKCS7
%6 = inttoptr i64 %5 to i32*
%7 = load i32, i32* @PEM_STRING_PKCS7
%8 = bitcast i32** %1 to i8**
%9 = tail call i32* @PEM_ASN1_read(i32* %6, i32 %7, i32* %0, i8** %8, i32* %2, i8* %3)
ret i32* %9
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdout;
void beep() {
  printf("%c", 7);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<beep>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<beep>:
push   %rax
lea    0xed8(%rip),%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@stdout = global i32 0
define void @beep() {
%1 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 7)
%2 = load i32, i32* @stdout
%3 = call i32 @fflush(i32 %2)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@stdout = global i32 0
define void @beep() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 7)
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
ret void
}
int test_imm_94int16_mem(short *val) {
  return ((*val) & (0x94 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_94int16_mem>:
testb  $0x94,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

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

/* Variables and functions */
struct elem *creation_liste(long unsigned int *valeurs, size_t nb_elems) {
  return NULL;
}


x86 assembly (clang, -O0):
<creation_liste>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.elem = type { i32 }
define %struct.elem* @creation_liste(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
ret %struct.elem* null
}

LLVM IR (-O2):
%struct.elem = type { i32 }
define noalias %struct.elem* @creation_liste(i64* nocapture readnone %0, i64 %1) {
ret %struct.elem* null
}
char Lookahead(char *word, int how_far) {
  char letter_ahead = '\0';
  int idx;
  for (idx = 0; word[idx] != '\0' && idx < how_far; idx++)
    ;
  letter_ahead = word[idx];
  return letter_ahead;
}


x86 assembly (clang, -O0):
<Lookahead>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movb   $0x0,-0xd(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x15(%rbp)
je     113c <Lookahead+0x3c>
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
setl   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    114c <Lookahead+0x4c>
jmp    115f <Lookahead+0x5f>
jmp    1151 <Lookahead+0x51>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1116 <Lookahead+0x16>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Lookahead>:
movslq %esi,%rcx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rdi,%rdx,1),%eax
test   %al,%al
je     1124 <Lookahead+0x24>
lea    0x1(%rdx),%rsi
cmp    %rcx,%rdx
mov    %rsi,%rdx
jl     1110 <Lookahead+0x10>
ret

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

LLVM IR (-O2):
define signext i8 @Lookahead(i8* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
br label %4
4: ; preds = %4, %2
%5 = phi i64 [ %11, %4 ], [ 0, %2 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
%9 = icmp slt i64 %5, %3
%10 = select i1 %8, i1 %9, i1 false
%11 = add nuw nsw i64 %5, 1
br i1 %10, label %4, label %12
12: ; preds = %4
ret i8 %7
}
__attribute__((always_)) void flush_kernel_dcache_page(struct page *page) {}


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

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

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

LLVM IR (-O2):
%struct.page = type opaque
define void @flush_kernel_dcache_page(%struct.page* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void die() { exit(-1); }


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffff,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
mov    $0xffffffff,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @die() {
%1 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
define void @die() {
%1 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
bool is_sq_full_impl(int n) { return n == 20; }


x86 assembly (clang, -O0):
<is_sq_full_impl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x14,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_sq_full_impl>:
xor    %eax,%eax
cmp    $0x14,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @is_sq_full_impl(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 20
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @is_sq_full_impl(i32 %0) {
%2 = icmp eq i32 %0, 20
%3 = zext i1 %2 to i32
ret i32 %3
}
void CyBle_Hal_EccPointMult(void) {}


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

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

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

LLVM IR (-O2):
define void @CyBle_Hal_EccPointMult() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(char *);
char *mx_dirname(char *);
char *mx_dirname_forever(char *path) {
  char *dname;
  assert(path);
  do {
    dname = mx_dirname(path);
  } while (!dname);
  return dname;
}


x86 assembly (clang, -O0):
<mx_dirname_forever>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1040 <mx_dirname@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1135 <mx_dirname_forever+0x15>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mx_dirname_forever>:
push   %rbx
mov    %rdi,%rbx
call   1030 <assert@plt>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1040 <mx_dirname@plt>
test   %rax,%rax
je     1130 <mx_dirname_forever+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @mx_dirname_forever(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
br label %3
3: ; preds = %3, %1
%4 = tail call i8* @mx_dirname(i8* %0)
%5 = icmp eq i8* %4, null
br i1 %5, label %3, label %6
6: ; preds = %3
ret i8* %4
}
char *h(a)
char *a;
{ return a; }


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

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

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

LLVM IR (-O2):
define i8* @h(i8* readnone returned %0) {
ret i8* %0
}
/* Type definitions */
typedef int /*<<< orphan*/ r;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int fread(int *, int, int, int /*<<< orphan*/ *);
int getw(FILE *f) {
  int r;
  if (fread(&r, sizeof(r), 1, f) != 1)
    return EOF;
  return r;
}


x86 assembly (clang, -O0):
<getw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x1,%eax
je     114d <getw+0x3d>
mov    0x2ea5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1153 <getw+0x43>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getw>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rcx
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x1,%eax
je     113b <getw+0x2b>
mov    0x2ead(%rip),%rbx
mov    (%rbx),%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define i32 @getw(i32* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @fread(i32* %2, i32 4, i32 1, i32* %0)
%5 = icmp eq i32 %4, 1
%6 = load i32, i32* %2
%7 = load i32, i32* @EOF
%8 = select i1 %5, i32 %6, i32 %7
ret i32 %8
}
/* Variables and functions */
int is_prime(int);
int /*<<< orphan*/ printf(char *, int);
int scanf(char *, int *);
int main() {
  int number, check;
  check = scanf("%d", &number);
  if (!check) {
    printf("%d \n", -1);
  } else {
    printf("%d \n", is_prime(number));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1172 <main+0x42>
lea    0xea0(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <printf@plt>
jmp    1188 <main+0x58>
mov    -0x8(%rbp),%edi
call   1040 <is_prime@plt>
mov    %eax,%esi
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
test   %eax,%eax
je     1153 <main+0x23>
mov    0x4(%rsp),%edi
call   1040 <is_prime@plt>
mov    %eax,%esi
jmp    1158 <main+0x28>
mov    $0xffffffff,%esi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %0
%6 = load i32, i32* %1
%7 = call i32 @is_prime(i32 %6)
br label %8
8: ; preds = %0, %5
%9 = phi i32 [ %7, %5 ], [ -1, %0 ]
%10 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %9)
ret i32 0
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

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


x86 assembly (clang, -O0):
<gettime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq -0x8(%rbp),%xmm1
cvtsi2sdq -0x10(%rbp),%xmm0
movsd  0xec7(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gettime>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdq 0x8(%rsp),%xmm0
mulsd  0xeca(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define double @gettime() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%4 = load i64, i64* %3
%5 = sitofp i64 %4 to double
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%7 = load i64, i64* %6
%8 = sitofp i64 %7 to double
%9 = call double @llvm.fmuladd.f64(double 0x3EB0C6F7A0B5ED8D, double %8, double %5)
ret double %9
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define double @gettime() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = tail call double @llvm.fmuladd.f64(double %9, double 0x3EB0C6F7A0B5ED8D, double %6)
ret double %10
}
/* Variables and functions */
double sin(double);
double sinc(double x) {
  if (x != 0.0)
    return sin(3.14159265358979323846 * x) / (3.14159265358979323846 * x);
  else
    return 1.0;
}


x86 assembly (clang, -O0):
<sinc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    113a <sinc+0x2a>
jp     113a <sinc+0x2a>
jmp    1167 <sinc+0x57>
movsd  0xec6(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movsd  0xeb4(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1174 <sinc+0x64>
movsd  0xe91(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinc>:
push   %rax
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    111d <sinc+0xd>
jnp    1136 <sinc+0x26>
mulsd  0xee3(%rip),%xmm0
movsd  %xmm0,(%rsp)
call   1030 <sin@plt>
divsd  (%rsp),%xmm0
pop    %rax
ret
movsd  0xec2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @sinc(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp une double %4, 0.000000e+00
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = load double, double* %3
%8 = fmul double 0x400921FB54442D18, %7
%9 = call double @sin(double %8)
%10 = load double, double* %3
%11 = fmul double 0x400921FB54442D18, %10
%12 = fdiv double %9, %11
store double %12, double* %2
br label %14
13: ; preds = %1
store double 1.000000e+00, double* %2
br label %14
14: ; preds = %13, %6
%15 = load double, double* %2
ret double %15
}

LLVM IR (-O2):
define double @sinc(double %0) {
%2 = fcmp une double %0, 0.000000e+00
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = fmul double %0, 0x400921FB54442D18
%5 = tail call double @sin(double %4)
%6 = fdiv double %5, %4
br label %7
7: ; preds = %1, %3
%8 = phi double [ %6, %3 ], [ 1.000000e+00, %1 ]
ret double %8
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int rand();
int /*<<< orphan*/ select(int /*<<< orphan*/, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          struct timeval *);
void random_sleep(int timeout_secs) {
  struct timeval timeout;
  timeout.tv_sec = rand() % (timeout_secs + 1);
  timeout.tv_usec = rand() % 1000000;
  select(0, NULL, NULL, NULL, &timeout);
}


x86 assembly (clang, -O0):
<random_sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x10(%rbp),%r8
mov    %rcx,%rsi
mov    %rcx,%rdx
call   1030 <select@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_sleep>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <rand@plt>
add    $0x1,%ebx
cltd
idiv   %ebx
mov    %edx,0x8(%rsp)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x431bde83,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x32,%rcx
add    %edx,%ecx
imul   $0xf4240,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0xc(%rsp)
lea    0x8(%rsp),%r8
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <select@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define void @random_sleep(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timeval
store i32 %0, i32* %2
%4 = call i32 (...) @rand()
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
%7 = srem i32 %4, %6
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
store i32 %7, i32* %8
%9 = call i32 (...) @rand()
%10 = srem i32 %9, 1000000
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
store i32 %10, i32* %11
%12 = call i32 @select(i32 0, i32* null, i32* null, i32* null, %struct.timeval* %3)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define void @random_sleep(i32 %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = tail call i32 (...) @rand()
%5 = add nsw i32 %0, 1
%6 = srem i32 %4, %5
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
store i32 %6, i32* %7
%8 = tail call i32 (...) @rand()
%9 = srem i32 %8, 1000000
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
store i32 %9, i32* %10
%11 = call i32 @select(i32 0, i32* null, i32* null, i32* null, %struct.timeval* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
void vulnerable_function(char *string) {
  char buffer[100];
  strcpy(buffer, string);
}


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

x86 assembly (clang, -O2):
<vulnerable_function>:
sub    $0x68,%rsp
mov    %rdi,%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
add    $0x68,%rsp
ret

LLVM IR (-O0):
define void @vulnerable_function(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 = load i8*, i8** %2
%6 = call i32 @strcpy(i8* %4, i8* %5)
ret void
}

LLVM IR (-O2):
define void @vulnerable_function(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* %0)
ret void
}