xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void *, int);
void fast_memcpy(void *dst, void *src, int width) { memcpy(dst, src, width); }


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

x86 assembly (clang, -O2):
<fast_memcpy>:
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @fast_memcpy(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @memcpy(i8* %7, i8* %8, i32 %9)
ret void
}

LLVM IR (-O2):
define void @fast_memcpy(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @memcpy(i8* %0, i8* %1, i32 %2)
ret void
}
int ldprecf() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @ldprecf() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/, int /*<<< orphan*/);
void func1(void) {
  static int x = 0;
  int y = 0;
  printf("x = %d, y = %d\n", x++, y++);
}


x86 assembly (clang, -O0):
<func1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2f07(%rip),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,0x2efc(%rip)
mov    -0x4(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func1>:
mov    0x2f16(%rip),%esi
lea    0x1(%rsi),%eax
mov    %eax,0x2f0d(%rip)
lea    0xeda(%rip),%rdi
xor    %edx,%edx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@func1.x = internal global i32 0
@.str = [16 x i8] c"x = %d, y = %d\0A\00"
define void @func1() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @func1.x
%3 = add nsw i32 %2, 1
store i32 %3, i32* @func1.x
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 1
store i32 %5, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %4)
ret void
}

LLVM IR (-O2):
@func1.x = internal unnamed_addr global i32 0
@.str = [16 x i8] c"x = %d, y = %d\0A\00"
define void @func1() {
%1 = load i32, i32* @func1.x
%2 = add nsw i32 %1, 1
store i32 %2, i32* @func1.x
%3 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %1, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
void writelines(char *lineptr[], int nlines) {
  while (nlines-- > 0) {
    printf("%s\n", *lineptr++);
  }
}


x86 assembly (clang, -O0):
<writelines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
jle    1158 <writelines+0x48>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%rax
mov    %eax,%esi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
jmp    111f <writelines+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writelines>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
jle    1146 <writelines+0x36>
mov    %esi,%ebp
mov    %rdi,%rbx
add    $0x1,%ebp
lea    0xed9(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%esi
add    $0x8,%rbx
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     1130 <writelines+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @writelines(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = phi i8** [ %8, %4 ], [ %0, %2 ]
%7 = add nsw i32 %5, -1
%8 = getelementptr inbounds i8*, i8** %6, i64 1
%9 = load i8*, i8** %6
%10 = ptrtoint i8* %9 to i64
%11 = trunc i64 %10 to i32
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = icmp ugt i32 %5, 1
br i1 %13, label %4, label %14
14: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
__attribute__((hotpatch(1, 2))) __attribute__((always_)) void hp4(void) {
  printf("hello, world!\n");
}


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"hello, world!\00"
define void @hp4() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int strlen(char const *);
int /*<<< orphan*/ strncpy(char *, char const *, size_t);
size_t strxfrm(char *s1, const char *s2, size_t n) {
  int r;
  if (n)
    strncpy(s1, s2, n);
  r = strlen(s2);
  return r;
}


x86 assembly (clang, -O0):
<strxfrm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1150 <strxfrm+0x30>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strxfrm>:
push   %rbx
mov    %rsi,%rbx
test   %rdx,%rdx
je     1131 <strxfrm+0x11>
mov    %rbx,%rsi
call   1030 <strncpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
pop    %rbx
ret

LLVM IR (-O0):
define i64 @strxfrm(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i64, i64* %6
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %3
%11 = load i8*, i8** %4
%12 = load i8*, i8** %5
%13 = load i64, i64* %6
%14 = call i32 @strncpy(i8* %11, i8* %12, i64 %13)
br label %15
15: ; preds = %10, %3
%16 = load i8*, i8** %5
%17 = call i32 @strlen(i8* %16)
store i32 %17, i32* %7
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
ret i64 %19
}

LLVM IR (-O2):
define i64 @strxfrm(i8* %0, i8* %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @strncpy(i8* %0, i8* %1, i64 %2)
br label %7
7: ; preds = %5, %3
%8 = tail call i32 @strlen(i8* %1)
%9 = sext i32 %8 to i64
ret i64 %9
}
/* Variables and functions */
int /*<<< orphan*/ Fish001();
int /*<<< orphan*/ Fish002();
int /*<<< orphan*/ Fish003();
int /*<<< orphan*/ Fish004();
int /*<<< orphan*/ Fish005();
int /*<<< orphan*/ Fish006();
int /*<<< orphan*/ Fish007();
int /*<<< orphan*/ Fish008();
int /*<<< orphan*/ Fish009();
void Fish_1(void) {
  Fish004();
  Fish005();
  Fish003();
  Fish007();
  Fish006();
  Fish002();
  Fish008();
  Fish009();
  Fish001();
}


x86 assembly (clang, -O0):
<Fish_1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   10a0 <Fish004@plt>
mov    $0x0,%al
call   1030 <Fish005@plt>
mov    $0x0,%al
call   1040 <Fish003@plt>
mov    $0x0,%al
call   1060 <Fish007@plt>
mov    $0x0,%al
call   1090 <Fish006@plt>
mov    $0x0,%al
call   1080 <Fish002@plt>
mov    $0x0,%al
call   10b0 <Fish008@plt>
mov    $0x0,%al
call   1070 <Fish009@plt>
mov    $0x0,%al
call   1050 <Fish001@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fish_1>:
push   %rax
xor    %eax,%eax
call   10a0 <Fish004@plt>
xor    %eax,%eax
call   1030 <Fish005@plt>
xor    %eax,%eax
call   1040 <Fish003@plt>
xor    %eax,%eax
call   1060 <Fish007@plt>
xor    %eax,%eax
call   1090 <Fish006@plt>
xor    %eax,%eax
call   1080 <Fish002@plt>
xor    %eax,%eax
call   10b0 <Fish008@plt>
xor    %eax,%eax
call   1070 <Fish009@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <Fish001@plt>

LLVM IR (-O0):
define void @Fish_1() {
%1 = call i32 (...) @Fish004()
%2 = call i32 (...) @Fish005()
%3 = call i32 (...) @Fish003()
%4 = call i32 (...) @Fish007()
%5 = call i32 (...) @Fish006()
%6 = call i32 (...) @Fish002()
%7 = call i32 (...) @Fish008()
%8 = call i32 (...) @Fish009()
%9 = call i32 (...) @Fish001()
ret void
}

LLVM IR (-O2):
define void @Fish_1() {
%1 = tail call i32 (...) @Fish004()
%2 = tail call i32 (...) @Fish005()
%3 = tail call i32 (...) @Fish003()
%4 = tail call i32 (...) @Fish007()
%5 = tail call i32 (...) @Fish006()
%6 = tail call i32 (...) @Fish002()
%7 = tail call i32 (...) @Fish008()
%8 = tail call i32 (...) @Fish009()
%9 = tail call i32 (...) @Fish001()
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long subwindow;
};
typedef TYPE_1__ XKeyReleasedEvent;

/* Variables and functions */
void set_XKeyReleasedEvent_subwindow(void *_p, unsigned long _v) {
  ((XKeyReleasedEvent *)_p)->subwindow = (unsigned long)_v;
}


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

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

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

LLVM IR (-O2):
define void @set_XKeyReleasedEvent_subwindow(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
/* Variables and functions */
int strcmp(char *, char *);
int compare_header_text(unsigned char header[], char expected[], int loc) {
  char actual[5];
  actual[4] = '\0';
  for (int i = 0; i < 4; i++) {
    actual[i] = header[i + loc];
  }
  return strcmp(expected, actual);
}


x86 assembly (clang, -O0):
<compare_header_text>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movb   $0x0,-0x15(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x4,-0x20(%rbp)
jge    115e <compare_header_text+0x4e>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x20(%rbp),%rax
mov    %cl,-0x19(%rbp,%rax,1)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    112e <compare_header_text+0x1e>
mov    -0x10(%rbp),%rdi
lea    -0x19(%rbp),%rsi
call   1030 <strcmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_header_text>:
push   %rax
mov    %rsi,%rax
movb   $0x0,0x4(%rsp)
movslq %edx,%rcx
mov    (%rdi,%rcx,1),%ecx
mov    %ecx,(%rsp)
mov    %rsp,%rsi
mov    %rax,%rdi
call   1030 <strcmp@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @compare_header_text(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = alloca [5 x i8]
%5 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 4
store i8 0, i8* %6
%7 = sext i32 %2 to i64
%8 = getelementptr i8, i8* %0, i64 %7
%9 = bitcast i8* %8 to i32*
%10 = bitcast [5 x i8]* %4 to i32*
%11 = load i32, i32* %9
store i32 %11, i32* %10
%12 = call i32 @strcmp(i8* dereferenceable(1) %1, i8* %5)
ret i32 %12
}
void vec4_scale(float *dst, float b) {
  dst[0] = dst[0] * b;
  dst[1] = dst[1] * b;
  dst[2] = dst[2] * b;
  dst[3] = dst[3] * b;
}


x86 assembly (clang, -O0):
<vec4_scale>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mulss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mulss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
mulss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movss  0xc(%rax),%xmm0
mulss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec4_scale>:
movups (%rdi),%xmm1
shufps $0x0,%xmm0,%xmm0
mulps  %xmm1,%xmm0
movups %xmm0,(%rdi)
ret

LLVM IR (-O0):
define void @vec4_scale(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 = getelementptr inbounds float, float* %5, i64 0
%7 = load float, float* %6
%8 = load float, float* %4
%9 = fmul float %7, %8
%10 = load float*, float** %3
%11 = getelementptr inbounds float, float* %10, i64 0
store float %9, float* %11
%12 = load float*, float** %3
%13 = getelementptr inbounds float, float* %12, i64 1
%14 = load float, float* %13
%15 = load float, float* %4
%16 = fmul float %14, %15
%17 = load float*, float** %3
%18 = getelementptr inbounds float, float* %17, i64 1
store float %16, float* %18
%19 = load float*, float** %3
%20 = getelementptr inbounds float, float* %19, i64 2
%21 = load float, float* %20
%22 = load float, float* %4
%23 = fmul float %21, %22
%24 = load float*, float** %3
%25 = getelementptr inbounds float, float* %24, i64 2
store float %23, float* %25
%26 = load float*, float** %3
%27 = getelementptr inbounds float, float* %26, i64 3
%28 = load float, float* %27
%29 = load float, float* %4
%30 = fmul float %28, %29
%31 = load float*, float** %3
%32 = getelementptr inbounds float, float* %31, i64 3
store float %30, float* %32
ret void
}

LLVM IR (-O2):
define void @vec4_scale(float* nocapture %0, float %1) {
%3 = bitcast float* %0 to <4 x float>*
%4 = load <4 x float>, <4 x float>* %3
%5 = insertelement <4 x float> poison, float %1, i64 0
%6 = shufflevector <4 x float> %5, <4 x float> poison, <4 x i32> zeroinitializer
%7 = fmul <4 x float> %4, %6
%8 = bitcast float* %0 to <4 x float>*
store <4 x float> %7, <4 x float>* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void putMenu(void) {
  puts("So what do you want?\n");
  puts("Add a student to database.");
  puts("Delete a student from database.");
  puts("Change a student's information.");
}


x86 assembly (clang, -O0):
<putMenu>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
lea    0xeef(%rip),%rdi
call   1030 <puts@plt>
lea    0xefe(%rip),%rdi
call   1030 <puts@plt>
lea    0xf12(%rip),%rdi
call   1030 <puts@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<putMenu>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xef2(%rip),%rdi
call   1030 <puts@plt>
lea    0xf01(%rip),%rdi
call   1030 <puts@plt>
lea    0xf15(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"So what do you want?\0A\00"
@.str.1 = [27 x i8] c"Add a student to database.\00"
@.str.2 = [32 x i8] c"Delete a student from database.\00"
@.str.3 = [32 x i8] c"Change a student's information.\00"
define void @putMenu() {
%1 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @puts(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @puts(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"So what do you want?\0A\00"
@.str.1 = [27 x i8] c"Add a student to database.\00"
@.str.2 = [32 x i8] c"Delete a student from database.\00"
@.str.3 = [32 x i8] c"Change a student's information.\00"
define void @putMenu() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ shm_unget(int);
void shm_ungetp(int *p) {
  if (*p)
    shm_unget(*p);
}


x86 assembly (clang, -O0):
<shm_ungetp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
je     1134 <shm_ungetp+0x24>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <shm_unget@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shm_ungetp>:
mov    (%rdi),%edi
test   %edi,%edi
je     111b <shm_ungetp+0xb>
jmp    1030 <shm_unget@plt>
ret

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

LLVM IR (-O2):
define void @shm_ungetp(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @shm_unget(i32 %2)
br label %6
6: ; preds = %4, %1
ret void
}
int round_V2(double x) {
  if (x > 0)
    return (int)(x + 0.5);
  else
    return (int)(x - 0.5);
}


x86 assembly (clang, -O0):
<round_V2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1134 <round_V2+0x34>
movsd  0xedd(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
jmp    114c <round_V2+0x4c>
movsd  -0x10(%rbp),%xmm0
movsd  0xebf(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_V2>:
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
seta   %al
lea    0xeec(%rip),%rcx
addsd  (%rcx,%rax,8),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @round_V2(double %0) {
%2 = alloca i32
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp ogt double %4, 0.000000e+00
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load double, double* %3
%8 = fadd double %7, 5.000000e-01
%9 = fptosi double %8 to i32
store i32 %9, i32* %2
br label %14
10: ; preds = %1
%11 = load double, double* %3
%12 = fsub double %11, 5.000000e-01
%13 = fptosi double %12 to i32
store i32 %13, i32* %2
br label %14
14: ; preds = %10, %6
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @round_V2(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
%3 = select i1 %2, double 5.000000e-01, double -5.000000e-01
%4 = fadd double %3, %0
%5 = fptosi double %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fixnegzero(char *);
int hputs(char *, char const *, char *);
int /*<<< orphan*/ ra2str(char *, int, double const, int);
int hputra(char *hstring, const char *keyword, const const double ra) {
  char value[30];
  ra2str(value, 30, ra, 3);
  fixnegzero(value);
  return (hputs(hstring, keyword, value));
}


x86 assembly (clang, -O0):
<hputra>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
lea    -0x40(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
mov    $0x1e,%esi
mov    $0x3,%edx
call   1040 <ra2str@plt>
lea    -0x40(%rbp),%rdi
call   1030 <fixnegzero@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   1050 <hputs@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hputra>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x1e,%esi
mov    $0x3,%edx
call   1040 <ra2str@plt>
mov    %r15,%rdi
call   1030 <fixnegzero@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <hputs@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @hputra(i8* %0, i8* %1, double %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double
%7 = alloca [30 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store double %2, double* %6
%8 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%9 = load double, double* %6
%10 = call i32 @ra2str(i8* %8, i32 30, double %9, i32 3)
%11 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%12 = call i32 @fixnegzero(i8* %11)
%13 = load i8*, i8** %4
%14 = load i8*, i8** %5
%15 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%16 = call i32 @hputs(i8* %13, i8* %14, i8* %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @hputra(i8* %0, i8* %1, double %2) {
%4 = alloca [30 x i8]
%5 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%6 = call i32 @ra2str(i8* %5, i32 30, double %2, i32 3)
%7 = call i32 @fixnegzero(i8* %5)
%8 = call i32 @hputs(i8* %0, i8* %1, i8* %5)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ PTHREAD_CANCEL_DISABLE;
int /*<<< orphan*/ pthread_setcancelstate(int /*<<< orphan*/,
                                          int /*<<< orphan*/ *);
void ptcancel_dis(void) {
  pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
}


x86 assembly (clang, -O0):
<ptcancel_dis>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <pthread_setcancelstate@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ptcancel_dis>:
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
jmp    1030 <pthread_setcancelstate@plt>

LLVM IR (-O0):
@PTHREAD_CANCEL_DISABLE = global i32 0
define void @ptcancel_dis() {
%1 = load i32, i32* @PTHREAD_CANCEL_DISABLE
%2 = call i32 @pthread_setcancelstate(i32 %1, i32* null)
ret void
}

LLVM IR (-O2):
@PTHREAD_CANCEL_DISABLE = global i32 0
define void @ptcancel_dis() {
%1 = load i32, i32* @PTHREAD_CANCEL_DISABLE
%2 = tail call i32 @pthread_setcancelstate(i32 %1, i32* null)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ mtrace();
int /*<<< orphan*/ muntrace();
int /*<<< orphan*/ printf(char *, char);
int main() {
  char *s;
  mtrace();
  s = malloc(20);
  printf("0x%x\n", *(s - 4));
  free(s);
  s = malloc(10);
  muntrace();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <mtrace@plt>
mov    $0x14,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
lea    0xe81(%rip),%rdi
movsbl -0x4(%rax),%esi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    $0xa,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <muntrace@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1070 <mtrace@plt>
mov    $0x14,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xe94(%rip),%rdi
xor    %esi,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   1050 <muntrace@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"0x%x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i32 (...) @mtrace()
%4 = call i8* @malloc(i32 20)
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 -4
%7 = load i8, i8* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext %7)
%9 = load i8*, i8** %2
%10 = call i32 @free(i8* %9)
%11 = call i8* @malloc(i32 10)
store i8* %11, i8** %2
%12 = call i32 (...) @muntrace()
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"0x%x\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @mtrace()
%2 = tail call dereferenceable_or_null(20) i8* @malloc(i32 20)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext undef)
%4 = tail call i32 @free(i8* %2)
%5 = tail call i32 (...) @muntrace()
ret i32 0
}
main(void) { return 0; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void f1() {
  int i = 0;
  i++;
  printf("%d\n", i);
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @f1() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
/* Type definitions */
struct sched_param {
  int dummy;
};
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int ENOSYS;
int pthread_getschedparam(pthread_t thread, int *foo,
                          struct sched_param *param) {
  return -ENOSYS;
}


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

x86 assembly (clang, -O2):
<pthread_getschedparam>:
mov    0x2ee1(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
%struct.sched_param = type { i32 }
@ENOSYS = global i32 0
define i32 @pthread_getschedparam(i32 %0, i32* %1, %struct.sched_param* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca %struct.sched_param*
store i32 %0, i32* %4
store i32* %1, i32** %5
store %struct.sched_param* %2, %struct.sched_param** %6
%7 = load i32, i32* @ENOSYS
%8 = sub nsw i32 0, %7
ret i32 %8
}

LLVM IR (-O2):
%struct.sched_param = type { i32 }
@ENOSYS = global i32 0
define i32 @pthread_getschedparam(i32 %0, i32* nocapture readnone %1, %struct.sched_param* nocapture readnone %2) {
%4 = load i32, i32* @ENOSYS
%5 = sub nsw i32 0, %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void _newline(void) { putchar('\n'); }


x86 assembly (clang, -O0):
<_newline>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
call   1030 <putchar@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<_newline>:
mov    $0xa,%edi
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @_newline() {
%1 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
define void @_newline() {
%1 = tail call i32 @putchar(i8 signext 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ writeLog(char *, char *, char *);
void logBadRequest(char *ip, char *get) {
  writeLog(ip, get, "400 Bad Request");
}


x86 assembly (clang, -O0):
<logBadRequest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xed1(%rip),%rdx
call   1030 <writeLog@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logBadRequest>:
lea    0xee9(%rip),%rdx
jmp    1030 <writeLog@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"400 Bad Request\00"
define void @logBadRequest(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @writeLog(i8* %5, i8* %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"400 Bad Request\00"
define void @logBadRequest(i8* %0, i8* %1) {
%3 = tail call i32 @writeLog(i8* %0, i8* %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}
int Operand_ars_decode(unsigned int *valp __attribute__((__unused__))) {
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @Operand_ars_decode(i32* nocapture readnone %0) {
ret i32 0
}
int foo17() { return 17; }


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

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

LLVM IR (-O0):
define i32 @foo17() {
ret i32 17
}

LLVM IR (-O2):
define i32 @foo17() {
ret i32 17
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ little_endian_read_16(int /*<<< orphan*/ const *, int);
uint16_t hci_event_inquiry_result_get_clock_offset(const uint8_t *event) {
  return little_endian_read_16(event, 15);
}


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

x86 assembly (clang, -O2):
<hci_event_inquiry_result_get_clock_offset>:
mov    $0xf,%esi
jmp    1030 <little_endian_read_16@plt>

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

LLVM IR (-O2):
define i32 @hci_event_inquiry_result_get_clock_offset(i32* %0) {
%2 = tail call i32 @little_endian_read_16(i32* %0, i32 15)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ execv(char *, char **);
int /*<<< orphan*/ setresuid(int, int, int);
int main(int argc, char **argv) {
  setresuid(2005, 2005, 2005);
  execv("/wargame/bin/tmpserver4.sh", argv);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x7d5,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1030 <setresuid@plt>
mov    -0x10(%rbp),%rsi
lea    0xeb8(%rip),%rdi
call   1040 <execv@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
mov    $0x7d5,%edi
mov    $0x7d5,%esi
mov    $0x7d5,%edx
call   1030 <setresuid@plt>
lea    0xec1(%rip),%rdi
mov    %rbx,%rsi
call   1040 <execv@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"/wargame/bin/tmpserver4.sh\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @setresuid(i32 2005, i32 2005, i32 2005)
%6 = load i8**, i8*** %4
%7 = call i32 @execv(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8** %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"/wargame/bin/tmpserver4.sh\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @setresuid(i32 2005, i32 2005, i32 2005)
%4 = tail call i32 @execv(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8** %1)
ret i32 0
}
/* Variables and functions */
int ejtag_switch(int, long);
int mips_ejtag_write_b(unsigned int addr, unsigned int data) {
  int cmd[2];
  addr &= 0x1fffffff;
  cmd[0] = addr;
  cmd[1] = data;
  return ejtag_switch(0x2020, (long)cmd);
}


x86 assembly (clang, -O0):
<mips_ejtag_write_b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1fffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    -0x10(%rbp),%rsi
mov    $0x2020,%edi
call   1030 <ejtag_switch@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mips_ejtag_write_b>:
push   %rax
and    $0x1fffffff,%edi
mov    %edi,(%rsp)
mov    %esi,0x4(%rsp)
mov    %rsp,%rsi
mov    $0x2020,%edi
call   1030 <ejtag_switch@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @mips_ejtag_write_b(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [2 x i32]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = and i32 %6, 536870911
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
store i32 %8, i32* %9
%10 = load i32, i32* %4
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
store i32 %10, i32* %11
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%13 = ptrtoint i32* %12 to i64
%14 = call i32 @ejtag_switch(i32 8224, i64 %13)
ret i32 %14
}

LLVM IR (-O2):
define i32 @mips_ejtag_write_b(i32 %0, i32 %1) {
%3 = alloca [2 x i32]
%4 = bitcast [2 x i32]* %3 to i8*
%5 = and i32 %0, 536870911
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
store i32 %5, i32* %6
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
store i32 %1, i32* %7
%8 = ptrtoint [2 x i32]* %3 to i64
%9 = call i32 @ejtag_switch(i32 8224, i64 %8)
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void callback() { exit(0); }


x86 assembly (clang, -O0):
<callback>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<callback>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

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

LLVM IR (-O2):
define void @callback() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
int leftShiftIntMasked2(int v) { return ((v & 0xff) << 8); }


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

x86 assembly (clang, -O2):
<leftShiftIntMasked2>:
shl    $0x8,%edi
movzwl %di,%eax
ret

LLVM IR (-O0):
define i32 @leftShiftIntMasked2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = shl i32 %4, 8
ret i32 %5
}

LLVM IR (-O2):
define i32 @leftShiftIntMasked2(i32 %0) {
%2 = shl i32 %0, 8
%3 = and i32 %2, 65280
ret i32 %3
}
long long qpow(long long a, long long b, long long c) {
  long long p = 1;
  while (b) {
    if (b & 1)
      p = p * a % c;
    a = a * a % c;
    b >>= 1;
  }
  return p;
}


x86 assembly (clang, -O0):
<qpow>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x1,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116c <qpow+0x6c>
mov    -0x10(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     1148 <qpow+0x48>
mov    -0x20(%rbp),%rax
imul   -0x8(%rbp),%rax
cqto
idivq  -0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
imul   -0x8(%rbp),%rax
cqto
idivq  -0x18(%rbp)
mov    %rdx,-0x8(%rbp)
mov    -0x10(%rbp),%rax
sar    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1118 <qpow+0x18>
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<qpow>:
mov    $0x1,%r8d
test   %rsi,%rsi
je     117a <qpow+0x7a>
mov    %rdx,%rcx
jmp    1145 <qpow+0x45>
mov    %r8,%rax
cqto
idiv   %rcx
mov    %rdx,%r8
imul   %rdi,%rdi
mov    %rdi,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     1170 <qpow+0x70>
mov    %rdi,%rax
cqto
idiv   %rcx
mov    %rdx,%rdi
mov    %rsi,%rax
sar    %rax
cmp    $0x1,%rsi
mov    %rax,%rsi
jbe    117a <qpow+0x7a>
test   $0x1,%sil
je     111b <qpow+0x1b>
imul   %rdi,%r8
mov    %r8,%rax
or     %rcx,%rax
shr    $0x20,%rax
jne    1110 <qpow+0x10>
mov    %r8d,%eax
xor    %edx,%edx
div    %ecx
mov    %edx,%r8d
jmp    111b <qpow+0x1b>
nopw   0x0(%rax,%rax,1)
mov    %edi,%eax
xor    %edx,%edx
div    %ecx
mov    %edx,%edi
jmp    1136 <qpow+0x36>
mov    %r8,%rax
ret

LLVM IR (-O0):
define i64 @qpow(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
store i64 1, i64* %7
br label %8
8: ; preds = %21, %3
%9 = load i64, i64* %5
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %29
11: ; preds = %8
%12 = load i64, i64* %5
%13 = and i64 %12, 1
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %11
%16 = load i64, i64* %7
%17 = load i64, i64* %4
%18 = mul nsw i64 %16, %17
%19 = load i64, i64* %6
%20 = srem i64 %18, %19
store i64 %20, i64* %7
br label %21
21: ; preds = %15, %11
%22 = load i64, i64* %4
%23 = load i64, i64* %4
%24 = mul nsw i64 %22, %23
%25 = load i64, i64* %6
%26 = srem i64 %24, %25
store i64 %26, i64* %4
%27 = load i64, i64* %5
%28 = ashr i64 %27, 1
store i64 %28, i64* %5
br label %8
29: ; preds = %8
%30 = load i64, i64* %7
ret i64 %30
}

LLVM IR (-O2):
define i64 @qpow(i64 %0, i64 %1, i64 %2) {
%4 = icmp eq i64 %1, 0
br i1 %4, label %20, label %5
5: ; preds = %3, %14
%6 = phi i64 [ %15, %14 ], [ 1, %3 ]
%7 = phi i64 [ %17, %14 ], [ %0, %3 ]
%8 = phi i64 [ %18, %14 ], [ %1, %3 ]
%9 = and i64 %8, 1
%10 = icmp eq i64 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %5
%12 = mul nsw i64 %6, %7
%13 = srem i64 %12, %2
br label %14
14: ; preds = %11, %5
%15 = phi i64 [ %13, %11 ], [ %6, %5 ]
%16 = mul nsw i64 %7, %7
%17 = srem i64 %16, %2
%18 = ashr i64 %8, 1
%19 = icmp ult i64 %8, 2
br i1 %19, label %20, label %5
20: ; preds = %14, %3
%21 = phi i64 [ 1, %3 ], [ %15, %14 ]
ret i64 %21
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int main(void) {
  char *cricket[3 + ~0] = {"clarke", "kallis"};
  char *ptr = cricket[1 + ~0];
  printf("%c\n", *++ptr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2cea(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2ce7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xebb(%rip),%rdi
movsbl 0x1(%rax),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [7 x i8] c"clarke\00"
@.str.1 = [7 x i8] c"kallis\00"
@__const.main.cricket = [2 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0)]
@.str.2 = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i8*]
%3 = alloca i8*
store i32 0, i32* %1
%4 = bitcast [2 x i8*]* %2 to i8*
%5 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
%6 = load i8*, i8** %5
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i32 1
store i8* %8, i8** %3
%9 = load i8, i8* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 signext %9)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 signext 108)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
size_t strlen(char *);
int /*<<< orphan*/ write(int, char *, size_t);
int main(int argc, char *argv[]) {
  char buf[20];
  size_t nbytes;
  ssize_t bytes_written;
  int fd;
  fd = 1;
  strcpy(buf, "This is a test\n");
  nbytes = strlen(buf);
  bytes_written = write(fd, buf, nbytes);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x40(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xea8(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x38(%rbp)
mov    -0x40(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   1040 <write@plt>
mov    %eax,-0x3c(%rbp)
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xec4(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1040 <write@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"This is a test\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [20 x i8]
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %9
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%13 = call i64 @strlen(i8* %12)
store i64 %13, i64* %7
%14 = load i32, i32* %9
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%16 = load i64, i64* %7
%17 = call i32 @write(i32 %14, i8* %15, i64 %16)
store i32 %17, i32* %8
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"This is a test\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = call i64 @strlen(i8* %4)
%7 = call i32 @write(i32 1, i8* %4, i64 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int strlen(char *);
int n_char(char string[]) {
  int n;
  n = strlen(string);
  if (n > 50) {
    printf("String is longer than 50 characters\n");
  }
  return n;
}


x86 assembly (clang, -O0):
<n_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x32,-0xc(%rbp)
jle    114e <n_char+0x2e>
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<n_char>:
push   %rbx
call   1040 <strlen@plt>
mov    %eax,%ebx
cmp    $0x33,%eax
jl     1139 <n_char+0x19>
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"String is longer than 50 characters\0A\00"
define i32 @n_char(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp sgt i32 %6, 50
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
@str = [36 x i8] c"String is longer than 50 characters\00"
define i32 @n_char(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 50
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i32 %2
}
void counters_in_macro_following_unreachable() {
  return;
  while (0) {
  }
}


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

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

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

LLVM IR (-O2):
define void @counters_in_macro_following_unreachable() {
ret void
}
void ili9340_draw_line(void) {}


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

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

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

LLVM IR (-O2):
define void @ili9340_draw_line() {
ret void
}