xunge/DecIR huggingface dataset:
int main(int argc, char const *argv[]) {
  char s[] = "))))))(((((((((()())()((((((((((()()()()()()()";
  printf("%s\n", s);
  printf("%d\n", longestValidParentheses(s));
  printf("%s\n", s);
  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)
lea    -0x40(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x2f,%edx
call   1040 <memcpy@plt>
lea    -0x40(%rbp),%rsi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    $0x0,%al
call   1050 <longestValidParentheses@plt>
mov    %eax,%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movups 0xee3(%rip),%xmm0
movups %xmm0,0x1f(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <longestValidParentheses@plt>
lea    0xebb(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.s = [47 x i8] c"))))))(((((((((()())()((((((((((()()()()()()()\00"
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [47 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [47 x i8]* %6 to i8*
%8 = getelementptr inbounds [47 x i8], [47 x i8]* %6, i64 0, i64 0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [47 x i8], [47 x i8]* %6, i64 0, i64 0
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @longestValidParentheses to i32 (i8*, ...)*)(i8* %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds [47 x i8], [47 x i8]* %6, i64 0, i64 0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %13)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [47 x i8] c"))))))(((((((((()())()((((((((((()()()()()()()\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [47 x i8]
%4 = getelementptr inbounds [47 x i8], [47 x i8]* %3, i64 0, i64 0
%5 = call i32 @puts(i8* %4)
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @longestValidParentheses to i32 (i8*, ...)*)(i8* %4)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = call i32 @puts(i8* %4)
ret i32 0
}
const char *Current_Definition(void) {
  return "struct Current {\n"
         "  var (*current)(void);\n"
         "};\n";
}


x86 assembly (clang, -O0):
<Current_Definition>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Current_Definition>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [45 x i8] c"struct Current {\0A var (*current)(void);\0A};\0A\00"
define i8* @Current_Definition() {
ret i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [45 x i8] c"struct Current {\0A var (*current)(void);\0A};\0A\00"
define i8* @Current_Definition() {
ret i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void fn5() {
  printf("sdflkj\n");
  exit(-123);
}


x86 assembly (clang, -O0):
<fn5>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffff85,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<fn5>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffff85,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"sdflkj\0A\00"
define void @fn5() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 -123)
unreachable
}

LLVM IR (-O2):
@str = [7 x i8] c"sdflkj\00"
define void @fn5() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 -123)
unreachable
}
/* Type definitions */
struct list_head {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __list_splice(struct list_head *, struct list_head *);
int /*<<< orphan*/ list_empty(struct list_head *);
__attribute__((always_)) void list_splice(struct list_head *list,
                                          struct list_head *head) {
  if (!list_empty(list))
    __list_splice(list, head);
}


x86 assembly (clang, -O0):
<list_splice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <list_empty@plt>
cmp    $0x0,%eax
jne    114f <list_splice+0x2f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <__list_splice@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_splice>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <list_empty@plt>
test   %eax,%eax
je     113b <list_splice+0x1b>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <__list_splice@plt>

LLVM IR (-O0):
%struct.list_head = type { i32 }
define void @list_splice(%struct.list_head* %0, %struct.list_head* %1) {
%3 = alloca %struct.list_head*
%4 = alloca %struct.list_head*
store %struct.list_head* %0, %struct.list_head** %3
store %struct.list_head* %1, %struct.list_head** %4
%5 = load %struct.list_head*, %struct.list_head** %3
%6 = call i32 @list_empty(%struct.list_head* %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load %struct.list_head*, %struct.list_head** %3
%10 = load %struct.list_head*, %struct.list_head** %4
%11 = call i32 @__list_splice(%struct.list_head* %9, %struct.list_head* %10)
br label %12
12: ; preds = %8, %2
ret void
}

LLVM IR (-O2):
%struct.list_head = type { i32 }
define void @list_splice(%struct.list_head* %0, %struct.list_head* %1) {
%3 = tail call i32 @list_empty(%struct.list_head* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @__list_splice(%struct.list_head* %0, %struct.list_head* %1)
br label %7
7: ; preds = %5, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AG();
int main() {
  AG();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @AG()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ const uint8_t;

/* Variables and functions */
uint8_t
hci_event_synchronous_connection_complete_get_status(const uint8_t *event) {
  return event[2];
}


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

x86 assembly (clang, -O2):
<hci_event_synchronous_connection_complete_get_status>:
mov    0x8(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @hci_event_synchronous_connection_complete_get_status(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 2
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @hci_event_synchronous_connection_complete_get_status(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 2
%3 = load i32, i32* %2
ret i32 %3
}
int dtoi(double x) { return (int)(x + 0.5); }


x86 assembly (clang, -O0):
<dtoi>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dtoi>:
addsd  0xef8(%rip),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @dtoi(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fadd double %3, 5.000000e-01
%5 = fptosi double %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @dtoi(double %0) {
%2 = fadd double %0, 5.000000e-01
%3 = fptosi double %2 to i32
ret i32 %3
}
void gtk_container_get_children() {}


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

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

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

LLVM IR (-O2):
define void @gtk_container_get_children() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ libc_free(char *);
void vcm_free_error(char *err_msg) { libc_free(err_msg); }


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

x86 assembly (clang, -O2):
<vcm_free_error>:
jmp    1030 <libc_free@plt>

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

LLVM IR (-O2):
define void @vcm_free_error(i8* %0) {
%2 = tail call i32 @libc_free(i8* %0)
ret void
}
/* Variables and functions */
int strlen(char *);
scalar_t__ strtod(char *, int /*<<< orphan*/);
void F_ValToFloat(char *str, float *f) {
  str[strlen(str) - 1] = 0;
  *f = (float)strtod(str, 0);
}


x86 assembly (clang, -O0):
<F_ValToFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <strtod@plt>
cvtsi2ss %rax,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<F_ValToFloat>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <strtod@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @F_ValToFloat(i8* %0, float* %1) {
%3 = alloca i8*
%4 = alloca float*
store i8* %0, i8** %3
store float* %1, float** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
%8 = sub nsw i32 %7, 1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %5, i64 %9
store i8 0, i8* %10
%11 = load i8*, i8** %3
%12 = call i64 @strtod(i8* %11, i32 0)
%13 = sitofp i64 %12 to float
%14 = load float*, float** %4
store float %13, float* %14
ret void
}

LLVM IR (-O2):
define void @F_ValToFloat(i8* %0, float* nocapture writeonly %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = add nsw i32 %3, -1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 0, i8* %6
%7 = tail call i64 @strtod(i8* %0, i32 0)
%8 = sitofp i64 %7 to float
store float %8, float* %1
ret void
}
unsigned int k(unsigned int d) { return d % 8; }


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

x86 assembly (clang, -O2):
<k>:
mov    %edi,%eax
and    $0x7,%eax
ret

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

LLVM IR (-O2):
define i32 @k(i32 %0) {
%2 = and i32 %0, 7
ret i32 %2
}
int _is_add_or_sub_flag(const char c) { return c == '-' || c == '+'; }


x86 assembly (clang, -O0):
<_is_add_or_sub_flag>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2d,%ecx
mov    %al,-0x2(%rbp)
je     1129 <_is_add_or_sub_flag+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x2b,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_is_add_or_sub_flag>:
add    $0xd5,%dil
xor    %eax,%eax
test   $0xfd,%dil
sete   %al
ret

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

LLVM IR (-O2):
define i32 @_is_add_or_sub_flag(i8 signext %0) {
%2 = icmp eq i8 %0, 45
%3 = icmp eq i8 %0, 43
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
int f8(v, w)
int v;
int w[v];
{ return 0; }


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

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

LLVM IR (-O0):
define i32 @f8(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 = zext i32 %5 to i64
ret i32 0
}

LLVM IR (-O2):
define i32 @f8(i32 %0, i32* nocapture readnone %1) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int errno;
scalar_t__ ferror(int /*<<< orphan*/ *);
size_t fwrite(void const *, int, size_t, int /*<<< orphan*/ *);
int img_stdio_fwrite(void *obj, const void *buf, size_t num_bytes,
                     size_t *bytes_read) {
  FILE *file = (FILE *)obj;
  *bytes_read = fwrite(buf, 1, num_bytes, file);
  if (ferror(file))
    return errno;
  return 0;
}


x86 assembly (clang, -O0):
<img_stdio_fwrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fwrite@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x30(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
je     1184 <img_stdio_fwrite+0x64>
mov    0x2e66(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    118b <img_stdio_fwrite+0x6b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<img_stdio_fwrite>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    $0x1,%esi
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %rax,(%r14)
mov    %rbx,%rdi
call   1030 <ferror@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1158 <img_stdio_fwrite+0x38>
mov    0x2e8a(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@errno = global i32 0
define i32 @img_stdio_fwrite(i8* nocapture %0, i8* nocapture %1, i64 %2, i64* nocapture writeonly %3) {
%5 = bitcast i8* %0 to i32*
%6 = tail call i64 @fwrite(i8* %1, i32 1, i64 %2, i32* %5)
store i64 %6, i64* %3
%7 = tail call i64 @ferror(i32* %5)
%8 = icmp eq i64 %7, 0
%9 = load i32, i32* @errno
%10 = select i1 %8, i32 0, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ refresh();
void crl_refresh_screen(void) { refresh(); }


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

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

LLVM IR (-O0):
define void @crl_refresh_screen() {
%1 = call i32 (...) @refresh()
ret void
}

LLVM IR (-O2):
define void @crl_refresh_screen() {
%1 = tail call i32 (...) @refresh()
ret void
}
/* Variables and functions */
void *__bound_ptr_add(void *, size_t);
int /*<<< orphan*/ bound_error(char *);
void __bound_check(const void *p, size_t size) {
  if (size == 0)
    return;
  p = __bound_ptr_add((void *)p, size - 1);
  if (p == ((void *)(-2)))
    bound_error("invalid pointer");
}


x86 assembly (clang, -O0):
<__bound_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1140 <__bound_check+0x20>
jmp    1172 <__bound_check+0x52>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
sub    $0x1,%rsi
call   1030 <__bound_ptr_add@plt>
mov    %rax,-0x8(%rbp)
mov    $0xfffffffffffffffe,%rax
cmp    %rax,-0x8(%rbp)
jne    1172 <__bound_check+0x52>
lea    0xe93(%rip),%rdi
call   1040 <bound_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__bound_check>:
test   %rsi,%rsi
je     113a <__bound_check+0x1a>
push   %rax
add    $0xffffffffffffffff,%rsi
call   1030 <__bound_ptr_add@plt>
cmp    $0xfffffffffffffffe,%rax
lea    0x8(%rsp),%rsp
je     113b <__bound_check+0x1b>
ret
lea    0xebe(%rip),%rdi
jmp    1040 <bound_error@plt>

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

LLVM IR (-O2):
@.str = [16 x i8] c"invalid pointer\00"
define void @__bound_check(i8* %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = add i64 %1, -1
%6 = tail call i8* @__bound_ptr_add(i8* %0, i64 %5)
%7 = icmp eq i8* %6, inttoptr (i64 -2 to i8*)
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 @bound_error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %2, %8, %4
ret void
}
/* Variables and functions */
int dRead(int, char *);
int safe_dRead(int addr, char *buf) {
  int result = 0;
  while ((result = dRead(addr, buf))) {
    if (result == 2) {
      return 2;
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<safe_dRead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <dRead@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     1159 <safe_dRead+0x49>
cmpl   $0x2,-0x14(%rbp)
jne    1154 <safe_dRead+0x44>
movl   $0x2,-0x4(%rbp)
jmp    115f <safe_dRead+0x4f>
jmp    1126 <safe_dRead+0x16>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_dRead>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <dRead@plt>
test   $0xfffffffd,%eax
jne    1120 <safe_dRead+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @safe_dRead(i32 %0, i8* %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i32 @dRead(i32 %0, i8* %1)
switch i32 %4, label %3 [
i32 0, label %5
i32 2, label %5
]
5: ; preds = %3, %3
ret i32 %4
}
/* Type definitions */
struct __test_metadata {
  int dummy;
};
struct __fixture_variant_metadata {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ flags_set(struct __test_metadata *);
void wrapper_flags_set(struct __test_metadata *_metadata,
                       struct __fixture_variant_metadata *variant) {
  flags_set(_metadata);
}


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

x86 assembly (clang, -O2):
<wrapper_flags_set>:
jmp    1030 <flags_set@plt>

LLVM IR (-O0):
%struct.__test_metadata = type { i32 }
%struct.__fixture_variant_metadata = type { i32 }
define void @wrapper_flags_set(%struct.__test_metadata* %0, %struct.__fixture_variant_metadata* %1) {
%3 = alloca %struct.__test_metadata*
%4 = alloca %struct.__fixture_variant_metadata*
store %struct.__test_metadata* %0, %struct.__test_metadata** %3
store %struct.__fixture_variant_metadata* %1, %struct.__fixture_variant_metadata** %4
%5 = load %struct.__test_metadata*, %struct.__test_metadata** %3
%6 = call i32 @flags_set(%struct.__test_metadata* %5)
ret void
}

LLVM IR (-O2):
%struct.__test_metadata = type { i32 }
%struct.__fixture_variant_metadata = type { i32 }
define void @wrapper_flags_set(%struct.__test_metadata* %0, %struct.__fixture_variant_metadata* nocapture readnone %1) {
%3 = tail call i32 @flags_set(%struct.__test_metadata* %0)
ret void
}
/* Variables and functions */
int add(int, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int a = 1, b = 2;
  printf("hello eyu\n");
  printf("sum:%d\n", add(a, b));
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed0(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <add@plt>
lea    0xead(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str.1 = [8 x i8] c"sum:%d\0A\00"
@str = [10 x i8] c"hello eyu\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @add(i32 1, i32 2)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %2)
ret i32 0
}
/* Variables and functions */
int func1();
int func2();
int main(void) { return (func1() == 4 && func2() == 7) ? 0 : 1; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <func1@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x4,%ecx
mov    %al,-0x5(%rbp)
jne    1156 <main+0x36>
mov    $0x0,%al
call   1040 <func2@plt>
cmp    $0x7,%eax
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%dl
mov    $0x1,%eax
xor    %ecx,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <func1@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x4,%ecx
jne    1145 <main+0x25>
xor    %eax,%eax
call   1040 <func2@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x7,%ecx
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @func1()
%3 = icmp eq i32 %2, 4
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = call i32 (...) @func2()
%6 = icmp eq i32 %5, 7
br label %7
7: ; preds = %4, %0
%8 = phi i1 [ false, %0 ], [ %6, %4 ]
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 0, i32 1
ret i32 %10
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @func1()
%2 = icmp eq i32 %1, 4
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = tail call i32 (...) @func2()
%5 = icmp ne i32 %4, 7
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %0
%8 = phi i32 [ 1, %0 ], [ %6, %3 ]
ret i32 %8
}
/* Variables and functions */
float floor(float);
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ scanf(char *, float *);
void main(void) {
  float y, x;
  scanf("%f", &x);
  y = floor(x + .5);
  printf("%f", y);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xea7(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1050 <floor@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec8(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0xea9(%rip),%xmm0
call   1040 <floorf@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
define void @main() {
%1 = alloca float
%2 = alloca float
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %2)
%4 = load float, float* %2
%5 = fpext float %4 to double
%6 = fadd double %5, 5.000000e-01
%7 = fptrunc double %6 to float
%8 = call float @floor(float %7)
store float %8, float* %1
%9 = load float, float* %1
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float %9)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
define void @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%4 = load float, float* %1
%5 = fadd float %4, 5.000000e-01
%6 = call float @llvm.floor.f32(float %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float %6)
ret void
}
/* Variables and functions */
double exp(float);
float n_silicon(float lamda) {
  float energy = 12398 / lamda;
  return (3.364967 + 0.2119184 * energy +
          2.78878 * exp((energy - 3.30168) / 0.397862));
}


x86 assembly (clang, -O0):
<n_silicon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xf03(%rip),%xmm0
divss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xed8(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xed4(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeaa(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe96(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <exp@plt>
movsd  -0x10(%rbp),%xmm1
movsd  0xe74(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<n_silicon>:
push   %rax
movss  0xee7(%rip),%xmm1
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movsd  0xedc(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xed8(%rip),%xmm1
movsd  %xmm1,(%rsp)
addsd  0xed3(%rip),%xmm0
divsd  0xed3(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <exp@plt>
mulsd  0xeca(%rip),%xmm0
addsd  (%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @n_silicon(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = fdiv float 1.239800e+04, %4
store float %5, float* %3
%6 = load float, float* %3
%7 = fpext float %6 to double
%8 = call double @llvm.fmuladd.f64(double 0x3FCB202462B5D7BE, double %7, double 0x400AEB73D188F430)
%9 = load float, float* %3
%10 = fpext float %9 to double
%11 = fsub double %10, 3.301680e+00
%12 = fdiv double %11, 3.978620e-01
%13 = fptrunc double %12 to float
%14 = call double @exp(float %13)
%15 = call double @llvm.fmuladd.f64(double 2.788780e+00, double %14, double %8)
%16 = fptrunc double %15 to float
ret float %16
}

LLVM IR (-O2):
define float @n_silicon(float %0) {
%2 = fdiv float 1.239800e+04, %0
%3 = fpext float %2 to double
%4 = tail call double @llvm.fmuladd.f64(double %3, double 0x3FCB202462B5D7BE, double 0x400AEB73D188F430)
%5 = fadd double %3, -3.301680e+00
%6 = fdiv double %5, 3.978620e-01
%7 = fptrunc double %6 to float
%8 = tail call double @exp(float %7)
%9 = tail call double @llvm.fmuladd.f64(double %8, double 2.788780e+00, double %4)
%10 = fptrunc double %9 to float
ret float %10
}
int cmp(const void *pa, const void *pb) {
  char a = *(const char *)pa;
  char b = *(const char *)pb;
  int res = a == b ? 1 : 0;
  *(char *)pa = 100;
  return res;
}


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x12(%rbp)
movsbl -0x11(%rbp),%edx
movsbl -0x12(%rbp),%esi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x64,(%rax)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
mov    (%rdi),%cl
xor    %eax,%eax
cmp    (%rsi),%cl
sete   %al
movb   $0x64,(%rdi)
ret

LLVM IR (-O0):
define i32 @cmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
store i8 %9, i8* %5
%10 = load i8*, i8** %4
%11 = load i8, i8* %10
store i8 %11, i8* %6
%12 = load i8, i8* %5
%13 = sext i8 %12 to i32
%14 = load i8, i8* %6
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %13, %15
%17 = zext i1 %16 to i64
%18 = select i1 %16, i32 1, i32 0
store i32 %18, i32* %7
%19 = load i8*, i8** %3
store i8 100, i8* %19
%20 = load i32, i32* %7
ret i32 %20
}

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp eq i8 %3, %4
%6 = zext i1 %5 to i32
store i8 100, i8* %0
ret i32 %6
}
/* Variables and functions */
int inportb(int);
void waitkey(void) {
  unsigned char kbc_status;
  do {
    while (inportb(0x64) & 0x02)
      ;
    kbc_status = inportb(0x64);
  } while (!(kbc_status & 1));
}


x86 assembly (clang, -O0):
<waitkey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
jmp    111d <waitkey+0xd>
mov    $0x64,%edi
call   1030 <inportb@plt>
and    $0x2,%eax
cmp    $0x0,%eax
je     1138 <waitkey+0x28>
jmp    111d <waitkey+0xd>
mov    $0x64,%edi
call   1030 <inportb@plt>
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1118 <waitkey+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<waitkey>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x64,%edi
call   1030 <inportb@plt>
test   $0x2,%al
jne    1120 <waitkey+0x10>
mov    $0x64,%edi
call   1030 <inportb@plt>
test   $0x1,%al
je     1120 <waitkey+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @waitkey() {
%1 = alloca i8
br label %2
2: ; preds = %11, %0
br label %3
3: ; preds = %7, %2
%4 = call i32 @inportb(i32 100)
%5 = and i32 %4, 2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
%9 = call i32 @inportb(i32 100)
%10 = trunc i32 %9 to i8
store i8 %10, i8* %1
br label %11
11: ; preds = %8
%12 = load i8, i8* %1
%13 = zext i8 %12 to i32
%14 = and i32 %13, 1
%15 = icmp ne i32 %14, 0
%16 = xor i1 %15, true
br i1 %16, label %2, label %17
17: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @waitkey() {
br label %1
1: ; preds = %5, %0
%2 = tail call i32 @inportb(i32 100)
%3 = and i32 %2, 2
%4 = icmp eq i32 %3, 0
br i1 %4, label %6, label %5
5: ; preds = %1, %6
br label %1
6: ; preds = %1
%7 = tail call i32 @inportb(i32 100)
%8 = and i32 %7, 1
%9 = icmp eq i32 %8, 0
br i1 %9, label %5, label %10
10: ; preds = %6
ret void
}
/* Variables and functions */
scalar_t__ matchNumber(char const **);
int CSSValueIsNumber(const char *str) {
  if (str == NULL)
    return 0;
  return (matchNumber(&str) && (*str == 0));
}


x86 assembly (clang, -O0):
<CSSValueIsNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <CSSValueIsNumber+0x23>
movl   $0x0,-0x4(%rbp)
jmp    1169 <CSSValueIsNumber+0x59>
lea    -0x10(%rbp),%rdi
call   1030 <matchNumber@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
je     115e <CSSValueIsNumber+0x4e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CSSValueIsNumber>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,0x8(%rsp)
xor    %ebx,%ebx
test   %rdi,%rdi
je     113d <CSSValueIsNumber+0x2d>
lea    0x8(%rsp),%rdi
call   1030 <matchNumber@plt>
test   %rax,%rax
je     113d <CSSValueIsNumber+0x2d>
mov    0x8(%rsp),%rax
xor    %ebx,%ebx
cmpb   $0x0,(%rax)
sete   %bl
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @CSSValueIsNumber(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = icmp eq i8* %0, null
br i1 %3, label %12, label %4
4: ; preds = %1
%5 = call i64 @matchNumber(i8** %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %4
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %4, %7, %1
%13 = phi i32 [ 0, %1 ], [ 0, %4 ], [ %11, %7 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ shiftor(char *, char *);
int main(int argc, char *argv[]) {
  shiftor("stupid_strina_string", "string");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"stupid_strina_string\00"
@.str.1 = [7 x i8] c"string\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @shiftor(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"stupid_strina_string\00"
@.str.1 = [7 x i8] c"string\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @shiftor(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef long off_t;
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ lseek(int, long, int /*<<< orphan*/);
int64_t fd_file_size(int fd) {
  int64_t size;
  (void)lseek(fd, 0L, SEEK_SET);
  size = (lseek(fd, (off_t)0, SEEK_END));
  return (size);
}


x86 assembly (clang, -O0):
<fd_file_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb3(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1030 <lseek@plt>
mov    -0x4(%rbp),%edi
mov    0x2eae(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1030 <lseek@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fd_file_size>:
push   %rbx
mov    %edi,%ebx
mov    0x2ebe(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <lseek@plt>
mov    0x2ebe(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
xor    %esi,%esi
pop    %rbx
jmp    1030 <lseek@plt>

LLVM IR (-O0):
@SEEK_SET = global i32 0
@SEEK_END = global i32 0
define i32 @fd_file_size(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @SEEK_SET
%6 = call i32 @lseek(i32 %4, i64 0, i32 %5)
%7 = load i32, i32* %2
%8 = load i32, i32* @SEEK_END
%9 = call i32 @lseek(i32 %7, i64 0, i32 %8)
store i32 %9, i32* %3
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
@SEEK_END = global i32 0
define i32 @fd_file_size(i32 %0) {
%2 = load i32, i32* @SEEK_SET
%3 = tail call i32 @lseek(i32 %0, i64 0, i32 %2)
%4 = load i32, i32* @SEEK_END
%5 = tail call i32 @lseek(i32 %0, i64 0, i32 %4)
ret i32 %5
}
/* Variables and functions */
void *temp_calloc(size_t nmemb, size_t size) {
  (void)nmemb;
  (void)size;
  return NULL;
}


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

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

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

LLVM IR (-O2):
define noalias i8* @temp_calloc(i64 %0, i64 %1) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ nokia_lcd_clear();
int /*<<< orphan*/ nokia_lcd_render();
int /*<<< orphan*/ snake_set_grids();
int /*<<< orphan*/ snake_show_score();
void print_snake_update() {
  nokia_lcd_clear();
  snake_show_score();
  snake_set_grids();
  nokia_lcd_render();
}


x86 assembly (clang, -O0):
<print_snake_update>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <nokia_lcd_clear@plt>
mov    $0x0,%al
call   1030 <snake_show_score@plt>
mov    $0x0,%al
call   1060 <snake_set_grids@plt>
mov    $0x0,%al
call   1040 <nokia_lcd_render@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_snake_update>:
push   %rax
xor    %eax,%eax
call   1050 <nokia_lcd_clear@plt>
xor    %eax,%eax
call   1030 <snake_show_score@plt>
xor    %eax,%eax
call   1060 <snake_set_grids@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <nokia_lcd_render@plt>

LLVM IR (-O0):
define void @print_snake_update() {
%1 = call i32 (...) @nokia_lcd_clear()
%2 = call i32 (...) @snake_show_score()
%3 = call i32 (...) @snake_set_grids()
%4 = call i32 (...) @nokia_lcd_render()
ret void
}

LLVM IR (-O2):
define void @print_snake_update() {
%1 = tail call i32 (...) @nokia_lcd_clear()
%2 = tail call i32 (...) @snake_show_score()
%3 = tail call i32 (...) @snake_set_grids()
%4 = tail call i32 (...) @nokia_lcd_render()
ret void
}
void OSCC_deinit(void) {}


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @timer_init() {
ret void
}
main() {
  printf((void *)0);
  printf(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (i8*, ...) @printf(i8* null)
%2 = call i32 (i8*, ...) @printf(i8* null)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) null)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) null)
ret i32 0
}
/* Type definitions */
struct net_device {
  int dummy;
};
struct iw_request_info {
  int dummy;
};

/* Variables and functions */
int rt_ioctl_giwsens(struct net_device *dev, struct iw_request_info *info,
                     char *name, char *extra) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.net_device = type { i32 }
%struct.iw_request_info = type { i32 }
define i32 @rt_ioctl_giwsens(%struct.net_device* %0, %struct.iw_request_info* %1, i8* %2, i8* %3) {
%5 = alloca %struct.net_device*
%6 = alloca %struct.iw_request_info*
%7 = alloca i8*
%8 = alloca i8*
store %struct.net_device* %0, %struct.net_device** %5
store %struct.iw_request_info* %1, %struct.iw_request_info** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
ret i32 0
}

LLVM IR (-O2):
%struct.net_device = type { i32 }
%struct.iw_request_info = type { i32 }
define i32 @rt_ioctl_giwsens(%struct.net_device* nocapture readnone %0, %struct.iw_request_info* nocapture readnone %1, i8* nocapture readnone %2, i8* nocapture readnone %3) {
ret i32 0
}
void setcolor(int i) {}


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

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

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

LLVM IR (-O2):
define void @setcolor(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ send_cmd(int, char *, int);
void send_cmd_i2(int cmd_code, int arg1, int arg2) {
  int ibuf[2];
  ibuf[0] = arg1;
  ibuf[1] = arg2;
  send_cmd(cmd_code, (char *)ibuf, 2 * sizeof(int));
}


x86 assembly (clang, -O0):
<send_cmd_i2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x14(%rbp),%rsi
mov    $0x8,%edx
call   1030 <send_cmd@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_cmd_i2>:
push   %rax
mov    %esi,(%rsp)
mov    %edx,0x4(%rsp)
mov    %rsp,%rsi
mov    $0x8,%edx
call   1030 <send_cmd@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @send_cmd_i2(i32 %0, i32 %1, i32 %2) {
%4 = alloca [2 x i32]
%5 = bitcast [2 x i32]* %4 to i8*
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
store i32 %1, i32* %6
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
store i32 %2, i32* %7
%8 = call i32 @send_cmd(i32 %0, i8* %5, i32 8)
ret void
}
unsigned long __arch_copy_to_user(void *to, void *from, unsigned long n) {
  unsigned long a;
  return a;
}


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

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

LLVM IR (-O0):
define i64 @__arch_copy_to_user(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i64, i64* %7
ret i64 %8
}

LLVM IR (-O2):
define i64 @__arch_copy_to_user(i8* nocapture readnone %0, i8* nocapture readnone %1, i64 %2) {
ret i64 undef
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char const *);
void usage(const char *s) {
  printf("%s <rom file>\n", s);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%s <rom file>\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s <rom file>\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
char UartInChar(int /*<<< orphan*/);
char in_char(void) { return UartInChar(0); }


x86 assembly (clang, -O0):
<in_char>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <UartInChar@plt>
movsbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i8 @in_char() {
%1 = call signext i8 @UartInChar(i32 0)
ret i8 %1
}

LLVM IR (-O2):
define signext i8 @in_char() {
%1 = tail call signext i8 @UartInChar(i32 0)
ret i8 %1
}