xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
void error(char *msg) {
  fprintf(stderr, "%s: %s\n", msg, strerror(errno));
  exit(1);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rdx
mov    %rax,%rcx
lea    0xe91(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2ea3(%rip),%rax
mov    (%rax),%ebp
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xeac(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [8 x i8] c"%s: %s\0A\00"
@errno = global i32 0
define void @error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = load i32, i32* @errno
%4 = tail call i8* @strerror(i32 %3)
%5 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %4)
%6 = tail call i32 @exit(i32 1)
unreachable
}
int clip2(int v, int mn, int mx) {
  if (v > mx)
    return mx;
  if (v < mn)
    return mn;
  return v;
}


x86 assembly (clang, -O0):
<clip2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1124 <clip2+0x24>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <clip2+0x41>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113b <clip2+0x3b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <clip2+0x41>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @clip2(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, %2
%5 = icmp slt i32 %0, %1
%6 = select i1 %5, i32 %1, i32 %0
%7 = select i1 %4, i32 %2, i32 %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ freewpc_init();
int /*<<< orphan*/ native_init();
int main(void) {
  native_init();
  freewpc_init();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <native_init@plt>
mov    $0x0,%al
call   1040 <freewpc_init@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @native_init()
%3 = call i32 (...) @freewpc_init()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @native_init()
%2 = tail call i32 (...) @freewpc_init()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void free_lvector(unsigned int *v, int nl, int nh) {
  free((char *)(v + nl - 1));
}


x86 assembly (clang, -O0):
<free_lvector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
add    $0xfffffffffffffffc,%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_lvector>:
movslq %esi,%rax
lea    (%rdi,%rax,4),%rdi
add    $0xfffffffffffffffc,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_lvector(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %7, i64 %9
%11 = getelementptr inbounds i32, i32* %10, i64 -1
%12 = bitcast i32* %11 to i8*
%13 = call i32 @free(i8* %12)
ret void
}

LLVM IR (-O2):
define void @free_lvector(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = getelementptr inbounds i32, i32* %5, i64 -1
%7 = bitcast i32* %6 to i8*
%8 = tail call i32 @free(i8* %7)
ret void
}
/* Variables and functions */
scalar_t__ close(int);
int /*<<< orphan*/ perror(char *);
int close_socket(int sock_fd) {
  if (close(sock_fd) < 0) {
    perror("Error on closing");
    return -1;
  }
  return 1;
}


x86 assembly (clang, -O0):
<close_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <close@plt>
cmp    $0x0,%rax
jge    1155 <close_socket+0x35>
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    115c <close_socket+0x3c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<close_socket>:
push   %rax
call   1030 <close@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
js     1135 <close_socket+0x15>
pop    %rcx
ret
lea    0xec4(%rip),%rdi
call   1040 <perror@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"Error on closing\00"
define i32 @close_socket(i32 %0) {
%2 = tail call i64 @close(i32 %0)
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ -1, %4 ], [ 1, %1 ]
ret i32 %7
}
/* Variables and functions */
scalar_t__ realloc(int **, int);
void add_to_2D_array(int **array, int new_array_size) {
  array = (int **)realloc(array, new_array_size * sizeof(int **));
}


x86 assembly (clang, -O0):
<add_to_2D_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%esi
call   1030 <realloc@plt>
mov    %rax,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_to_2D_array>:
shl    $0x3,%esi
jmp    1030 <realloc@plt>

LLVM IR (-O0):
define void @add_to_2D_array(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 = sext i32 %6 to i64
%8 = mul i64 %7, 8
%9 = trunc i64 %8 to i32
%10 = call i64 @realloc(i32** %5, i32 %9)
%11 = inttoptr i64 %10 to i32**
store i32** %11, i32*** %3
ret void
}

LLVM IR (-O2):
define void @add_to_2D_array(i32** %0, i32 %1) {
%3 = shl i32 %1, 3
%4 = tail call i64 @realloc(i32** %0, i32 %3)
ret void
}
void crc32Finish(unsigned long *pCrc32) { *pCrc32 = ~(*pCrc32); }


x86 assembly (clang, -O0):
<crc32Finish>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
xor    $0xffffffffffffffff,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<crc32Finish>:
notq   (%rdi)
ret

LLVM IR (-O0):
define void @crc32Finish(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = xor i64 %4, -1
%6 = load i64*, i64** %2
store i64 %5, i64* %6
ret void
}

LLVM IR (-O2):
define void @crc32Finish(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = xor i64 %2, -1
store i64 %3, i64* %0
ret void
}
int f(void) {
  unsigned b = 0;
  if (b > ~0U)
    b = ~0U;
  return b;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jbe    111c <f+0x1c>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* %1
%3 = icmp ugt i32 %2, -1
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 -1, i32* %1
br label %5
5: ; preds = %4, %0
%6 = load i32, i32* %1
ret i32 %6
}

LLVM IR (-O2):
define i32 @f() {
ret i32 0
}
double addTwo(double x, double y) { return x + y; }


x86 assembly (clang, -O0):
<addTwo>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<addTwo>:
addsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @addTwo(double %0, double %1) {
%3 = fadd double %0, %1
ret double %3
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ wcspbrk(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
void uninitvar_wcspbrk(void) {
  wchar_t *cs;
  wchar_t *ct;
  (void)wcspbrk(cs, ct);
}


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

x86 assembly (clang, -O2):
<uninitvar_wcspbrk>:
jmp    1030 <wcspbrk@plt>

LLVM IR (-O0):
define void @uninitvar_wcspbrk() {
%1 = alloca i32*
%2 = alloca i32*
%3 = load i32*, i32** %1
%4 = load i32*, i32** %2
%5 = call i32 @wcspbrk(i32* %3, i32* %4)
ret void
}

LLVM IR (-O2):
define void @uninitvar_wcspbrk() {
%1 = tail call i32 @wcspbrk(i32* undef, i32* undef)
ret void
}
/* Type definitions */
typedef int uint64_t;
typedef scalar_t__ uint32_t;

/* Variables and functions */
uint32_t naive_popcount64(uint64_t x) {
  uint32_t c;
  c = 0;
  while (x != 0) {
    x &= (x - 1);
    c++;
  }
  return c;
}


x86 assembly (clang, -O0):
<naive_popcount64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1136 <naive_popcount64+0x36>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110f <naive_popcount64+0xf>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<naive_popcount64>:
xor    %eax,%eax
test   %edi,%edi
je     111d <naive_popcount64+0x1d>
cs nopw 0x0(%rax,%rax,1)
lea    -0x1(%rdi),%ecx
add    $0x1,%rax
and    %edi,%ecx
mov    %ecx,%edi
jne    1110 <naive_popcount64+0x10>
ret

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

LLVM IR (-O2):
define i64 @naive_popcount64(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %8, %3 ], [ 0, %1 ]
%5 = phi i32 [ %7, %3 ], [ %0, %1 ]
%6 = add nsw i32 %5, -1
%7 = and i32 %6, %5
%8 = add nuw nsw i64 %4, 1
%9 = icmp eq i32 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i64 [ 0, %1 ], [ %8, %3 ]
ret i64 %11
}
void gtk_font_button_new_with_font() {}


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

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

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

LLVM IR (-O2):
define void @gtk_font_button_new_with_font() {
ret void
}
/* Variables and functions */
unsigned char __builtin_inb(unsigned short);
unsigned char inb(unsigned short port) { return __builtin_inb(port); }


x86 assembly (clang, -O0):
<inb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edi
call   1030 <__builtin_inb@plt>
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inb>:
jmp    1030 <__builtin_inb@plt>

LLVM IR (-O0):
define zeroext i8 @inb(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = call zeroext i8 @__builtin_inb(i16 zeroext %3)
ret i8 %4
}

LLVM IR (-O2):
define zeroext i8 @inb(i16 zeroext %0) {
%2 = tail call zeroext i8 @__builtin_inb(i16 zeroext %0)
ret i8 %2
}
/* Type definitions */
struct event_base {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ AMCEventBase_DumpStdout(struct event_base *);
int /*<<< orphan*/ AMCPrintf(char *, int);
void _printStatus(struct event_base *base) {
  AMCPrintf("[SERVER %03d] "
            "event_base status:",
            28);
  AMCEventBase_DumpStdout(base);
}


x86 assembly (clang, -O0):
<_printStatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x1c,%esi
call   1040 <AMCPrintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <AMCEventBase_DumpStdout@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_printStatus>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
mov    $0x1c,%esi
call   1040 <AMCPrintf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <AMCEventBase_DumpStdout@plt>

LLVM IR (-O0):
%struct.event_base = type { i32 }
@.str = [33 x i8] c"[SERVER %03d] event_base status:\00"
define void @_printStatus(%struct.event_base* %0) {
%2 = alloca %struct.event_base*
store %struct.event_base* %0, %struct.event_base** %2
%3 = call i32 @AMCPrintf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 28)
%4 = load %struct.event_base*, %struct.event_base** %2
%5 = call i32 @AMCEventBase_DumpStdout(%struct.event_base* %4)
ret void
}

LLVM IR (-O2):
%struct.event_base = type { i32 }
@.str = [33 x i8] c"[SERVER %03d] event_base status:\00"
define void @_printStatus(%struct.event_base* %0) {
%2 = tail call i32 @AMCPrintf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 28)
%3 = tail call i32 @AMCEventBase_DumpStdout(%struct.event_base* %0)
ret void
}
int is_num(short c) {
  if ((c >= '0') && (c <= '9'))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<is_num>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x6(%rbp)
movswl -0x6(%rbp),%eax
cmp    $0x30,%eax
jl     1131 <is_num+0x31>
movswl -0x6(%rbp),%eax
cmp    $0x39,%eax
jg     1131 <is_num+0x31>
movl   $0x1,-0x4(%rbp)
jmp    1138 <is_num+0x38>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_num>:
add    $0xffffffd0,%edi
xor    %eax,%eax
cmp    $0xa,%di
setb   %al
ret

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

LLVM IR (-O2):
define i32 @is_num(i16 signext %0) {
%2 = add i16 %0, -48
%3 = icmp ult i16 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ gmp_die(char *);
void *realloc(void *, size_t);
void *gmp_default_realloc(void *old, size_t unused_old_size, size_t new_size) {
  void *p;
  p = realloc(old, new_size);
  if (!p)
    gmp_die("gmp_default_realloc: Virtual memory exhausted.");
  return p;
}


x86 assembly (clang, -O0):
<gmp_default_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    115c <gmp_default_realloc+0x3c>
lea    0xea9(%rip),%rdi
call   1040 <gmp_die@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gmp_default_realloc>:
push   %rbx
mov    %rdx,%rsi
call   1030 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113d <gmp_default_realloc+0x1d>
lea    0xec8(%rip),%rdi
call   1040 <gmp_die@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"gmp_default_realloc: Virtual memory exhausted.\00"
define i8* @gmp_default_realloc(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load i8*, i8** %4
%9 = load i64, i64* %6
%10 = call i8* @realloc(i8* %8, i64 %9)
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = icmp ne i8* %11, null
br i1 %12, label %15, label %13
13: ; preds = %3
%14 = call i32 @gmp_die(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %3
%16 = load i8*, i8** %7
ret i8* %16
}

LLVM IR (-O2):
@.str = [47 x i8] c"gmp_default_realloc: Virtual memory exhausted.\00"
define noalias i8* @gmp_default_realloc(i8* nocapture %0, i64 %1, i64 %2) {
%4 = tail call i8* @realloc(i8* %0, i64 %2)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @gmp_die(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret i8* %4
}
unsigned int bitmap_test_bit(const unsigned long *bitmap, unsigned int bit) {
  return 0x1ul &
         (bitmap[((bit) / (sizeof(long) * 8))] >> ((bit) % (sizeof(long) * 8)));
}


x86 assembly (clang, -O0):
<bitmap_test_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shr    $0x6,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0xc(%rbp),%ecx
and    $0x3f,%rcx
shr    %cl,%rax
and    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitmap_test_bit>:
mov    %esi,%ecx
mov    %esi,%eax
shr    $0x3,%eax
and    $0xfffffff8,%eax
mov    (%rdi,%rax,1),%rax
shr    %cl,%rax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @bitmap_test_bit(i64* %0, i32 %1) {
%3 = alloca i64*
%4 = alloca i32
store i64* %0, i64** %3
store i32 %1, i32* %4
%5 = load i64*, i64** %3
%6 = load i32, i32* %4
%7 = zext i32 %6 to i64
%8 = udiv i64 %7, 64
%9 = getelementptr inbounds i64, i64* %5, i64 %8
%10 = load i64, i64* %9
%11 = load i32, i32* %4
%12 = zext i32 %11 to i64
%13 = urem i64 %12, 64
%14 = lshr i64 %10, %13
%15 = and i64 1, %14
%16 = trunc i64 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @bitmap_test_bit(i64* nocapture %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = lshr i64 %3, 6
%5 = getelementptr inbounds i64, i64* %0, i64 %4
%6 = load i64, i64* %5
%7 = and i64 %3, 63
%8 = lshr i64 %6, %7
%9 = trunc i64 %8 to i32
%10 = and i32 %9, 1
ret i32 %10
}
/* Variables and functions */
int strcasecmp(char const *, char const *);
int ls_strcasecmp(const char *a, const char *b) {
  if (a == b) {
    return 0;
  }
  if (a == NULL) {
    return -1;
  }
  if (b == NULL) {
    return 1;
  }
  return strcasecmp(a, b);
}


x86 assembly (clang, -O0):
<ls_strcasecmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    113a <ls_strcasecmp+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    1178 <ls_strcasecmp+0x68>
cmpq   $0x0,-0x10(%rbp)
jne    1151 <ls_strcasecmp+0x41>
movl   $0xffffffff,-0x4(%rbp)
jmp    1178 <ls_strcasecmp+0x68>
cmpq   $0x0,-0x18(%rbp)
jne    1168 <ls_strcasecmp+0x58>
movl   $0x1,-0x4(%rbp)
jmp    1178 <ls_strcasecmp+0x68>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcasecmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_strcasecmp>:
cmp    %rsi,%rdi
je     1124 <ls_strcasecmp+0x14>
test   %rdi,%rdi
je     1127 <ls_strcasecmp+0x17>
test   %rsi,%rsi
je     112d <ls_strcasecmp+0x1d>
jmp    1030 <strcasecmp@plt>
xor    %eax,%eax
ret
mov    $0xffffffff,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @ls_strcasecmp(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, %1
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = icmp eq i8* %0, null
br i1 %5, label %10, label %6
6: ; preds = %4
%7 = icmp eq i8* %1, null
br i1 %7, label %10, label %8
8: ; preds = %6
%9 = tail call i32 @strcasecmp(i8* %0, i8* %1)
br label %10
10: ; preds = %6, %4, %2, %8
%11 = phi i32 [ %9, %8 ], [ 0, %2 ], [ -1, %4 ], [ 1, %6 ]
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *);
int system(char *);
int set_time(char *server) {
  pid_t pid;
  int ret;
  char buf[256];
  sprintf(buf, "ntpdate -b %s > /dev/null", server);
  ret = system(buf);
  return ret;
}


x86 assembly (clang, -O0):
<set_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xebf(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x110(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_time>:
push   %rbx
sub    $0x100,%rsp
mov    %rdi,%rdx
lea    0xece(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"ntpdate -b %s > /dev/null\00"
define i32 @set_time(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca [256 x i8]
store i8* %0, i8** %2
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %2
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%10 = call i32 @system(i8* %9)
store i32 %10, i32* %4
%11 = load i32, i32* %4
ret i32 %11
}

LLVM IR (-O2):
@.str = [26 x i8] c"ntpdate -b %s > /dev/null\00"
define i32 @set_time(i8* %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i32 @system(i8* %3)
ret i32 %5
}
__attribute__((no)) long trampoline_reg_cfg_metadata(unsigned long n1,
                                                     unsigned long n2,
                                                     unsigned long n3,
                                                     unsigned long n4) {
  long ret;
  __asm__ __volatile__("leaq 1f(%%rip), %%r11\n\t"
                       "movq %%r11, %%fs:0x20\n\t"
                       "jmpq *%%gs:0x10000+"
                       "0xF0"
                       "\n\t"
                       "1:\n\t"
                       : "=a"(ret)
                       : "D"(n1), "S"(n2), "d"(n3), "c"(n4)
                       : "memory");
  return ret;
}


x86 assembly (clang, -O0):
<trampoline_reg_cfg_metadata>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0x11(%rip),%r11
mov    %r11,%fs:0x20
jmp    *%gs:0x100f0
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<trampoline_reg_cfg_metadata>:
lea    0x11(%rip),%r11
mov    %r11,%fs:0x20
jmp    *%gs:0x100f0
ret

LLVM IR (-O0):
define i64 @trampoline_reg_cfg_metadata(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%10 = load i64, i64* %5
%11 = load i64, i64* %6
%12 = load i64, i64* %7
%13 = load i64, i64* %8
%14 = call i64 asm sideeffect "leaq 1f(%rip), %r11\0A\09movq %r11, %fs:0x20\0A\09jmpq *%gs:0x10000+0xF0\0A\091:\0A\09", "={ax},{di},{si},{dx},{cx},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %10, i64 %11, i64 %12, i64 %13)
store i64 %14, i64* %9
%15 = load i64, i64* %9
ret i64 %15
}

LLVM IR (-O2):
define i64 @trampoline_reg_cfg_metadata(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = tail call i64 asm sideeffect "leaq 1f(%rip), %r11\0A\09movq %r11, %fs:0x20\0A\09jmpq *%gs:0x10000+0xF0\0A\091:\0A\09", "={ax},{di},{si},{dx},{cx},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %0, i64 %1, i64 %2, i64 %3)
ret i64 %5
}
/* Variables and functions */
scalar_t__ pthread_self();
int thread_get_tid(void) { return (int)pthread_self(); }


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

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

LLVM IR (-O0):
define i32 @thread_get_tid() {
%1 = call i64 (...) @pthread_self()
%2 = trunc i64 %1 to i32
ret i32 %2
}

LLVM IR (-O2):
define i32 @thread_get_tid() {
%1 = tail call i64 (...) @pthread_self()
%2 = trunc i64 %1 to i32
ret i32 %2
}
/* Variables and functions */
int f295(int *);
int f296(int *p) { return f295(p); }


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

x86 assembly (clang, -O2):
<f296>:
jmp    1030 <f295@plt>

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

LLVM IR (-O2):
define i32 @f296(i32* %0) {
%2 = tail call i32 @f295(i32* %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int __android_log_error_write(int tag, const char *subTag, int32_t uid,
                              const char *data, uint32_t dataLen) {
  ((void)tag);
  return 0;
}


x86 assembly (clang, -O0):
<__android_log_error_write>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @__android_log_error_write(i32 %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
store i32 %0, i32* %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%11 = load i32, i32* %6
ret i32 0
}

LLVM IR (-O2):
define i32 @__android_log_error_write(i32 %0, i8* nocapture readnone %1, i32 %2, i8* nocapture readnone %3, i32 %4) {
ret i32 0
}
/* Variables and functions */
int RAND_MAX;
int floor(double);
int prandom_int();
int prandom_int_range(int min, int max) {
  int input = prandom_int();
  double slope = (max - min) / (RAND_MAX - 0);
  int output = floor(slope * input + 0.5);
  output += min;
  return output;
}


x86 assembly (clang, -O0):
<prandom_int_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <prandom_int@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    0x2ea3(%rip),%rcx
mov    (%rcx),%ecx
sub    $0x0,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe94(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1040 <floor@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prandom_int_range>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <prandom_int@plt>
mov    %eax,%ecx
sub    %ebp,%ebx
mov    0x2eaf(%rip),%rsi
mov    %ebx,%eax
cltd
idivl  (%rsi)
cvtsi2sd %eax,%xmm1
cvtsi2sd %ecx,%xmm0
mulsd  %xmm1,%xmm0
addsd  0xeae(%rip),%xmm0
call   1040 <floor@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@RAND_MAX = global i32 0
define i32 @prandom_int_range(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = call i32 (...) @prandom_int()
store i32 %8, i32* %5
%9 = load i32, i32* %4
%10 = load i32, i32* %3
%11 = sub nsw i32 %9, %10
%12 = load i32, i32* @RAND_MAX
%13 = sub nsw i32 %12, 0
%14 = sdiv i32 %11, %13
%15 = sitofp i32 %14 to double
store double %15, double* %6
%16 = load double, double* %6
%17 = load i32, i32* %5
%18 = sitofp i32 %17 to double
%19 = call double @llvm.fmuladd.f64(double %16, double %18, double 5.000000e-01)
%20 = call i32 @floor(double %19)
store i32 %20, i32* %7
%21 = load i32, i32* %3
%22 = load i32, i32* %7
%23 = add nsw i32 %22, %21
store i32 %23, i32* %7
%24 = load i32, i32* %7
ret i32 %24
}

LLVM IR (-O2):
@RAND_MAX = global i32 0
define i32 @prandom_int_range(i32 %0, i32 %1) {
%3 = tail call i32 (...) @prandom_int()
%4 = sub nsw i32 %1, %0
%5 = load i32, i32* @RAND_MAX
%6 = sdiv i32 %4, %5
%7 = sitofp i32 %6 to double
%8 = sitofp i32 %3 to double
%9 = tail call double @llvm.fmuladd.f64(double %7, double %8, double 5.000000e-01)
%10 = tail call i32 @floor(double %9)
%11 = add nsw i32 %10, %0
ret i32 %11
}
int check_prime(int num) {
  int i = 2;
  while (i <= num - 1) {
    if (num % i == 0)
      return 0;
    i = i + 1;
  }
  return 1;
}


x86 assembly (clang, -O0):
<check_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1149 <check_prime+0x49>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    113b <check_prime+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    1150 <check_prime+0x50>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <check_prime+0xe>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_prime>:
mov    $0x1,%ecx
cmp    $0x3,%edi
jl     1120 <check_prime+0x20>
mov    $0x2,%esi
nop
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1123 <check_prime+0x23>
add    $0x1,%esi
cmp    %esi,%edi
jne    1110 <check_prime+0x10>
mov    %ecx,%eax
ret
xor    %ecx,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @check_prime(i32 %0) {
%2 = icmp sgt i32 %0, 2
br i1 %2, label %5, label %10
3: ; preds = %5
%4 = icmp eq i32 %9, %0
br i1 %4, label %10, label %5
5: ; preds = %1, %3
%6 = phi i32 [ %9, %3 ], [ 2, %1 ]
%7 = srem i32 %0, %6
%8 = icmp eq i32 %7, 0
%9 = add nuw nsw i32 %6, 1
br i1 %8, label %10, label %3
10: ; preds = %5, %3, %1
%11 = phi i32 [ 1, %1 ], [ 1, %3 ], [ 0, %5 ]
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char EOF;
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
void printFile(FILE *text) {
  char input = '\0';
  while ((input = fgetc(text)) != EOF) {
    printf("%c", input);
  }
  printf("\n");
  rewind(text);
  return;
}


x86 assembly (clang, -O0):
<printFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0x9(%rbp)
movsbl %al,%eax
mov    0x2e92(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1178 <printFile+0x48>
movsbl -0x9(%rbp),%esi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1140 <printFile+0x10>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <rewind@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printFile>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1050 <fgetc@plt>
mov    0x2ea5(%rip),%r14
cmp    (%r14),%al
je     1165 <printFile+0x35>
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1050 <fgetc@plt>
cmp    (%r14),%al
jne    1150 <printFile+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <rewind@plt>

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

LLVM IR (-O2):
@EOF = global i8 0
define void @printFile(i32* nocapture %0) {
%2 = tail call signext i8 @fgetc(i32* %0)
%3 = load i8, i8* @EOF
%4 = icmp eq i8 %2, %3
br i1 %4, label %12, label %5
5: ; preds = %1, %5
%6 = phi i8 [ %9, %5 ], [ %2, %1 ]
%7 = sext i8 %6 to i32
%8 = tail call i32 @putchar(i32 %7)
%9 = tail call signext i8 @fgetc(i32* %0)
%10 = load i8, i8* @EOF
%11 = icmp eq i8 %9, %10
br i1 %11, label %12, label %5
12: ; preds = %5, %1
%13 = tail call i32 @putchar(i32 10)
%14 = tail call i32 @rewind(i32* %0)
ret void
}
void emit_type_definition_function(
    struct processor_explicatory_state *process_state,
    struct modern_stream *stream, void *stream_state,
    struct modern_vfile *vfile, void *vfile_state) {}


x86 assembly (clang, -O0):
<emit_type_definition_function>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.processor_explicatory_state = type opaque
%struct.modern_stream = type opaque
%struct.modern_vfile = type opaque
define void @emit_type_definition_function(%struct.processor_explicatory_state* %0, %struct.modern_stream* %1, i8* %2, %struct.modern_vfile* %3, i8* %4) {
%6 = alloca %struct.processor_explicatory_state*
%7 = alloca %struct.modern_stream*
%8 = alloca i8*
%9 = alloca %struct.modern_vfile*
%10 = alloca i8*
store %struct.processor_explicatory_state* %0, %struct.processor_explicatory_state** %6
store %struct.modern_stream* %1, %struct.modern_stream** %7
store i8* %2, i8** %8
store %struct.modern_vfile* %3, %struct.modern_vfile** %9
store i8* %4, i8** %10
ret void
}

LLVM IR (-O2):
%struct.processor_explicatory_state = type opaque
%struct.modern_stream = type opaque
%struct.modern_vfile = type opaque
define void @emit_type_definition_function(%struct.processor_explicatory_state* nocapture %0, %struct.modern_stream* nocapture %1, i8* nocapture %2, %struct.modern_vfile* nocapture %3, i8* nocapture %4) {
ret void
}
/* Type definitions */
struct cgi_env_block {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ addenv(struct cgi_env_block *, char *, char const *,
                          char const *);
char *getenv(char const *);
void addenv2(struct cgi_env_block *blk, const char *name) {
  const char *s;
  if ((s = getenv(name)) != NULL)
    addenv(blk, "%s=%s", name, s);
}


x86 assembly (clang, -O0):
<addenv2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     115f <addenv2+0x3f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xea6(%rip),%rsi
call   1040 <addenv@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addenv2>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1153 <addenv2+0x33>
lea    0xec2(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
mov    %rax,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <addenv@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.cgi_env_block = type { i32 }
@.str = [6 x i8] c"%s=%s\00"
define void @addenv2(%struct.cgi_env_block* %0, i8* %1) {
%3 = alloca %struct.cgi_env_block*
%4 = alloca i8*
%5 = alloca i8*
store %struct.cgi_env_block* %0, %struct.cgi_env_block** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i8* @getenv(i8* %6)
store i8* %7, i8** %5
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load %struct.cgi_env_block*, %struct.cgi_env_block** %3
%11 = load i8*, i8** %4
%12 = load i8*, i8** %5
%13 = call i32 @addenv(%struct.cgi_env_block* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %12)
br label %14
14: ; preds = %9, %2
ret void
}

LLVM IR (-O2):
%struct.cgi_env_block = type { i32 }
@.str = [6 x i8] c"%s=%s\00"
define void @addenv2(%struct.cgi_env_block* %0, i8* %1) {
%3 = tail call i8* @getenv(i8* %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @addenv(%struct.cgi_env_block* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %3)
br label %7
7: ; preds = %5, %2
ret void
}
/* Variables and functions */
int alphaBlendConstwithpaintMode(int, int, int);
int alphaPaintConstwith(int sourceWord, int destinationWord) {
  if (sourceWord == 0) {
    return destinationWord;
  }
  return alphaBlendConstwithpaintMode(sourceWord, destinationWord, 1);
}


x86 assembly (clang, -O0):
<alphaPaintConstwith>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1133 <alphaPaintConstwith+0x23>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1146 <alphaPaintConstwith+0x36>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x1,%edx
call   1030 <alphaBlendConstwithpaintMode@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alphaPaintConstwith>:
test   %edi,%edi
je     111e <alphaPaintConstwith+0xe>
mov    $0x1,%edx
jmp    1030 <alphaBlendConstwithpaintMode@plt>
mov    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @alphaPaintConstwith(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @alphaBlendConstwithpaintMode(i32 %0, i32 %1, i32 1)
br label %6
6: ; preds = %2, %4
%7 = phi i32 [ %5, %4 ], [ %1, %2 ]
ret i32 %7
}
void __attribute__((
    __warning__("curl_easy_getinfo expects a pointer to char * for this info")))
__attribute__((__unused__)) __attribute__((__no__))
_curl_easy_getinfo_err_string(void) {
  __asm__("");
}


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

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

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

LLVM IR (-O2):
define void @_curl_easy_getinfo_err_string() {
tail call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
int judge(int n, int endNum) {
  for (int i = 2; i <= endNum; i++) {
    if ((n % i == 0) && (n != i)) {
      return 0;
    } else {
      continue;
    }
  }
  return n;
}


x86 assembly (clang, -O0):
<judge>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x2,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1158 <judge+0x58>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    1145 <judge+0x45>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     1145 <judge+0x45>
movl   $0x0,-0x4(%rbp)
jmp    115e <judge+0x5e>
jmp    114a <judge+0x4a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1111 <judge+0x11>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<judge>:
cmp    $0x2,%esi
jl     112d <judge+0x2d>
neg    %esi
mov    $0x2,%ecx
jmp    111e <judge+0x1e>
xchg   %ax,%ax
lea    (%rsi,%rcx,1),%eax
add    $0x1,%eax
add    $0x1,%ecx
cmp    $0x1,%eax
je     112d <judge+0x2d>
mov    %edi,%eax
cltd
idiv   %ecx
cmp    %ecx,%edi
je     1110 <judge+0x10>
test   %edx,%edx
jne    1110 <judge+0x10>
xor    %edi,%edi
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @judge(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 2, i32* %6
br label %7
7: ; preds = %22, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %5
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %25
11: ; preds = %7
%12 = load i32, i32* %4
%13 = load i32, i32* %6
%14 = srem i32 %12, %13
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %11
%17 = load i32, i32* %4
%18 = load i32, i32* %6
%19 = icmp ne i32 %17, %18
br i1 %19, label %20, label %21
20: ; preds = %16
store i32 0, i32* %3
br label %27
21: ; preds = %16, %11
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 = %7
%26 = load i32, i32* %4
store i32 %26, i32* %3
br label %27
27: ; preds = %25, %20
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
define i32 @judge(i32 %0, i32 %1) {
%3 = icmp slt i32 %1, 2
br i1 %3, label %13, label %7
4: ; preds = %7
%5 = add nuw i32 %8, 1
%6 = icmp eq i32 %8, %1
br i1 %6, label %13, label %7
7: ; preds = %2, %4
%8 = phi i32 [ %5, %4 ], [ 2, %2 ]
%9 = srem i32 %0, %8
%10 = icmp ne i32 %9, 0
%11 = icmp eq i32 %8, %0
%12 = or i1 %11, %10
br i1 %12, label %4, label %13
13: ; preds = %4, %7, %2
%14 = phi i32 [ %0, %2 ], [ 0, %7 ], [ %0, %4 ]
ret i32 %14
}
/* Variables and functions */
int divide(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d\n", divide(+2147483647, 20000));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x7fffffff,%edi
mov    $0x4e20,%esi
call   1030 <divide@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @divide(i32 2147483647, i32 20000)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}