xunge/DecIR huggingface dataset:
/* Type definitions */
struct cred_t {
  int dummy;
};
typedef scalar_t__ gid_t;

/* Variables and functions */
int EPERM;
int __rr_do_setregid(struct cred_t *, int, scalar_t__);
int __rr_do_setegid(struct cred_t *current, gid_t egid) {
  if (egid == (gid_t)-1)
    goto error;
  return __rr_do_setregid(current, -1, egid);
error:
  return -EPERM;
}


x86 assembly (clang, -O0):
<__rr_do_setegid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0xffffffffffffffff,-0x18(%rbp)
jne    1130 <__rr_do_setegid+0x20>
jmp    114a <__rr_do_setegid+0x3a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0xffffffff,%esi
call   1030 <__rr_do_setregid@plt>
mov    %eax,-0x4(%rbp)
jmp    1158 <__rr_do_setegid+0x48>
xor    %eax,%eax
mov    0x2e85(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__rr_do_setegid>:
cmp    $0xffffffffffffffff,%rsi
je     1123 <__rr_do_setegid+0x13>
mov    %rsi,%rdx
mov    $0xffffffff,%esi
jmp    1030 <__rr_do_setregid@plt>
mov    0x2eae(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
%struct.cred_t = type { i32 }
@EPERM = global i32 0
define i32 @__rr_do_setegid(%struct.cred_t* %0, i64 %1) {
%3 = alloca i32
%4 = alloca %struct.cred_t*
%5 = alloca i64
store %struct.cred_t* %0, %struct.cred_t** %4
store i64 %1, i64* %5
%6 = load i64, i64* %5
%7 = icmp eq i64 %6, -1
br i1 %7, label %8, label %9
8: ; preds = %2
br label %13
9: ; preds = %2
%10 = load %struct.cred_t*, %struct.cred_t** %4
%11 = load i64, i64* %5
%12 = call i32 @__rr_do_setregid(%struct.cred_t* %10, i32 -1, i64 %11)
store i32 %12, i32* %3
br label %16
13: ; preds = %8
%14 = load i32, i32* @EPERM
%15 = sub nsw i32 0, %14
store i32 %15, i32* %3
br label %16
16: ; preds = %13, %9
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
%struct.cred_t = type { i32 }
@EPERM = global i32 0
define i32 @__rr_do_setegid(%struct.cred_t* %0, i64 %1) {
%3 = icmp eq i64 %1, -1
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @__rr_do_setregid(%struct.cred_t* %0, i32 -1, i64 %1)
br label %9
6: ; preds = %2
%7 = load i32, i32* @EPERM
%8 = sub nsw i32 0, %7
br label %9
9: ; preds = %6, %4
%10 = phi i32 [ %8, %6 ], [ %5, %4 ]
ret i32 %10
}
/* Type definitions */
struct sembuf {
  int dummy;
};

/* Variables and functions */
int syscall(int, int, struct sembuf *, size_t);
int semop(int id, struct sembuf *buf, size_t n) {
  return syscall(298, id, buf, n);
}


x86 assembly (clang, -O0):
<semop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x12a,%edi
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<semop>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %edi,%esi
mov    $0x12a,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.sembuf = type { i32 }
define i32 @semop(i32 %0, %struct.sembuf* %1, i64 %2) {
%4 = alloca i32
%5 = alloca %struct.sembuf*
%6 = alloca i64
store i32 %0, i32* %4
store %struct.sembuf* %1, %struct.sembuf** %5
store i64 %2, i64* %6
%7 = load i32, i32* %4
%8 = load %struct.sembuf*, %struct.sembuf** %5
%9 = load i64, i64* %6
%10 = call i32 @syscall(i32 298, i32 %7, %struct.sembuf* %8, i64 %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.sembuf = type { i32 }
define i32 @semop(i32 %0, %struct.sembuf* %1, i64 %2) {
%4 = tail call i32 @syscall(i32 298, i32 %0, %struct.sembuf* %1, i64 %2)
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
char *fcitx_utf8_get_char(char const *, int /*<<< orphan*/ *);
__attribute__((visibility("default"))) size_t fcitx_utf8_strlen(const char *s) {
  size_t l = 0;
  while (*s) {
    uint32_t chr;
    s = fcitx_utf8_get_char(s, &chr);
    l++;
  }
  return l;
}


x86 assembly (clang, -O0):
<fcitx_utf8_strlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1153 <fcitx_utf8_strlen+0x43>
mov    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1030 <fcitx_utf8_get_char@plt>
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <fcitx_utf8_strlen+0x14>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fcitx_utf8_strlen>:
push   %r14
push   %rbx
push   %rax
cmpb   $0x0,(%rdi)
je     1146 <fcitx_utf8_strlen+0x36>
mov    %rdi,%rax
xor    %ebx,%ebx
lea    0x4(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <fcitx_utf8_get_char@plt>
add    $0x1,%rbx
cmpb   $0x0,(%rax)
jne    1130 <fcitx_utf8_strlen+0x20>
jmp    1148 <fcitx_utf8_strlen+0x38>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @fcitx_utf8_strlen(i8* %0) {
%2 = alloca i32
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %1
%6 = bitcast i32* %2 to i8*
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %11, %7 ]
%9 = phi i8* [ %0, %5 ], [ %10, %7 ]
%10 = call i8* @fcitx_utf8_get_char(i8* %9, i32* %2)
%11 = add i64 %8, 1
%12 = load i8, i8* %10
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %7
14: ; preds = %7, %1
%15 = phi i64 [ 0, %1 ], [ %11, %7 ]
ret i64 %15
}
char *b32dec_shortdesc(void) { return "decode Base32 encoded data"; }


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

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

LLVM IR (-O0):
@.str = [27 x i8] c"decode Base32 encoded data\00"
define i8* @b32dec_shortdesc() {
ret i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [27 x i8] c"decode Base32 encoded data\00"
define i8* @b32dec_shortdesc() {
ret i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ say_hello();
int main(int argc, char **argv) {
  say_hello();
  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)
mov    $0x0,%al
call   1030 <say_hello@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
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 (...) @say_hello()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @say_hello()
ret i32 0
}
void clear_args(struct main_args_info *args_info) { (void)(args_info); }


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

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

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

LLVM IR (-O2):
%struct.main_args_info = type opaque
define void @clear_args(%struct.main_args_info* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pr_mask(char *);
void sig_int(int signo) { pr_mask("\nin sig_int: "); }


x86 assembly (clang, -O0):
<sig_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <pr_mask@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [14 x i8] c"\0Ain sig_int: \00"
define void @sig_int(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @pr_mask(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"\0Ain sig_int: \00"
define void @sig_int(i32 %0) {
%2 = tail call i32 @pr_mask(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}
void *alloc(int size) {
  char *buf = alloca(size);
  printf("alloca %p %d\n", buf, size);
  return buf;
}


x86 assembly (clang, -O0):
<alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rax
sub    %rcx,%rax
mov    %rax,%rsp
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x4(%rbp),%edx
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
push   %rax
movslq %edi,%rdx
mov    %rsp,%rbx
lea    0xf(%rdx),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xecf(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rax
lea    -0x8(%rbp),%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"alloca %p %d\0A\00"
define i8* @alloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = alloca i8, i64 %5
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %8)
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
@.str = [14 x i8] c"alloca %p %d\0A\00"
define i8* @alloc(i32 %0) {
%2 = sext i32 %0 to i64
%3 = alloca i8, i64 %2
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %3, i32 %0)
ret i8* %3
}
/* Variables and functions */
int sprintf(char *, char *, size_t);
scalar_t__ strcmp(char *, char *);
int main() {
  char buf[64];
  if (sprintf(buf, "%zu", (size_t)1234) != 4) {
    return 1;
  } else if (strcmp(buf, "1234")) {
    return 2;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x4d2,%edx
call   1040 <sprintf@plt>
cmp    $0x4,%eax
je     1159 <main+0x39>
movl   $0x1,-0x4(%rbp)
jmp    118b <main+0x6b>
lea    -0x50(%rbp),%rdi
lea    0xea0(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     117f <main+0x5f>
movl   $0x2,-0x4(%rbp)
jmp    118b <main+0x6b>
jmp    1184 <main+0x64>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
lea    0xed5(%rip),%rsi
mov    %rsp,%rdi
mov    $0x4d2,%edx
call   1040 <sprintf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x4,%ecx
jne    1160 <main+0x40>
lea    0xeb9(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    %eax,%eax
add    $0x48,%rsp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%zu\00"
@.str.1 = [5 x i8] c"1234\00"
define i32 @main() {
%1 = alloca [64 x i8]
%2 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 1234)
%4 = icmp eq i32 %3, 4
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i32 0, i32 2
br label %9
9: ; preds = %5, %0
%10 = phi i32 [ 1, %0 ], [ %8, %5 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *progname) {
  fprintf(stderr, "usage: %s <ELF shared object> <output file>\n", progname);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [45 x i8] c"usage: %s <ELF shared object> <output file>\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [45 x i8] c"usage: %s <ELF shared object> <output file>\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_base(int, int, char *);
int /*<<< orphan*/ printf(char *);
void print_binary(int num) {
  static char map[] = {'0', '1'};
  printf("Binary: ");
  print_base(num, 2, map);
  printf("\n");
}


x86 assembly (clang, -O0):
<print_binary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
lea    0x2eea(%rip),%rdx
call   1040 <print_base@plt>
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_binary>:
push   %rbx
mov    %edi,%ebx
lea    0xec6(%rip),%rdi
call   1040 <printf@plt>
lea    0x2ef2(%rip),%rdx
mov    %ebx,%edi
mov    $0x2,%esi
call   1050 <print_base@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@print_binary.map = internal global [2 x i8] c"01"
@.str = [9 x i8] c"Binary: \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_binary(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = call i32 @print_base(i32 %4, i32 2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @print_binary.map, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@print_binary.map = internal global [2 x i8] c"01"
@.str = [9 x i8] c"Binary: \00"
define void @print_binary(i32 %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @print_base(i32 %0, i32 2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @print_binary.map, i64 0, i64 0))
%4 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
char *skip_prefix(int /*<<< orphan*/, char *);
int /*<<< orphan*/ ss3_input();
char *skip_ss3(char *input) {
  if ((unsigned char)*input == 0217) {
    return input + 1;
  }
  return skip_prefix(ss3_input(), input);
}


x86 assembly (clang, -O0):
<skip_ss3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x8f,%eax
jne    114f <skip_ss3+0x2f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1165 <skip_ss3+0x45>
mov    $0x0,%al
call   1030 <ss3_input@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1040 <skip_prefix@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_ss3>:
push   %rbx
mov    %rdi,%rbx
cmpb   $0x8f,(%rdi)
jne    1132 <skip_ss3+0x12>
add    $0x1,%rbx
mov    %rbx,%rax
pop    %rbx
ret
xor    %eax,%eax
call   1030 <ss3_input@plt>
mov    %eax,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <skip_prefix@plt>

LLVM IR (-O0):
define i8* @skip_ss3(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = icmp eq i32 %6, 143
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 1
store i8* %10, i8** %2
br label %15
11: ; preds = %1
%12 = call i32 (...) @ss3_input()
%13 = load i8*, i8** %3
%14 = call i8* @skip_prefix(i32 %12, i8* %13)
store i8* %14, i8** %2
br label %15
15: ; preds = %11, %8
%16 = load i8*, i8** %2
ret i8* %16
}

LLVM IR (-O2):
define i8* @skip_ss3(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, -113
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
br label %9
6: ; preds = %1
%7 = tail call i32 (...) @ss3_input()
%8 = tail call i8* @skip_prefix(i32 %7, i8* %0)
br label %9
9: ; preds = %6, %4
%10 = phi i8* [ %5, %4 ], [ %8, %6 ]
ret i8* %10
}
/* Variables and functions */
int func8b(int);
__attribute__((always_)) int func8a(int x) { return func8b(x * 31); }


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

x86 assembly (clang, -O2):
<func8a>:
mov    %edi,%eax
shl    $0x5,%eax
sub    %edi,%eax
mov    %eax,%edi
jmp    1030 <func8b@plt>

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

LLVM IR (-O2):
define i32 @func8a(i32 %0) {
%2 = mul nsw i32 %0, 31
%3 = tail call i32 @func8b(i32 %2)
ret i32 %3
}
int wpa_key_mgmt_cckm(int akm) { return akm == (1 << (14)); }


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

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

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

LLVM IR (-O2):
define i32 @wpa_key_mgmt_cckm(i32 %0) {
%2 = icmp eq i32 %0, 16384
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int strcmp(char const *, char const *);
int compare_strs_(const void **a, const void **b) {
  const char *s1 = *a, *s2 = *b;
  return strcmp(s1, s2);
}


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

x86 assembly (clang, -O2):
<compare_strs_>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @compare_strs_(i8** %0, i8** %1) {
%3 = alloca i8**
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i8*
store i8** %0, i8*** %3
store i8** %1, i8*** %4
%7 = load i8**, i8*** %3
%8 = load i8*, i8** %7
store i8* %8, i8** %5
%9 = load i8**, i8*** %4
%10 = load i8*, i8** %9
store i8* %10, i8** %6
%11 = load i8*, i8** %5
%12 = load i8*, i8** %6
%13 = call i32 @strcmp(i8* %11, i8* %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @compare_strs_(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(1) %4)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void test_find_element_song() {
  printf(
      "====================================================================\n");
  printf("TESTING FIND ELEMENT SONG...\n");
}


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

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

LLVM IR (-O0):
@.str = [70 x i8] c"====================================================================\0A\00"
@.str.1 = [30 x i8] c"TESTING FIND ELEMENT SONG...\0A\00"
define void @test_find_element_song() {
%1 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [69 x i8] c"====================================================================\00"
@str.2 = [29 x i8] c"TESTING FIND ELEMENT SONG...\00"
define void @test_find_element_song() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.2, i64 0, i64 0))
ret void
}
unsigned long sancus_bit_cms(unsigned long old, unsigned long value,
                             unsigned long mask, unsigned shift) {
  old &= ~(mask << shift);
  value = (value & mask) << shift;
  return value | old;
}


x86 assembly (clang, -O0):
<sancus_bit_cms>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    %cl,%rax
xor    $0xffffffffffffffff,%rax
and    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
and    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    %cl,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
or     -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sancus_bit_cms>:
mov    %rdx,%rax
shl    %cl,%rax
and    %rdx,%rsi
not    %rax
and    %rdi,%rax
shl    %cl,%rsi
or     %rsi,%rax
ret

LLVM IR (-O0):
define i64 @sancus_bit_cms(i64 %0, i64 %1, i64 %2, i32 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i32 %3, i32* %8
%9 = load i64, i64* %7
%10 = load i32, i32* %8
%11 = zext i32 %10 to i64
%12 = shl i64 %9, %11
%13 = xor i64 %12, -1
%14 = load i64, i64* %5
%15 = and i64 %14, %13
store i64 %15, i64* %5
%16 = load i64, i64* %6
%17 = load i64, i64* %7
%18 = and i64 %16, %17
%19 = load i32, i32* %8
%20 = zext i32 %19 to i64
%21 = shl i64 %18, %20
store i64 %21, i64* %6
%22 = load i64, i64* %6
%23 = load i64, i64* %5
%24 = or i64 %22, %23
ret i64 %24
}

LLVM IR (-O2):
define i64 @sancus_bit_cms(i64 %0, i64 %1, i64 %2, i32 %3) {
%5 = zext i32 %3 to i64
%6 = shl i64 %2, %5
%7 = xor i64 %6, -1
%8 = and i64 %7, %0
%9 = and i64 %2, %1
%10 = shl i64 %9, %5
%11 = or i64 %8, %10
ret i64 %11
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
syntaxerror() {
  printf("syntaxerror() should not be called in AMBER\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@.str = [45 x i8] c"syntaxerror() should not be called in AMBER\0A\00"
define i32 @syntaxerror() {
%1 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [44 x i8] c"syntaxerror() should not be called in AMBER\00"
define i32 @syntaxerror() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int nocbreak();
int wrap_nocbreak(void) { return nocbreak(); }


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

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

LLVM IR (-O0):
define i32 @wrap_nocbreak() {
%1 = call i32 (...) @nocbreak()
ret i32 %1
}

LLVM IR (-O2):
define i32 @wrap_nocbreak() {
%1 = tail call i32 (...) @nocbreak()
ret i32 %1
}
void foo198() {}


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

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

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

LLVM IR (-O2):
define void @foo198() {
ret void
}
/* Variables and functions */
int add(int, int);
int mul(int, int);
int /*<<< orphan*/ printf(char *, int);
int sub(int, int);
void process(int a, int b) {
  printf("a + b = %d\n", add(a, b));
  printf("a - b = %d\n", sub(a, b));
  printf("a * b = %d\n", mul(a, b));
}


x86 assembly (clang, -O0):
<process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <add@plt>
mov    %eax,%esi
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1060 <sub@plt>
mov    %eax,%esi
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <mul@plt>
mov    %eax,%esi
lea    0xe84(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <add@plt>
lea    0xead(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %ebp,%edi
mov    %ebx,%esi
call   1060 <sub@plt>
lea    0xea2(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %ebp,%edi
mov    %ebx,%esi
call   1050 <mul@plt>
lea    0xe97(%rip),%rdi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"a + b = %d\0A\00"
@.str.1 = [12 x i8] c"a - b = %d\0A\00"
@.str.2 = [12 x i8] c"a * b = %d\0A\00"
define void @process(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @add(i32 %5, i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 @sub(i32 %9, i32 %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = call i32 @mul(i32 %13, i32 %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %15)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"a + b = %d\0A\00"
@.str.1 = [12 x i8] c"a - b = %d\0A\00"
@.str.2 = [12 x i8] c"a * b = %d\0A\00"
define void @process(i32 %0, i32 %1) {
%3 = tail call i32 @add(i32 %0, i32 %1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @sub(i32 %0, i32 %1)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = tail call i32 @mul(i32 %0, i32 %1)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %7)
ret void
}
void RTLogRelLoggerV(void) {}


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

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

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

LLVM IR (-O2):
define void @RTLogRelLoggerV() {
ret void
}
/* Variables and functions */
bool nrf51_errata_70(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf51_errata_70() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ bad_if_not_alias(int, int);
void call_bad_if_not_alias_Good() {
  int x;
  bad_if_not_alias(x, x);
}


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

x86 assembly (clang, -O2):
<call_bad_if_not_alias_Good>:
jmp    1030 <bad_if_not_alias@plt>

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

LLVM IR (-O2):
define void @call_bad_if_not_alias_Good() {
%1 = tail call i32 @bad_if_not_alias(i32 undef, i32 undef)
ret void
}
int cc_cache_size(void) { return ((12 * 1024) * 1024); }


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

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

LLVM IR (-O0):
define i32 @cc_cache_size() {
ret i32 12582912
}

LLVM IR (-O2):
define i32 @cc_cache_size() {
ret i32 12582912
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long long);
int /*<<< orphan*/ scanf(char *, long long *);
int main() {
  long long a, a2, a3;
  scanf("%lld", &a);
  a2 = a * a;
  a3 = a * a * a;
  printf("%lld\n", a2);
  printf("%lld\n", a3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
imul   -0x10(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%rbx
mov    %rbx,%rsi
imul   %rbx,%rsi
imul   %rsi,%rbx
lea    0xebc(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [6 x i8] c"%lld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %2)
%6 = load i64, i64* %2
%7 = load i64, i64* %2
%8 = mul nsw i64 %6, %7
store i64 %8, i64* %3
%9 = load i64, i64* %2
%10 = load i64, i64* %2
%11 = mul nsw i64 %9, %10
%12 = load i64, i64* %2
%13 = mul nsw i64 %11, %12
store i64 %13, i64* %4
%14 = load i64, i64* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %14)
%16 = load i64, i64* %4
%17 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [6 x i8] c"%lld\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%4 = load i64, i64* %1
%5 = mul nsw i64 %4, %4
%6 = mul nsw i64 %5, %4
%7 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %5)
%8 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %6)
ret i32 0
}
int null_write_urgent_data(const char *a, int n) {
  (void)a;
  return n;
}


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

x86 assembly (clang, -O2):
<null_write_urgent_data>:
mov    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @null_write_urgent_data(i8* nocapture readnone %0, i32 returned %1) {
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void g5_cb(void *arg) { puts("GPIO_5 triggered"); }


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"GPIO_5 triggered\00"
define void @g5_cb(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"GPIO_5 triggered\00"
define void @g5_cb(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct scr_matrix {
  int dummy;
};
struct prob_dist {
  int dummy;
};
struct diag {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ real_calc_weight(struct diag *, struct scr_matrix *,
                                    struct prob_dist *, int /*<<< orphan*/,
                                    int /*<<< orphan*/ *, int /*<<< orphan*/ *);
void calc_weight(struct diag *dg, struct scr_matrix *smatrix,
                 struct prob_dist *pdist) {
  real_calc_weight(dg, smatrix, pdist, 0, NULL, NULL);
}


x86 assembly (clang, -O0):
<calc_weight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r9d
mov    %r9,%r8
call   1030 <real_calc_weight@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_weight>:
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
jmp    1030 <real_calc_weight@plt>

LLVM IR (-O0):
%struct.diag = type { i32 }
%struct.scr_matrix = type { i32 }
%struct.prob_dist = type { i32 }
define void @calc_weight(%struct.diag* %0, %struct.scr_matrix* %1, %struct.prob_dist* %2) {
%4 = alloca %struct.diag*
%5 = alloca %struct.scr_matrix*
%6 = alloca %struct.prob_dist*
store %struct.diag* %0, %struct.diag** %4
store %struct.scr_matrix* %1, %struct.scr_matrix** %5
store %struct.prob_dist* %2, %struct.prob_dist** %6
%7 = load %struct.diag*, %struct.diag** %4
%8 = load %struct.scr_matrix*, %struct.scr_matrix** %5
%9 = load %struct.prob_dist*, %struct.prob_dist** %6
%10 = call i32 @real_calc_weight(%struct.diag* %7, %struct.scr_matrix* %8, %struct.prob_dist* %9, i32 0, i32* null, i32* null)
ret void
}

LLVM IR (-O2):
%struct.diag = type { i32 }
%struct.scr_matrix = type { i32 }
%struct.prob_dist = type { i32 }
define void @calc_weight(%struct.diag* %0, %struct.scr_matrix* %1, %struct.prob_dist* %2) {
%4 = tail call i32 @real_calc_weight(%struct.diag* %0, %struct.scr_matrix* %1, %struct.prob_dist* %2, i32 0, i32* null, i32* null)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_madd_epi16(int /*<<< orphan*/, int /*<<< orphan*/);
__m128i test_mm_madd_epi16(__m128i A, __m128i B) {
  return _mm_madd_epi16(A, B);
}


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

x86 assembly (clang, -O2):
<test_mm_madd_epi16>:
jmp    1030 <_mm_madd_epi16@plt>

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

LLVM IR (-O2):
define i32 @test_mm_madd_epi16(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_madd_epi16(i32 %0, i32 %1)
ret i32 %3
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ MaxHeapify(scalar_t__ *, scalar_t__, int /*<<< orphan*/);
void MaxInsert(uint32_t *array, uint32_t heapSize, uint32_t elem) {
  if (elem < array[0]) {
    array[0] = elem;
    MaxHeapify(array, heapSize, 0);
  }
}


x86 assembly (clang, -O0):
<MaxInsert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
cmp    (%rcx),%rax
jge    114f <MaxInsert+0x3f>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1030 <MaxHeapify@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MaxInsert>:
cmp    %rdx,(%rdi)
jle    111f <MaxInsert+0xf>
mov    %rdx,(%rdi)
xor    %edx,%edx
jmp    1030 <MaxHeapify@plt>
ret

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

LLVM IR (-O2):
define void @MaxInsert(i64* %0, i64 %1, i64 %2) {
%4 = load i64, i64* %0
%5 = icmp sgt i64 %4, %2
br i1 %5, label %6, label %8
6: ; preds = %3
store i64 %2, i64* %0
%7 = tail call i32 @MaxHeapify(i64* %0, i64 %1, i32 0)
br label %8
8: ; preds = %6, %3
ret void
}
/* Variables and functions */
int syscall4(int, int, int, int);
int lseek(int fildes, int offset, int whence) {
  return syscall4(19, fildes, offset, whence);
}


x86 assembly (clang, -O0):
<lseek>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    $0x13,%edi
call   1030 <syscall4@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lseek>:
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
mov    $0x13,%edi
jmp    1030 <syscall4@plt>

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

LLVM IR (-O2):
define i32 @lseek(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @syscall4(i32 19, i32 %0, i32 %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
double log(double);
double pow(double, int);
double Lin(double tsw, double ta) {
  return (0.85 * pow(-log(tsw), 0.09) * 5.67 * pow(10, -8) * pow(ta, 4));
}


x86 assembly (clang, -O0):
<Lin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
xor    %edi,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xeab(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe97(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe7e(%rip),%xmm0
mov    $0xfffffff8,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x4,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Lin>:
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
call   1030 <log@plt>
xorpd  0xec9(%rip),%xmm0
xor    %edi,%edi
call   1040 <pow@plt>
mulsd  0xeca(%rip),%xmm0
mulsd  0xeca(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xec4(%rip),%xmm0
mov    $0xfffffff8,%edi
call   1040 <pow@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mov    $0x4,%edi
call   1040 <pow@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @Lin(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = call double @log(double %5)
%7 = fneg double %6
%8 = call double @pow(double %7, i32 0)
%9 = fmul double 8.500000e-01, %8
%10 = fmul double %9, 5.670000e+00
%11 = call double @pow(double 1.000000e+01, i32 -8)
%12 = fmul double %10, %11
%13 = load double, double* %4
%14 = call double @pow(double %13, i32 4)
%15 = fmul double %12, %14
ret double %15
}

LLVM IR (-O2):
define double @Lin(double %0, double %1) {
%3 = tail call double @log(double %0)
%4 = fneg double %3
%5 = tail call double @pow(double %4, i32 0)
%6 = fmul double %5, 8.500000e-01
%7 = fmul double %6, 5.670000e+00
%8 = tail call double @pow(double 1.000000e+01, i32 -8)
%9 = fmul double %8, %7
%10 = tail call double @pow(double %1, i32 4)
%11 = fmul double %10, %9
ret double %11
}
/* Variables and functions */
int fsync(int);
int UnixFile_Sync(void *pUserData) {
  int rc;
  rc = fsync(((int)(long int)(pUserData)));
  return rc == 0 ? 0 : -1;
}


x86 assembly (clang, -O0):
<UnixFile_Sync>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%edi
call   1030 <fsync@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    $0xffffffff,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UnixFile_Sync>:
push   %rax
call   1030 <fsync@plt>
neg    %eax
sbb    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @UnixFile_Sync(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = ptrtoint i8* %4 to i64
%6 = trunc i64 %5 to i32
%7 = call i32 @fsync(i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 0, i32 -1
ret i32 %11
}

LLVM IR (-O2):
define i32 @UnixFile_Sync(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = tail call i32 @fsync(i32 %3)
%5 = icmp ne i32 %4, 0
%6 = sext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  int i;
  for (i = 0; i < argc; i++) {
    printf("%s\n", argv[i]);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    115f <main+0x4f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1145 <main+0x35>
mov    %rsi,%r15
mov    %edi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void iwpvt_default_free(void *userdata, void *mem) { free(mem); }


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

x86 assembly (clang, -O2):
<iwpvt_default_free>:
mov    %rsi,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @iwpvt_default_free(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i32 @free(i8* %5)
ret void
}

LLVM IR (-O2):
define void @iwpvt_default_free(i8* nocapture readnone %0, i8* nocapture %1) {
%3 = tail call i32 @free(i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
void BSP_exit(void) {
  printf("\nBye! Bye!");
  fflush(stdout);
  _exit(0);
}


x86 assembly (clang, -O0):
<BSP_exit>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
xor    %edi,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<BSP_exit>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
xor    %edi,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"\0ABye! Bye!\00"
@stdout = global i32 0
define void @BSP_exit() {
%1 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = call i32 @fflush(i32 %2)
%4 = call i32 @_exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [11 x i8] c"\0ABye! Bye!\00"
@stdout = global i32 0
define void @BSP_exit() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
%4 = tail call i32 @_exit(i32 0)
unreachable
}