xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ SDL_imageFilterDivASM(unsigned char *, unsigned char *,
                                         unsigned char *, int);
int SDL_imageFilterDiv(unsigned char *Src1, unsigned char *Src2,
                       unsigned char *Dest, int length) {
  if (length > 0) {
    SDL_imageFilterDivASM(Src1, Src2, Dest, length);
    return (0);
  } else {
    return (-1);
  }
}


x86 assembly (clang, -O0):
<SDL_imageFilterDiv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jle    1151 <SDL_imageFilterDiv+0x41>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1030 <SDL_imageFilterDivASM@plt>
movl   $0x0,-0x4(%rbp)
jmp    1158 <SDL_imageFilterDiv+0x48>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SDL_imageFilterDiv>:
test   %ecx,%ecx
jle    1121 <SDL_imageFilterDiv+0x11>
push   %rax
call   1030 <SDL_imageFilterDivASM@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret
mov    $0xffffffff,%eax
ret

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

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

/* Variables and functions */
int dynamic_lis(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int lis_count;
  int data[] = {10, 22, 9, 33, 21, 50, 41, 60};
  int size = sizeof(data) / sizeof(data[0]);
  lis_count = dynamic_lis(data, size);
  printf("Longest Increasing Subsequence found: %d\n", lis_count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec1(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x8,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1030 <dynamic_lis@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x8,%esi
call   1030 <dynamic_lis@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.data = [8 x i32] [i32 10, i32 22, i32 9, i32 33, i32 21, i32 50, i32 41, i32 60]
@.str = [42 x i8] c"Longest Increasing Subsequence found: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [8 x i32]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [8 x i32]* %3 to i8*
store i32 8, i32* %4
%6 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%7 = load i32, i32* %4
%8 = call i32 @dynamic_lis(i32* %6, i32 %7)
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.data = [8 x i32] [i32 10, i32 22, i32 9, i32 33, i32 21, i32 50, i32 41, i32 60]
@.str = [42 x i8] c"Longest Increasing Subsequence found: %d\0A\00"
define i32 @main() {
%1 = alloca [8 x i32]
%2 = bitcast [8 x i32]* %1 to i8*
%3 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%4 = call i32 @dynamic_lis(i32* %3, i32 8)
%5 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t apic_prepare_ipi_fixed(uint8_t vector) {
  return 0 | (1 << 14) | 0 | vector;
}


x86 assembly (clang, -O0):
<apic_prepare_ipi_fixed>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x4000,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<apic_prepare_ipi_fixed>:
mov    %edi,%eax
or     $0x4000,%eax
ret

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

LLVM IR (-O2):
define i32 @apic_prepare_ipi_fixed(i32 %0) {
%2 = or i32 %0, 16384
ret i32 %2
}
void sys_init() {}


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

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

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

LLVM IR (-O2):
define void @sys_init() {
ret void
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
int strlen(char const *);
char *U_strdup(const char *s) {
  char *news = NULL;
  size_t slen;
  if (s) {
    slen = strlen(s) + 1;
    news = malloc(slen);
    if (news) {
      memcpy(news, s, slen);
    }
  }
  return (news);
}


x86 assembly (clang, -O0):
<U_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     118f <U_strdup+0x5f>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     118a <U_strdup+0x5a>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
jmp    118f <U_strdup+0x5f>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<U_strdup>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1168 <U_strdup+0x38>
mov    %rdi,%r14
call   1030 <strlen@plt>
add    $0x1,%eax
movslq %eax,%r15
mov    %r15,%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     1168 <U_strdup+0x38>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
jmp    116a <U_strdup+0x3a>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @U_strdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = add nsw i32 %4, 1
%6 = sext i32 %5 to i64
%7 = tail call i8* @malloc(i64 %6)
%8 = icmp eq i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %3
%10 = tail call i32 @memcpy(i8* %7, i8* %0, i64 %6)
br label %11
11: ; preds = %3, %9, %1
%12 = phi i8* [ %7, %9 ], [ null, %3 ], [ null, %1 ]
ret i8* %12
}
void LED_ON(void) {}


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

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

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

LLVM IR (-O2):
define void @LED_ON() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *);
int /*<<< orphan*/ system(char *);
char *get_url_cover(char *ifid, char *from) {
  char cmdbuf[1024];
  sprintf(cmdbuf, "curl --silent --fail %s/cover/%s > %s.jpg", from, ifid,
          ifid);
  system(cmdbuf);
  return ifid;
}


x86 assembly (clang, -O0):
<get_url_cover>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x8(%rbp),%r8
lea    0xeb3(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x410(%rbp),%rdi
call   1030 <system@plt>
mov    -0x8(%rbp),%rax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_url_cover>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rsi,%rdx
mov    %rdi,%rbx
lea    0xec9(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rcx
mov    %rbx,%r8
call   1040 <sprintf@plt>
mov    %r14,%rdi
call   1030 <system@plt>
mov    %rbx,%rax
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [42 x i8] c"curl --silent --fail %s/cover/%s > %s.jpg\00"
define i8* @get_url_cover(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [1024 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %4
%8 = load i8*, i8** %3
%9 = load i8*, i8** %3
%10 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8, i8* %9)
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%12 = call i32 @system(i8* %11)
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@.str = [42 x i8] c"curl --silent --fail %s/cover/%s > %s.jpg\00"
define i8* @get_url_cover(i8* returned %0, i8* %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %0, i8* %0)
%6 = call i32 @system(i8* %4)
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ WRITETEST(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
void ClearScreen() {
  char Str[20];
  sprintf(Str, "%s%s", "\033[H", "\033[2J");
  WRITETEST(Str);
}


x86 assembly (clang, -O0):
<ClearScreen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x20(%rbp),%rdi
lea    0xecd(%rip),%rsi
lea    0xecb(%rip),%rdx
lea    0xec8(%rip),%rcx
call   1040 <sprintf@plt>
lea    -0x20(%rbp),%rdi
call   1030 <WRITETEST@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ClearScreen>:
push   %rbx
sub    $0x20,%rsp
lea    0xed4(%rip),%rsi
lea    0xed2(%rip),%rdx
lea    0xecf(%rip),%rcx
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <WRITETEST@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [4 x i8] c"\1B[H\00"
@.str.2 = [5 x i8] c"\1B[2J\00"
define void @ClearScreen() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%5 = call i32 @WRITETEST(i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [4 x i8] c"\1B[H\00"
@.str.2 = [5 x i8] c"\1B[2J\00"
define void @ClearScreen() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @WRITETEST(i8* %2)
ret void
}
/* Type definitions */
struct json_token {
  int dummy;
};

/* Variables and functions */
void *json_next(char const *, int, void *, char const *, struct json_token *,
                struct json_token *, int /*<<< orphan*/ *);
void *json_next_key(const char *s, int len, void *handle, const char *path,
                    struct json_token *key, struct json_token *val) {
  return json_next(s, len, handle, path, key, val, NULL);
}


x86 assembly (clang, -O0):
<json_next_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
xor    %eax,%eax
movq   $0x0,(%rsp)
call   1030 <json_next@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<json_next_key>:
push   %rax
movq   $0x0,(%rsp)
call   1030 <json_next@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.json_token = type { i32 }
define i8* @json_next_key(i8* %0, i32 %1, i8* %2, i8* %3, %struct.json_token* %4, %struct.json_token* %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca %struct.json_token*
%12 = alloca %struct.json_token*
store i8* %0, i8** %7
store i32 %1, i32* %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store %struct.json_token* %4, %struct.json_token** %11
store %struct.json_token* %5, %struct.json_token** %12
%13 = load i8*, i8** %7
%14 = load i32, i32* %8
%15 = load i8*, i8** %9
%16 = load i8*, i8** %10
%17 = load %struct.json_token*, %struct.json_token** %11
%18 = load %struct.json_token*, %struct.json_token** %12
%19 = call i8* @json_next(i8* %13, i32 %14, i8* %15, i8* %16, %struct.json_token* %17, %struct.json_token* %18, i32* null)
ret i8* %19
}

LLVM IR (-O2):
%struct.json_token = type { i32 }
define i8* @json_next_key(i8* %0, i32 %1, i8* %2, i8* %3, %struct.json_token* %4, %struct.json_token* %5) {
%7 = tail call i8* @json_next(i8* %0, i32 %1, i8* %2, i8* %3, %struct.json_token* %4, %struct.json_token* %5, i32* null)
ret i8* %7
}
int soma(int one_parameter, int second_paramater) {
  int resultado = 0;
  resultado = one_parameter + second_paramater;
  return resultado;
}


x86 assembly (clang, -O0):
<soma>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<soma>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @soma(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
store i32 %8, i32* %5
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
define i32 @soma(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Type definitions */
struct reb_simulation {
  int dummy;
};

/* Variables and functions */
int reb_output_check_phase(struct reb_simulation *, double, int /*<<< orphan*/);
int reb_output_check(struct reb_simulation *r, double interval) {
  return reb_output_check_phase(r, interval, 0);
}


x86 assembly (clang, -O0):
<reb_output_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
xor    %esi,%esi
call   1030 <reb_output_check_phase@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reb_output_check>:
xor    %esi,%esi
jmp    1030 <reb_output_check_phase@plt>

LLVM IR (-O0):
%struct.reb_simulation = type { i32 }
define i32 @reb_output_check(%struct.reb_simulation* %0, double %1) {
%3 = alloca %struct.reb_simulation*
%4 = alloca double
store %struct.reb_simulation* %0, %struct.reb_simulation** %3
store double %1, double* %4
%5 = load %struct.reb_simulation*, %struct.reb_simulation** %3
%6 = load double, double* %4
%7 = call i32 @reb_output_check_phase(%struct.reb_simulation* %5, double %6, i32 0)
ret i32 %7
}

LLVM IR (-O2):
%struct.reb_simulation = type { i32 }
define i32 @reb_output_check(%struct.reb_simulation* %0, double %1) {
%3 = tail call i32 @reb_output_check_phase(%struct.reb_simulation* %0, double %1, i32 0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int lseek(int, long, int /*<<< orphan*/);
int _get_file_size(int file) {
  int size = lseek(file, 0L, SEEK_END);
  lseek(file, 0L, SEEK_SET);
  return size;
}


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

x86 assembly (clang, -O2):
<_get_file_size>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    0x2ecc(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <lseek@plt>
mov    %eax,%ebp
mov    0x2eaa(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <lseek@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @_get_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_END
%6 = call i32 @lseek(i32 %4, i64 0, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = load i32, i32* @SEEK_SET
%9 = call i32 @lseek(i32 %7, i64 0, i32 %8)
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @_get_file_size(i32 %0) {
%2 = load i32, i32* @SEEK_END
%3 = tail call i32 @lseek(i32 %0, i64 0, i32 %2)
%4 = load i32, i32* @SEEK_SET
%5 = tail call i32 @lseek(i32 %0, i64 0, i32 %4)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ locale_t;

/* Variables and functions */
char *_(char const *);
int /*<<< orphan*/ __uselocale(int /*<<< orphan*/);
const char *translate(const char *str, locale_t loc) {
  locale_t oldloc = __uselocale(loc);
  const char *res = _(str);
  __uselocale(oldloc);
  return res;
}


x86 assembly (clang, -O0):
<translate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <__uselocale@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <_@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <__uselocale@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<translate>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <__uselocale@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <_@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   1030 <__uselocale@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @translate(i8* %0, i32 %1) {
%3 = tail call i32 @__uselocale(i32 %1)
%4 = tail call i8* @_(i8* %0)
%5 = tail call i32 @__uselocale(i32 %3)
ret i8* %4
}
void *anna_blob_from_payload(void *blob) {
  int *res = (int *)blob;
  return (void *)&res[-2];
}


x86 assembly (clang, -O0):
<anna_blob_from_payload>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0xfffffffffffffff8,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<anna_blob_from_payload>:
lea    -0x8(%rdi),%rax
ret

LLVM IR (-O0):
define i8* @anna_blob_from_payload(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 -2
%8 = bitcast i32* %7 to i8*
ret i8* %8
}

LLVM IR (-O2):
define i8* @anna_blob_from_payload(i8* readnone %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 -8
ret i8* %2
}
float fk_isqrt(float nbr) {
  long i;
  float x1;
  float y;
  x1 = nbr * 0.5F;
  y = nbr;
  i = *(long *)&y;
  i = 0x5f375a86 - (i >> 1);
  y = *(float *)&i;
  y = y * (1.5F - (x1 * y * y));
  return (y);
}


x86 assembly (clang, -O0):
<fk_isqrt>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xef3(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
sar    $0x1,%rcx
mov    $0x5f375a86,%eax
sub    %rcx,%rax
mov    %rax,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
mulss  -0x18(%rbp),%xmm1
movss  -0x18(%rbp),%xmm2
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm1
movss  0xe88(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define float @fk_isqrt(float %0) {
%2 = alloca float
%3 = alloca i64
%4 = alloca float
%5 = alloca float
store float %0, float* %2
%6 = load float, float* %2
%7 = fmul float %6, 5.000000e-01
store float %7, float* %4
%8 = load float, float* %2
store float %8, float* %5
%9 = bitcast float* %5 to i64*
%10 = load i64, i64* %9
store i64 %10, i64* %3
%11 = load i64, i64* %3
%12 = ashr i64 %11, 1
%13 = sub nsw i64 1597463174, %12
store i64 %13, i64* %3
%14 = bitcast i64* %3 to float*
%15 = load float, float* %14
store float %15, float* %5
%16 = load float, float* %5
%17 = load float, float* %4
%18 = load float, float* %5
%19 = fmul float %17, %18
%20 = load float, float* %5
%21 = fneg float %19
%22 = call float @llvm.fmuladd.f32(float %21, float %20, float 1.500000e+00)
%23 = fmul float %16, %22
store float %23, float* %5
%24 = load float, float* %5
ret float %24
}

LLVM IR (-O2):
define float @fk_isqrt(float %0) {
ret float poison
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("I am test sub1.\n");
  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
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [17 x i8] c"I am test sub1.\0A\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 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [16 x i8] c"I am test sub1.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void f5(long j) {
  if ((j & ((1UL << (5)) - 1)) >= ((1UL << ((5) - 1)) + 2))
    abort();
}


x86 assembly (clang, -O0):
<f5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0x1f,%rax
cmp    $0x12,%rax
jb     1135 <f5+0x25>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f5>:
and    $0x1e,%edi
cmp    $0x12,%edi
jae    1119 <f5+0x9>
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @f5(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 31
%5 = icmp uge i64 %4, 18
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @f5(i64 %0) {
%2 = and i64 %0, 30
%3 = icmp ugt i64 %2, 17
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @abort()
unreachable
6: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ initCompass();
int /*<<< orphan*/ initIRSeeker();
void initSensors() {
  initCompass();
  initIRSeeker();
}


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

x86 assembly (clang, -O2):
<initSensors>:
push   %rax
xor    %eax,%eax
call   1030 <initCompass@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <initIRSeeker@plt>

LLVM IR (-O0):
define void @initSensors() {
%1 = call i32 (...) @initCompass()
%2 = call i32 (...) @initIRSeeker()
ret void
}

LLVM IR (-O2):
define void @initSensors() {
%1 = tail call i32 (...) @initCompass()
%2 = tail call i32 (...) @initIRSeeker()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dbg_inferior_exec(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  printf("****** TRACING %s\n", "inferior32.bin");
  char argv[1] = {0};
  dbg_inferior_exec("inferior32.bin", argv);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    0xec6(%rip),%rsi
call   1040 <printf@plt>
lea    -0x5(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1050 <memset@plt>
lea    -0x5(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1030 <dbg_inferior_exec@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
lea    0xee0(%rip),%rbx
mov    %rbx,%rsi
call   1040 <printf@plt>
movb   $0x0,0xf(%rsp)
lea    0xf(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <dbg_inferior_exec@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"****** TRACING %s\0A\00"
@.str.1 = [15 x i8] c"inferior32.bin\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1 x i8]
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%4 = bitcast [1 x i8]* %2 to i8*
%5 = getelementptr inbounds [1 x i8], [1 x i8]* %2, i64 0, i64 0
%6 = call i32 @dbg_inferior_exec(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"****** TRACING %s\0A\00"
@.str.1 = [15 x i8] c"inferior32.bin\00"
define i32 @main() {
%1 = alloca [1 x i8]
%2 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%3 = getelementptr inbounds [1 x i8], [1 x i8]* %1, i64 0, i64 0
store i8 0, i8* %3
%4 = call i32 @dbg_inferior_exec(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret i32 0
}
/* Variables and functions */
int strlen(void *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int password_callback(char *buf, int size, int rwflag, void *userdata) {
  strncpy(buf, (char *)userdata, size);
  buf[strlen(userdata)] = 0;
  return strlen(userdata);
}


x86 assembly (clang, -O0):
<password_callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<password_callback>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %esi,%edx
mov    %rdi,%r14
mov    %rcx,%rsi
call   1030 <strncpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,(%r14,%rax,1)
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <strlen@plt>

LLVM IR (-O0):
define i32 @password_callback(i8* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %8
%11 = load i32, i32* %6
%12 = call i32 @strncpy(i8* %9, i8* %10, i32 %11)
%13 = load i8*, i8** %5
%14 = load i8*, i8** %8
%15 = call i32 @strlen(i8* %14)
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %13, i64 %16
store i8 0, i8* %17
%18 = load i8*, i8** %8
%19 = call i32 @strlen(i8* %18)
ret i32 %19
}

LLVM IR (-O2):
define i32 @password_callback(i8* %0, i32 %1, i32 %2, i8* %3) {
%5 = tail call i32 @strncpy(i8* %0, i8* %3, i32 %1)
%6 = tail call i32 @strlen(i8* %3)
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
store i8 0, i8* %8
%9 = tail call i32 @strlen(i8* %3)
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ dlopen_libc();
void *dlsym_(char *);
int isatty(int fd) {
  static int (*isatty_orig)(int) = ((void *)0);
  if (!isatty_orig) {
    dlopen_libc();
    *(void **)(&isatty_orig) = dlsym_("isatty");
  }
  if (fd == 0)
    fd = 2;
  return isatty_orig(fd);
}


x86 assembly (clang, -O0):
<isatty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpq   $0x0,0x2f05(%rip)
jne    1153 <isatty+0x33>
mov    $0x0,%al
call   1030 <dlopen_libc@plt>
lea    0xeb9(%rip),%rdi
call   1040 <dlsym_@plt>
mov    %rax,0x2ee5(%rip)
cmpl   $0x0,-0x4(%rbp)
jne    1164 <isatty+0x44>
movl   $0x2,-0x4(%rbp)
mov    0x2ecd(%rip),%rax
mov    -0x4(%rbp),%edi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isatty>:
push   %rbx
mov    %edi,%ebx
mov    0x2f0e(%rip),%rax
test   %rax,%rax
jne    1149 <isatty+0x29>
xor    %eax,%eax
call   1030 <dlopen_libc@plt>
lea    0xec3(%rip),%rdi
call   1040 <dlsym_@plt>
mov    %rax,0x2eef(%rip)
test   %ebx,%ebx
mov    $0x2,%edi
cmovne %ebx,%edi
pop    %rbx
jmp    *%rax

LLVM IR (-O0):
@isatty.isatty_orig = internal global i32 (i32)* null
@.str = [7 x i8] c"isatty\00"
define i32 @isatty(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32 (i32)*, i32 (i32)** @isatty.isatty_orig
%4 = icmp ne i32 (i32)* %3, null
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = call i32 (...) @dlopen_libc()
%7 = call i8* @dlsym_(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** bitcast (i32 (i32)** @isatty.isatty_orig to i8**)
br label %8
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %8
store i32 2, i32* %2
br label %12
12: ; preds = %11, %8
%13 = load i32 (i32)*, i32 (i32)** @isatty.isatty_orig
%14 = load i32, i32* %2
%15 = call i32 %13(i32 %14)
ret i32 %15
}

LLVM IR (-O2):
@isatty.isatty_orig = internal unnamed_addr global i32 (i32)* null
@.str = [7 x i8] c"isatty\00"
define i32 @isatty(i32 %0) {
%2 = load i32 (i32)*, i32 (i32)** @isatty.isatty_orig
%3 = icmp eq i32 (i32)* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i32 (...) @dlopen_libc()
%6 = tail call i8* @dlsym_(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** bitcast (i32 (i32)** @isatty.isatty_orig to i8**)
%7 = bitcast i8* %6 to i32 (i32)*
br label %8
8: ; preds = %4, %1
%9 = phi i32 (i32)* [ %7, %4 ], [ %2, %1 ]
%10 = icmp eq i32 %0, 0
%11 = select i1 %10, i32 2, i32 %0
%12 = tail call i32 %9(i32 %11)
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, double);
int /*<<< orphan*/ stderr;
void display_version(void) { fprintf(stderr, "sld version: %.2f\n", 0.2); }


x86 assembly (clang, -O0):
<display_version>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xee4(%rip),%rsi
movsd  0xed4(%rip),%xmm0
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_version>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee8(%rip),%rsi
movsd  0xed8(%rip),%xmm0
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"sld version: %.2f\0A\00"
define void @display_version() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), double 2.000000e-01)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"sld version: %.2f\0A\00"
define void @display_version() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), double 2.000000e-01)
ret void
}
int h(int i, int j) {
  int k[i];
  k[j] = i;
  return j;
}


x86 assembly (clang, -O0):
<h>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
mov    %rsp,%rax
mov    %rax,-0x10(%rbp)
lea    0xf(,%rcx,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,%rsp
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%edx
movslq -0x8(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @h(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %5
%10 = alloca i32, i64 %8
store i64 %8, i64* %6
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %10, i64 %13
store i32 %11, i32* %14
%15 = load i32, i32* %4
%16 = load i8*, i8** %5
ret i32 %15
}

LLVM IR (-O2):
define i32 @h(i32 %0, i32 returned %1) {
ret i32 %1
}
/* Variables and functions */
int gamma_dummy_init(void **state) {
  *state = NULL;
  return 0;
}


x86 assembly (clang, -O0):
<gamma_dummy_init>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gamma_dummy_init>:
movq   $0x0,(%rdi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @gamma_dummy_init(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
store i8* null, i8** %3
ret i32 0
}

LLVM IR (-O2):
define i32 @gamma_dummy_init(i8** nocapture writeonly %0) {
store i8* null, i8** %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void ModelicaMessage(const char *string) { printf("%s", string); }


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

x86 assembly (clang, -O2):
<ModelicaMessage>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @ModelicaMessage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ main1(int, int, int);
int main(void) {
  main1(100, 100, 1);
  main1(0, 15, 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x64,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1030 <main1@plt>
xor    %edx,%edx
mov    $0xf,%esi
mov    %edx,%edi
call   1030 <main1@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x64,%edi
mov    $0x64,%esi
mov    $0x1,%edx
call   1030 <main1@plt>
xor    %edi,%edi
mov    $0xf,%esi
xor    %edx,%edx
call   1030 <main1@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @main1(i32 100, i32 100, i32 1)
%2 = tail call i32 @main1(i32 0, i32 15, i32 0)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile uint8_t;

/* Variables and functions */
uint8_t match_get_go() {
  extern volatile uint8_t match_go;
  return match_go;
}


x86 assembly (clang, -O0):
<match_get_go>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ed5(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_get_go>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@match_go = external global i32
define i32 @match_get_go() {
%1 = load volatile i32, i32* @match_go
ret i32 %1
}

LLVM IR (-O2):
@match_go = external global i32
define i32 @match_get_go() {
%1 = load volatile i32, i32* @match_go
ret i32 %1
}
void RTTcpReadNB(void) {}


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @echo_can_shutdown() {
ret void
}
double d3f(double x, double y, double z) { return 0; }


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

x86 assembly (clang, -O2):
<d3f>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @d3f(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @d3f(double %0, double %1, double %2) {
ret double 0.000000e+00
}
struct hostent *_gethostbynisname(name, af) const char *name;
int af;
{ return _gethostbynis(name, "hosts.byname", af); }


x86 assembly (clang, -O0):
<_gethostbynisname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rsi
mov    $0x0,%al
call   1030 <_gethostbynis@plt>
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_gethostbynisname>:
push   %rax
mov    %esi,%edx
lea    0xee6(%rip),%rsi
xor    %eax,%eax
call   1030 <_gethostbynis@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
%struct.hostent = type opaque
@.str = [13 x i8] c"hosts.byname\00"
define %struct.hostent* @_gethostbynisname(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
%7 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @_gethostbynis to i32 (i8*, i8*, i32, ...)*)(i8* %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to %struct.hostent*
ret %struct.hostent* %9
}

LLVM IR (-O2):
%struct.hostent = type opaque
@.str = [13 x i8] c"hosts.byname\00"
define %struct.hostent* @_gethostbynisname(i8* %0, i32 %1) {
%3 = tail call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @_gethostbynis to i32 (i8*, i8*, i32, ...)*)(i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %1)
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to %struct.hostent*
ret %struct.hostent* %5
}
/* Variables and functions */
double _tan_reduce(double);
double tan(double x) {
  if (x < 0.0)
    return -_tan_reduce(-x);
  else
    return _tan_reduce(x);
}


x86 assembly (clang, -O0):
<tan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    116d <tan+0x5d>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <_tan_reduce@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    117c <tan+0x6c>
movsd  -0x10(%rbp),%xmm0
call   1030 <_tan_reduce@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tan>:
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    1132 <tan+0x22>
push   %rax
xorpd  0xedd(%rip),%xmm0
call   1030 <_tan_reduce@plt>
xorpd  0xed0(%rip),%xmm0
pop    %rax
ret
jmp    1030 <_tan_reduce@plt>

LLVM IR (-O0):
define double @tan(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, 0.000000e+00
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load double, double* %3
%8 = fneg double %7
%9 = call double @_tan_reduce(double %8)
%10 = fneg double %9
store double %10, double* %2
br label %14
11: ; preds = %1
%12 = load double, double* %3
%13 = call double @_tan_reduce(double %12)
store double %13, double* %2
br label %14
14: ; preds = %11, %6
%15 = load double, double* %2
ret double %15
}

LLVM IR (-O2):
define double @tan(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = fneg double %0
%5 = tail call double @_tan_reduce(double %4)
%6 = fneg double %5
br label %9
7: ; preds = %1
%8 = tail call double @_tan_reduce(double %0)
br label %9
9: ; preds = %7, %3
%10 = phi double [ %6, %3 ], [ %8, %7 ]
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ start_new_char();
void sp_start_new_char() { start_new_char(); }


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

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

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

LLVM IR (-O2):
define void @sp_start_new_char() {
%1 = tail call i32 (...) @start_new_char()
ret void
}
double convertlong(longitude)
double longitude;
{
  if (longitude < 180.0)
    longitude = -longitude;
  else if (longitude > 180.0)
    longitude = 360.0 - longitude;
  return longitude;
}


x86 assembly (clang, -O0):
<convertlong>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1142 <convertlong+0x42>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1170 <convertlong+0x70>
movsd  -0x8(%rbp),%xmm0
movsd  0xeb1(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    116b <convertlong+0x6b>
movsd  0xea7(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1170 <convertlong+0x70>
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<convertlong>:
movsd  0xef8(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1117 <convertlong+0x17>
xorpd  0xefa(%rip),%xmm0
ret
ucomisd 0xee1(%rip),%xmm0
jbe    1131 <convertlong+0x31>
movsd  0xedf(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @convertlong(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp olt double %3, 1.800000e+02
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load double, double* %2
%7 = fneg double %6
store double %7, double* %2
br label %15
8: ; preds = %1
%9 = load double, double* %2
%10 = fcmp ogt double %9, 1.800000e+02
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load double, double* %2
%13 = fsub double 3.600000e+02, %12
store double %13, double* %2
br label %14
14: ; preds = %11, %8
br label %15
15: ; preds = %14, %5
%16 = load double, double* %2
ret double %16
}

LLVM IR (-O2):
define double @convertlong(double %0) {
%2 = fcmp olt double %0, 1.800000e+02
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = fneg double %0
br label %9
5: ; preds = %1
%6 = fcmp ogt double %0, 1.800000e+02
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = fsub double 3.600000e+02, %0
br label %9
9: ; preds = %5, %7, %3
%10 = phi double [ %4, %3 ], [ %8, %7 ], [ %0, %5 ]
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void Usage(const char *name) {
  fprintf(stderr, "Usage: %s INPUT_FILE_NAME\n", name);
  exit(-1);
}


x86 assembly (clang, -O0):
<Usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<Usage>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"Usage: %s INPUT_FILE_NAME\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 ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"Usage: %s INPUT_FILE_NAME\0A\00"
define void @Usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 -1)
unreachable
}
/* Type definitions */
struct cpu {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ cpu_set_d(struct cpu *, unsigned char);
int /*<<< orphan*/ cpu_set_e(struct cpu *, unsigned char);
void cpu_set_de(struct cpu *cpu, unsigned short de) {
  unsigned char d = ((unsigned char)(((unsigned short)(de)) >> 8));
  unsigned char e = ((unsigned char)(((unsigned short)(de)) >> 0));
  cpu_set_d(cpu, d);
  cpu_set_e(cpu, e);
}


x86 assembly (clang, -O0):
<cpu_set_de>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
movzwl -0xa(%rbp),%eax
sar    $0x8,%eax
mov    %al,-0xb(%rbp)
movzwl -0xa(%rbp),%eax
sar    $0x0,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
movzbl -0xb(%rbp),%esi
call   1040 <cpu_set_d@plt>
mov    -0x8(%rbp),%rdi
movzbl -0xc(%rbp),%esi
call   1030 <cpu_set_e@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_set_de>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
shr    $0x8,%esi
call   1040 <cpu_set_d@plt>
movzbl %bl,%esi
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <cpu_set_e@plt>

LLVM IR (-O0):
%struct.cpu = type { i32 }
define void @cpu_set_de(%struct.cpu* %0, i16 zeroext %1) {
%3 = alloca %struct.cpu*
%4 = alloca i16
%5 = alloca i8
%6 = alloca i8
store %struct.cpu* %0, %struct.cpu** %3
store i16 %1, i16* %4
%7 = load i16, i16* %4
%8 = zext i16 %7 to i32
%9 = ashr i32 %8, 8
%10 = trunc i32 %9 to i8
store i8 %10, i8* %5
%11 = load i16, i16* %4
%12 = zext i16 %11 to i32
%13 = ashr i32 %12, 0
%14 = trunc i32 %13 to i8
store i8 %14, i8* %6
%15 = load %struct.cpu*, %struct.cpu** %3
%16 = load i8, i8* %5
%17 = call i32 @cpu_set_d(%struct.cpu* %15, i8 zeroext %16)
%18 = load %struct.cpu*, %struct.cpu** %3
%19 = load i8, i8* %6
%20 = call i32 @cpu_set_e(%struct.cpu* %18, i8 zeroext %19)
ret void
}

LLVM IR (-O2):
%struct.cpu = type { i32 }
define void @cpu_set_de(%struct.cpu* %0, i16 zeroext %1) {
%3 = lshr i16 %1, 8
%4 = trunc i16 %3 to i8
%5 = trunc i16 %1 to i8
%6 = tail call i32 @cpu_set_d(%struct.cpu* %0, i8 zeroext %4)
%7 = tail call i32 @cpu_set_e(%struct.cpu* %0, i8 zeroext %5)
ret void
}