xunge/DecIR huggingface dataset:
/* Variables and functions */
int cmp_cb(const void *a, const void *b) {
  uintptr_t va = *(uintptr_t *)a;
  uintptr_t vb = *(uintptr_t *)b;
  int res = va < vb ? -1 : va > vb ? 1 : 0;
  return res;
}


x86 assembly (clang, -O0):
<cmp_cb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    113d <cmp_cb+0x3d>
mov    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    1155 <cmp_cb+0x55>
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rsi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %rsi,%rdx
cmova  %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_cb>:
mov    (%rdi),%rax
xor    %ecx,%ecx
cmp    (%rsi),%rax
seta   %cl
mov    $0xffffffff,%eax
cmovae %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @cmp_cb(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = bitcast i8* %1 to i64*
%6 = load i64, i64* %5
%7 = icmp ult i64 %4, %6
%8 = icmp ugt i64 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
long SIO1_keypressed(int key) { return 0; }


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ NID_sha512;
int jksengine_digests_init(int /*<<< orphan*/ *, int /*<<< orphan*/);
int jksengine_sha512_init(EVP_MD_CTX *ctx) {
  ;
  return (jksengine_digests_init(ctx, NID_sha512));
}


x86 assembly (clang, -O0):
<jksengine_sha512_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
call   1030 <jksengine_digests_init@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jksengine_sha512_init>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
jmp    1030 <jksengine_digests_init@plt>

LLVM IR (-O0):
@NID_sha512 = global i32 0
define i32 @jksengine_sha512_init(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* @NID_sha512
%5 = call i32 @jksengine_digests_init(i32* %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
@NID_sha512 = global i32 0
define i32 @jksengine_sha512_init(i32* %0) {
%2 = load i32, i32* @NID_sha512
%3 = tail call i32 @jksengine_digests_init(i32* %0, i32 %2)
ret i32 %3
}
unsigned pages(unsigned linesPerPage, unsigned totalLines) {
  if (totalLines % linesPerPage == 0)
    return totalLines / linesPerPage;
  else
    return (totalLines / linesPerPage) + 1;
}


x86 assembly (clang, -O0):
<pages>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
xor    %edx,%edx
divl   -0x8(%rbp)
cmp    $0x0,%edx
jne    112b <pages+0x2b>
mov    -0xc(%rbp),%eax
xor    %edx,%edx
divl   -0x8(%rbp)
mov    %eax,-0x4(%rbp)
jmp    1139 <pages+0x39>
mov    -0xc(%rbp),%eax
xor    %edx,%edx
divl   -0x8(%rbp)
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pages>:
mov    %esi,%eax
xor    %edx,%edx
div    %edi
cmp    $0x1,%edx
sbb    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @pages(i32 %0, i32 %1) {
%3 = urem i32 %1, %0
%4 = icmp ne i32 %3, 0
%5 = udiv i32 %1, %0
%6 = zext i1 %4 to i32
%7 = add i32 %5, %6
ret i32 %7
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ validptr(int *);
void main() {
  int *x;
  int *y;
  int i;
  y = (int *)malloc(100 * sizeof(int));
  x = y;
  i = 0;
  for (; i < 100; i++) {
    validptr(x);
    *x = 0;
    x++;
  }
  return;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x190,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    117c <main+0x5c>
mov    -0x8(%rbp),%rdi
call   1040 <validptr@plt>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1145 <main+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x190,%edi
call   1030 <malloc@plt>
mov    %rax,%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%r14,%rbx,1),%rdi
call   1040 <validptr@plt>
movl   $0x0,(%r14,%rbx,1)
add    $0x4,%rbx
cmp    $0x190,%ebx
jne    1140 <main+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @main() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = call i64 @malloc(i32 400)
%5 = inttoptr i64 %4 to i32*
store i32* %5, i32** %2
%6 = load i32*, i32** %2
store i32* %6, i32** %1
store i32 0, i32* %3
br label %7
7: ; preds = %16, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 100
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = load i32*, i32** %1
%12 = call i32 @validptr(i32* %11)
%13 = load i32*, i32** %1
store i32 0, i32* %13
%14 = load i32*, i32** %1
%15 = getelementptr inbounds i32, i32* %14, i32 1
store i32* %15, i32** %1
br label %16
16: ; preds = %10
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %7
19: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i64 @malloc(i32 400)
%2 = inttoptr i64 %1 to i32*
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %8, %3 ]
%5 = phi i32* [ %2, %0 ], [ %7, %3 ]
%6 = tail call i32 @validptr(i32* %5)
store i32 0, i32* %5
%7 = getelementptr inbounds i32, i32* %5, i64 1
%8 = add nuw nsw i32 %4, 1
%9 = icmp eq i32 %8, 100
br i1 %9, label %10, label %3
10: ; preds = %3
ret void
}
float __fdiv_rd(float x, float y) { return x / y; }


x86 assembly (clang, -O0):
<__fdiv_rd>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<__fdiv_rd>:
divss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @__fdiv_rd(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 = fdiv float %5, %6
ret float %7
}

LLVM IR (-O2):
define float @__fdiv_rd(float %0, float %1) {
%3 = fdiv float %0, %1
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ do_send(int, char *);
void japi_sync_grammar(int sd) { do_send(sd, "SYNCGRAM\n"); }


x86 assembly (clang, -O0):
<japi_sync_grammar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0xedb(%rip),%rsi
call   1030 <do_send@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<japi_sync_grammar>:
lea    0xee9(%rip),%rsi
jmp    1030 <do_send@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"SYNCGRAM\0A\00"
define void @japi_sync_grammar(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @do_send(i32 %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"SYNCGRAM\0A\00"
define void @japi_sync_grammar(i32 %0) {
%2 = tail call i32 @do_send(i32 %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ write(int, char *, int);
char check_args(int ac, char *av, int *p) {
  if (ac < 2 || !(*p = atoi(av))) {
    write(2, "usage ./server port\n", 20);
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<check_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     1155 <check_args+0x35>
mov    -0x10(%rbp),%rdi
call   1040 <atoi@plt>
mov    -0x18(%rbp),%rcx
mov    %eax,(%rcx)
cmp    $0x0,%eax
jne    1174 <check_args+0x54>
mov    $0x2,%edi
lea    0xe9f(%rip),%rsi
mov    $0x14,%edx
call   1030 <write@plt>
movb   $0x1,-0x1(%rbp)
jmp    1178 <check_args+0x58>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_args>:
push   %rbx
cmp    $0x2,%edi
jl     113b <check_args+0x1b>
mov    %rdx,%rbx
mov    %rsi,%rdi
call   1040 <atoi@plt>
mov    %eax,(%rbx)
test   %eax,%eax
je     113b <check_args+0x1b>
xor    %eax,%eax
pop    %rbx
ret
lea    0xebe(%rip),%rsi
mov    $0x2,%edi
mov    $0x14,%edx
call   1030 <write@plt>
mov    $0x1,%al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"usage ./server port\0A\00"
define signext i8 @check_args(i32 %0, i8* %1, i32* %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32*
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32* %2, i32** %7
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 2
br i1 %9, label %15, label %10
10: ; preds = %3
%11 = load i8*, i8** %6
%12 = call i32 @atoi(i8* %11)
%13 = load i32*, i32** %7
store i32 %12, i32* %13
%14 = icmp ne i32 %12, 0
br i1 %14, label %17, label %15
15: ; preds = %10, %3
%16 = call i32 @write(i32 2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 20)
store i8 1, i8* %4
br label %18
17: ; preds = %10
store i8 0, i8* %4
br label %18
18: ; preds = %17, %15
%19 = load i8, i8* %4
ret i8 %19
}

LLVM IR (-O2):
@.str = [21 x i8] c"usage ./server port\0A\00"
define signext i8 @check_args(i32 %0, i8* nocapture %1, i32* nocapture writeonly %2) {
%4 = icmp slt i32 %0, 2
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = tail call i32 @atoi(i8* %1)
store i32 %6, i32* %2
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5, %3
%9 = tail call i32 @write(i32 2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 20)
br label %10
10: ; preds = %5, %8
%11 = phi i8 [ 1, %8 ], [ 0, %5 ]
ret i8 %11
}
/* Variables and functions */
int /*<<< orphan*/ RDP(char *);
int /*<<< orphan*/ RDP_E(char *);
void uc0_rdphalf_2() {
  RDP_E("uc0:rdphalf_2 - IGNORED\n");
  RDP("uc0:rdphalf_2 - IGNORED\n");
}


x86 assembly (clang, -O0):
<uc0_rdphalf_2>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <RDP_E@plt>
lea    0xec9(%rip),%rdi
call   1040 <RDP@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<uc0_rdphalf_2>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <RDP_E@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <RDP@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"uc0:rdphalf_2 - IGNORED\0A\00"
define void @uc0_rdphalf_2() {
%1 = call i32 @RDP_E(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @RDP(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"uc0:rdphalf_2 - IGNORED\0A\00"
define void @uc0_rdphalf_2() {
%1 = tail call i32 @RDP_E(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @RDP(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *strchr_local(char *s, int c) {
  do {
    if (*s == c)
      return s;
  } while (*s++ != '\0');
  return NULL;
}


x86 assembly (clang, -O0):
<strchr_local>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    1128 <strchr_local+0x28>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1150 <strchr_local+0x50>
jmp    112d <strchr_local+0x2d>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    110b <strchr_local+0xb>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr_local>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl (%rax),%ecx
cmp    %esi,%ecx
je     1121 <strchr_local+0x21>
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strchr_local+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strchr_local(i8* %0, i32 %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i8* [ %0, %2 ], [ %9, %8 ]
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, %1
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %4, i64 1
%10 = icmp eq i8 %5, 0
br i1 %10, label %11, label %3
11: ; preds = %8, %3
%12 = phi i8* [ %4, %3 ], [ null, %8 ]
ret i8* %12
}
/* Type definitions */
struct sockaddr {
  int dummy;
};

/* Variables and functions */
scalar_t__ EINPROGRESS;
int connect(int, struct sockaddr *, int);
scalar_t__ errno;
int slp_sockconnect(int sock, struct sockaddr *inetaddr, int addrlen) {
  if ((connect(sock, inetaddr, addrlen)) == -1) {
    if (errno != EINPROGRESS)
      return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<slp_sockconnect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <connect@plt>
cmp    $0xffffffff,%eax
jne    1165 <slp_sockconnect+0x55>
mov    0x2e97(%rip),%rax
mov    (%rax),%rax
mov    0x2e9d(%rip),%rcx
cmp    (%rcx),%rax
je     1160 <slp_sockconnect+0x50>
movl   $0xffffffff,-0x4(%rbp)
jmp    116c <slp_sockconnect+0x5c>
jmp    1165 <slp_sockconnect+0x55>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slp_sockconnect>:
push   %rax
call   1030 <connect@plt>
cmp    $0xffffffff,%eax
jne    1136 <slp_sockconnect+0x26>
mov    0x2eb6(%rip),%rax
mov    (%rax),%rcx
mov    0x2ebc(%rip),%rdx
mov    $0xffffffff,%eax
cmp    (%rdx),%rcx
jne    1138 <slp_sockconnect+0x28>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@errno = global i64 0
@EINPROGRESS = global i64 0
define i32 @slp_sockconnect(i32 %0, %struct.sockaddr* %1, i32 %2) {
%4 = tail call i32 @connect(i32 %0, %struct.sockaddr* %1, i32 %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* @EINPROGRESS
%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 [ 0, %10 ], [ -1, %6 ]
ret i32 %12
}
/* Variables and functions */
uintptr_t lrt_trans_offset(uintptr_t base, uintptr_t t) {
  return (uintptr_t)(t - base);
}


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

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

LLVM IR (-O0):
define i64 @lrt_trans_offset(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* %3
%7 = sub i64 %5, %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @lrt_trans_offset(i64 %0, i64 %1) {
%3 = sub i64 %1, %0
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int my_asm_func();
int my_asm_func_2();
int main(void) {
  assert(my_asm_func() == 42);
  assert(my_asm_func_2() == 42);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <my_asm_func@plt>
cmp    $0x2a,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x0,%al
call   1030 <my_asm_func_2@plt>
cmp    $0x2a,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <my_asm_func@plt>
xor    %edi,%edi
cmp    $0x2a,%eax
sete   %dil
call   1050 <assert@plt>
xor    %eax,%eax
call   1030 <my_asm_func_2@plt>
xor    %edi,%edi
cmp    $0x2a,%eax
sete   %dil
call   1050 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @my_asm_func()
%2 = icmp eq i32 %1, 42
%3 = zext i1 %2 to i32
%4 = call i32 @assert(i32 %3)
%5 = call i32 (...) @my_asm_func_2()
%6 = icmp eq i32 %5, 42
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @my_asm_func()
%2 = icmp eq i32 %1, 42
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 (...) @my_asm_func_2()
%6 = icmp eq i32 %5, 42
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
ret i32 0
}
void task_wait(void) {}


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

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

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

LLVM IR (-O2):
define void @task_wait() {
ret void
}
void *test_anti_range_49(signed char n) {
  extern void *alloc_anti_range_49(signed char) __attribute__((alloc_size(1)));
  if (0x7f - 1 <= n && n <= 0x7f - 1)
    n = 0x7f - 1 - 1;
  return alloc_anti_range_49(n);
}


x86 assembly (clang, -O0):
<test_anti_range_49>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x7e,%eax
cmp    %ecx,%eax
jg     1140 <test_anti_range_49+0x30>
movsbl -0x1(%rbp),%eax
cmp    $0x7e,%eax
jg     1140 <test_anti_range_49+0x30>
movb   $0x7d,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <alloc_anti_range_49@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_anti_range_49>:
cmp    $0x7e,%dil
mov    $0x7d,%eax
cmove  %eax,%edi
jmp    1030 <alloc_anti_range_49@plt>

LLVM IR (-O0):
define i8* @test_anti_range_49(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sle i32 126, %4
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 126
br i1 %9, label %10, label %11
10: ; preds = %6
store i8 125, i8* %2
br label %11
11: ; preds = %10, %6, %1
%12 = load i8, i8* %2
%13 = call i8* @alloc_anti_range_49(i8 signext %12)
ret i8* %13
}

LLVM IR (-O2):
define i8* @test_anti_range_49(i8 signext %0) {
%2 = icmp eq i8 %0, 126
%3 = select i1 %2, i8 125, i8 %0
%4 = tail call i8* @alloc_anti_range_49(i8 signext %3)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void minuscconlyi(unsigned int a, unsigned int b) {
  unsigned int difference = a - b;
  if (difference > a)
    abort();
}


x86 assembly (clang, -O0):
<minuscconlyi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jbe    113a <minuscconlyi+0x2a>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<minuscconlyi>:
cmp    %edi,%esi
ja     1115 <minuscconlyi+0x5>
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @minuscconlyi(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = sub i32 %6, %7
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = load i32, i32* %3
%11 = icmp ugt i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 (...) @abort()
unreachable
14: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @minuscconlyi(i32 %0, i32 %1) {
%3 = icmp ugt i32 %1, %0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @abort()
unreachable
6: ; preds = %2
ret void
}
int is_numeric(char c) { return (c >= 48 && c <= 57); }


x86 assembly (clang, -O0):
<is_numeric>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <is_numeric+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_numeric>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @is_numeric(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @is_numeric(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
double __infer_nondet_double();
int __infer_nondet_int();
double frexp(double value, int *exp) {
  *exp = __infer_nondet_int();
  return __infer_nondet_double();
}


x86 assembly (clang, -O0):
<frexp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <__infer_nondet_int@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1030 <__infer_nondet_double@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<frexp>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <__infer_nondet_int@plt>
mov    %eax,(%rbx)
xor    %eax,%eax
pop    %rbx
jmp    1030 <__infer_nondet_double@plt>

LLVM IR (-O0):
define double @frexp(double %0, i32* %1) {
%3 = alloca double
%4 = alloca i32*
store double %0, double* %3
store i32* %1, i32** %4
%5 = call i32 (...) @__infer_nondet_int()
%6 = load i32*, i32** %4
store i32 %5, i32* %6
%7 = call double (...) @__infer_nondet_double()
ret double %7
}

LLVM IR (-O2):
define double @frexp(double %0, i32* nocapture writeonly %1) {
%3 = tail call i32 (...) @__infer_nondet_int()
store i32 %3, i32* %1
%4 = tail call double (...) @__infer_nondet_double()
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
void dumpdata(int id, int nblue, int nred, int n) {
  int i, j;
  printf("%d: nblue=%d nred=%d -------------------------\n", id, nblue, nred);
}


x86 assembly (clang, -O0):
<dumpdata>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumpdata>:
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
lea    0xee3(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"%d: nblue=%d nred=%d -------------------------\0A\00"
define void @dumpdata(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12, i32 %13)
ret void
}

LLVM IR (-O2):
@.str = [48 x i8] c"%d: nblue=%d nred=%d -------------------------\0A\00"
define void @dumpdata(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
struct timespec {
  int dummy;
};
typedef int /*<<< orphan*/ clockid_t;

/* Variables and functions */
int /*<<< orphan*/ UINT64_MAX;
scalar_t__ clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ timespec_to_nsec(struct timespec);
uint64_t now(clockid_t id) {
  struct timespec ts;
  if (clock_gettime(id, &ts) < 0)
    return UINT64_MAX;
  return timespec_to_nsec(ts);
}


x86 assembly (clang, -O0):
<now>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
cmp    $0x0,%rax
jge    1152 <now+0x32>
mov    0x2e90(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    115d <now+0x3d>
mov    -0x10(%rbp),%edi
call   1040 <timespec_to_nsec@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<now>:
push   %rax
mov    %rsp,%rsi
call   1030 <clock_gettime@plt>
test   %rax,%rax
js     1138 <now+0x18>
mov    (%rsp),%edi
call   1040 <timespec_to_nsec@plt>
pop    %rcx
ret
mov    0x2e99(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@UINT64_MAX = global i32 0
define i32 @now(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.timespec
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i64 @clock_gettime(i32 %5, %struct.timespec* %4)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i32, i32* @UINT64_MAX
store i32 %9, i32* %2
br label %14
10: ; preds = %1
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i32 0, i32 0
%12 = load i32, i32* %11
%13 = call i32 @timespec_to_nsec(i32 %12)
store i32 %13, i32* %2
br label %14
14: ; preds = %10, %8
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@UINT64_MAX = global i32 0
define i32 @now(i32 %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
%4 = call i64 @clock_gettime(i32 %0, %struct.timespec* %2)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i32, i32* @UINT64_MAX
br label %12
8: ; preds = %1
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
%10 = load i32, i32* %9
%11 = call i32 @timespec_to_nsec(i32 %10)
br label %12
12: ; preds = %8, %6
%13 = phi i32 [ %7, %6 ], [ %11, %8 ]
ret i32 %13
}
/* Variables and functions */
scalar_t__ lround(double);
long lroundf(float s) { return (long)lround((double)s); }


x86 assembly (clang, -O0):
<lroundf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <lround@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lroundf>:
cvtss2sd %xmm0,%xmm0
jmp    1030 <lround@plt>

LLVM IR (-O0):
define i64 @lroundf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = call i64 @lround(double %4)
ret i64 %5
}

LLVM IR (-O2):
define i64 @lroundf(float %0) {
%2 = fpext float %0 to double
%3 = tail call i64 @lround(double %2)
ret i64 %3
}
char encoder_pet(char byte) {
  if ((byte >= 'A') && (byte <= 'Z'))
    return ((char)(byte | 0x80));
  if ((byte >= 'a') && (byte <= 'z'))
    return ((char)(byte - 32));
  return (byte);
}


x86 assembly (clang, -O0):
<encoder_pet>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x41,%eax
jl     1135 <encoder_pet+0x35>
movsbl -0x2(%rbp),%eax
cmp    $0x5a,%eax
jg     1135 <encoder_pet+0x35>
movsbl -0x2(%rbp),%eax
or     $0x80,%eax
mov    %al,-0x1(%rbp)
jmp    1164 <encoder_pet+0x64>
movsbl -0x2(%rbp),%eax
cmp    $0x61,%eax
jl     115e <encoder_pet+0x5e>
movsbl -0x2(%rbp),%eax
cmp    $0x7a,%eax
jg     115e <encoder_pet+0x5e>
movsbl -0x2(%rbp),%eax
sub    $0x20,%eax
mov    %al,-0x1(%rbp)
jmp    1164 <encoder_pet+0x64>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<encoder_pet>:
mov    %edi,%eax
lea    -0x41(%rax),%ecx
cmp    $0x19,%cl
ja     110d <encoder_pet+0xd>
or     $0x80,%al
ret
lea    -0x61(%rax),%ecx
lea    -0x20(%rax),%edx
cmp    $0x1a,%cl
movzbl %al,%ecx
movzbl %dl,%eax
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define signext i8 @encoder_pet(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 65
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 90
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = or i32 %13, 128
%15 = trunc i32 %14 to i8
store i8 %15, i8* %2
br label %31
16: ; preds = %7, %1
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = icmp sge i32 %18, 97
br i1 %19, label %20, label %29
20: ; preds = %16
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = icmp sle i32 %22, 122
br i1 %23, label %24, label %29
24: ; preds = %20
%25 = load i8, i8* %3
%26 = sext i8 %25 to i32
%27 = sub nsw i32 %26, 32
%28 = trunc i32 %27 to i8
store i8 %28, i8* %2
br label %31
29: ; preds = %20, %16
%30 = load i8, i8* %3
store i8 %30, i8* %2
br label %31
31: ; preds = %29, %24, %11
%32 = load i8, i8* %2
ret i8 %32
}

LLVM IR (-O2):
define signext i8 @encoder_pet(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = or i8 %0, -128
br label %11
6: ; preds = %1
%7 = add i8 %0, -97
%8 = icmp ult i8 %7, 26
%9 = add i8 %0, -32
%10 = select i1 %8, i8 %9, i8 %0
br label %11
11: ; preds = %6, %4
%12 = phi i8 [ %5, %4 ], [ %10, %6 ]
ret i8 %12
}
int av_video_blank(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @av_video_blank() {
ret i32 0
}
void foo300(int p) {}


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

x86 assembly (clang, -O2):
ret

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

LLVM IR (-O2):
define void @foo300(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ VIM_SIF_I2cWriteByte(unsigned char, unsigned char);
void SensorSetReg_OV6680(unsigned short uAddr, unsigned short uVal) {
  VIM_SIF_I2cWriteByte((unsigned char)uAddr, (unsigned char)uVal);
}


x86 assembly (clang, -O0):
<SensorSetReg_OV6680>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x2(%rbp),%ax
mov    %al,%cl
mov    -0x4(%rbp),%ax
movzbl %cl,%edi
movzbl %al,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SensorSetReg_OV6680>:
movzbl %dil,%edi
movzbl %sil,%esi
jmp    1030 <VIM_SIF_I2cWriteByte@plt>

LLVM IR (-O0):
define void @SensorSetReg_OV6680(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = trunc i16 %5 to i8
%7 = load i16, i16* %4
%8 = trunc i16 %7 to i8
%9 = call i32 @VIM_SIF_I2cWriteByte(i8 zeroext %6, i8 zeroext %8)
ret void
}

LLVM IR (-O2):
define void @SensorSetReg_OV6680(i16 zeroext %0, i16 zeroext %1) {
%3 = trunc i16 %0 to i8
%4 = trunc i16 %1 to i8
%5 = tail call i32 @VIM_SIF_I2cWriteByte(i8 zeroext %3, i8 zeroext %4)
ret void
}
int GetBit(int *tab, int idx) { return (tab[idx >> 5] & (1 << (idx & 31))); }


x86 assembly (clang, -O0):
<GetBit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sar    $0x5,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    -0xc(%rbp),%ecx
and    $0x1f,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetBit>:
mov    %esi,%ecx
mov    %esi,%edx
mov    $0x1,%eax
shl    %cl,%eax
sar    $0x5,%edx
movslq %edx,%rcx
and    (%rdi,%rcx,4),%eax
ret

LLVM IR (-O0):
define i32 @GetBit(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %4
%7 = ashr i32 %6, 5
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %5, i64 %8
%10 = load i32, i32* %9
%11 = load i32, i32* %4
%12 = and i32 %11, 31
%13 = shl i32 1, %12
%14 = and i32 %10, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @GetBit(i32* nocapture %0, i32 %1) {
%3 = ashr i32 %1, 5
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = and i32 %1, 31
%8 = shl nuw i32 1, %7
%9 = and i32 %6, %8
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ process_file(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  FILE *file = fopen(argv[1], "r");
  process_file(file);
  fclose(file);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xeab(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <process_file@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x8(%rsi),%rdi
lea    0xec4(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <process_file@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @process_file(i32* %5)
%7 = tail call i32 @fclose(i32* %5)
ret i32 0
}
/* Type definitions */
struct S {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ abort();
int foo(int *, struct S *);
int main() {
  int i = 1;
  if (foo(&i, (struct S *)&i) != 1)
    abort();
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
lea    -0x8(%rbp),%rsi
lea    -0x8(%rbp),%rdi
call   1040 <foo@plt>
cmp    $0x1,%eax
je     1153 <main+0x33>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x1,0x4(%rsp)
lea    0x4(%rsp),%rdi
mov    %rdi,%rsi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    113f <main+0x1f>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
%struct.S = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
%3 = bitcast i32* %2 to %struct.S*
%4 = call i32 @foo(i32* %2, %struct.S* %3)
%5 = icmp ne i32 %4, 1
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
%struct.S = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%3 = bitcast i32* %1 to %struct.S*
%4 = call i32 @foo(i32* %1, %struct.S* %3)
%5 = icmp eq i32 %4, 1
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
ret i32 0
}
int bulbSwitch(int n) {
  if (n < 2)
    return n;
  int i = 0;
  while (i * i <= n)
    i++;
  return i - 1;
}


x86 assembly (clang, -O0):
<bulbSwitch>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    111c <bulbSwitch+0x1c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114a <bulbSwitch+0x4a>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1141 <bulbSwitch+0x41>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <bulbSwitch+0x23>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bulbSwitch>:
cmp    $0x2,%edi
jge    1108 <bulbSwitch+0x8>
mov    %edi,%eax
ret
mov    $0xfffffffe,%eax
nopl   (%rax)
lea    0x2(%rax),%ecx
imul   %ecx,%ecx
add    $0x1,%eax
cmp    %edi,%ecx
jle    1110 <bulbSwitch+0x10>
ret

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

LLVM IR (-O2):
define i32 @bulbSwitch(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = mul nsw i32 %4, %4
%6 = icmp sgt i32 %5, %0
%7 = add nuw nsw i32 %4, 1
br i1 %6, label %8, label %3
8: ; preds = %3
%9 = add nsw i32 %4, -1
br label %10
10: ; preds = %1, %8
%11 = phi i32 [ %9, %8 ], [ %0, %1 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ trainer_dp_4(int /*<<< orphan*/);
void trainer_dp_4_launcher(void) { trainer_dp_4(0); }


x86 assembly (clang, -O0):
<trainer_dp_4_launcher>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <trainer_dp_4@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<trainer_dp_4_launcher>:
xor    %edi,%edi
jmp    1030 <trainer_dp_4@plt>

LLVM IR (-O0):
define void @trainer_dp_4_launcher() {
%1 = call i32 @trainer_dp_4(i32 0)
ret void
}

LLVM IR (-O2):
define void @trainer_dp_4_launcher() {
%1 = tail call i32 @trainer_dp_4(i32 0)
ret void
}
/* Type definitions */
typedef int uint64_t;
struct pcg_state_128 {
  int dummy;
};

/* Variables and functions */
int pcg_oneseq_128_xsh_rr_64_random_r(struct pcg_state_128 *);
uint64_t pcg_oneseq_128_xsh_rr_64_boundedrand_r(struct pcg_state_128 *rng,
                                                uint64_t bound) {
  uint64_t threshold = -bound % bound;
  for (;;) {
    uint64_t r = pcg_oneseq_128_xsh_rr_64_random_r(rng);
    if (r >= threshold)
      return r % bound;
  }
}


x86 assembly (clang, -O0):
<pcg_oneseq_128_xsh_rr_64_boundedrand_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
sub    -0xc(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <pcg_oneseq_128_xsh_rr_64_random_r@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     1152 <pcg_oneseq_128_xsh_rr_64_boundedrand_r+0x42>
mov    -0x14(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%eax
add    $0x20,%rsp
pop    %rbp
ret
jmp    112b <pcg_oneseq_128_xsh_rr_64_boundedrand_r+0x1b>

x86 assembly (clang, -O2):
<pcg_oneseq_128_xsh_rr_64_boundedrand_r>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <pcg_oneseq_128_xsh_rr_64_random_r@plt>
test   %eax,%eax
js     1120 <pcg_oneseq_128_xsh_rr_64_boundedrand_r+0x10>
cltd
idiv   %ebp
mov    %edx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.pcg_state_128 = type { i32 }
define i32 @pcg_oneseq_128_xsh_rr_64_boundedrand_r(%struct.pcg_state_128* %0, i32 %1) {
%3 = alloca %struct.pcg_state_128*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store %struct.pcg_state_128* %0, %struct.pcg_state_128** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = sub nsw i32 0, %7
%9 = load i32, i32* %4
%10 = srem i32 %8, %9
store i32 %10, i32* %5
br label %11
11: ; preds = %21, %2
%12 = load %struct.pcg_state_128*, %struct.pcg_state_128** %3
%13 = call i32 @pcg_oneseq_128_xsh_rr_64_random_r(%struct.pcg_state_128* %12)
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = load i32, i32* %5
%16 = icmp sge i32 %14, %15
br i1 %16, label %17, label %21
17: ; preds = %11
%18 = load i32, i32* %6
%19 = load i32, i32* %4
%20 = srem i32 %18, %19
ret i32 %20
21: ; preds = %11
br label %11
}

LLVM IR (-O2):
%struct.pcg_state_128 = type { i32 }
define i32 @pcg_oneseq_128_xsh_rr_64_boundedrand_r(%struct.pcg_state_128* %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i32 @pcg_oneseq_128_xsh_rr_64_random_r(%struct.pcg_state_128* %0)
%5 = icmp sgt i32 %4, -1
br i1 %5, label %6, label %3
6: ; preds = %3
%7 = srem i32 %4, %1
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ might_print(char *);
int main(void) {
  char *flag = "UiTHack{format_strings_can_be_scary}";
  might_print(flag);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [37 x i8] c"UiTHack{format_strings_can_be_scary}\00"
define i32 @main() {
%1 = tail call i32 @might_print(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
void esc_prompt(int esc) {
  switch (esc) {
  case 1:
    write(1, "\nTX> ", 5);
    break;
  case 2:
    write(1, "\nEE> ", 5);
    break;
  default:
    write(1, "\nAT> ", 5);
    break;
  }
}


x86 assembly (clang, -O0):
<esc_prompt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x1,%eax
je     1140 <esc_prompt+0x30>
jmp    112f <esc_prompt+0x1f>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     115b <esc_prompt+0x4b>
jmp    1176 <esc_prompt+0x66>
mov    $0x1,%edi
lea    0xeb4(%rip),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
jmp    118c <esc_prompt+0x7c>
mov    $0x1,%edi
lea    0xe9f(%rip),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
jmp    118c <esc_prompt+0x7c>
mov    $0x1,%edi
lea    0xe8a(%rip),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<esc_prompt>:
cmp    $0x2,%edi
lea    0xeec(%rip),%rax
lea    0xeeb(%rip),%rcx
cmove  %rax,%rcx
cmp    $0x1,%edi
lea    0xed1(%rip),%rsi
cmovne %rcx,%rsi
mov    $0x1,%edi
mov    $0x5,%edx
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"\0ATX> \00"
@.str.1 = [6 x i8] c"\0AEE> \00"
@.str.2 = [6 x i8] c"\0AAT> \00"
define void @esc_prompt(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %8 [
i32 1, label %4
i32 2, label %6
]
4: ; preds = %1
%5 = call i32 @write(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
br label %10
6: ; preds = %1
%7 = call i32 @write(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
br label %10
8: ; preds = %1
%9 = call i32 @write(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 5)
br label %10
10: ; preds = %8, %6, %4
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"\0ATX> \00"
@.str.1 = [6 x i8] c"\0AEE> \00"
@.str.2 = [6 x i8] c"\0AAT> \00"
define void @esc_prompt(i32 %0) {
%2 = icmp eq i32 %0, 2
%3 = select i1 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%4 = icmp eq i32 %0, 1
%5 = select i1 %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %3
%6 = tail call i32 @write(i32 1, i8* %5, i32 5)
ret void
}
int waitforready() { return 1; }


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

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

LLVM IR (-O0):
define i32 @waitforready() {
ret i32 1
}

LLVM IR (-O2):
define i32 @waitforready() {
ret i32 1
}