xunge/DecIR huggingface dataset:
/* Type definitions */
struct target {
  int dummy;
};

/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ snprintf(char *, int, char *);
char *dump_sys_inotify_init(int depth, struct target *target) {
  char *param_str = malloc(5);
  snprintf(param_str, 5, "void");
  return param_str;
}


x86 assembly (clang, -O0):
<dump_sys_inotify_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x5,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x5,%esi
lea    0xeb3(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_sys_inotify_init>:
push   %rbx
mov    $0x5,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xecb(%rip),%rdx
mov    %rax,%rdi
mov    $0x5,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.target = type { i32 }
@.str = [5 x i8] c"void\00"
define i8* @dump_sys_inotify_init(i32 %0, %struct.target* %1) {
%3 = alloca i32
%4 = alloca %struct.target*
%5 = alloca i8*
store i32 %0, i32* %3
store %struct.target* %1, %struct.target** %4
%6 = call i8* @malloc(i32 5)
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = call i32 @snprintf(i8* %7, i32 5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = load i8*, i8** %5
ret i8* %9
}

LLVM IR (-O2):
%struct.target = type { i32 }
@.str = [5 x i8] c"void\00"
define i8* @dump_sys_inotify_init(i32 %0, %struct.target* nocapture readnone %1) {
%3 = tail call dereferenceable_or_null(5) i8* @malloc(i32 5)
%4 = tail call i32 @snprintf(i8* %3, i32 5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %3
}
/* Variables and functions */
long __bswapq(long long);
long test__bswapq(long long X) { return __bswapq(X); }


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

x86 assembly (clang, -O2):
<test__bswapq>:
jmp    1030 <__bswapq@plt>

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

LLVM IR (-O2):
define i64 @test__bswapq(i64 %0) {
%2 = tail call i64 @__bswapq(i64 %0)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int, int);
void exitfunc16(int status, void *arg) {
  printf("Executing exitfunc16 (status=%d, arg=%d)\n", status, (int)arg);
  exit((int)arg);
}


x86 assembly (clang, -O0):
<exitfunc16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    %eax,%edx
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<exitfunc16>:
push   %rbx
mov    %rsi,%rbx
mov    %edi,%esi
lea    0xed3(%rip),%rdi
mov    %ebx,%edx
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"Executing exitfunc16 (status=%d, arg=%d)\0A\00"
define void @exitfunc16(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
%7 = ptrtoint i8* %6 to i32
%8 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %7)
%9 = load i8*, i8** %4
%10 = ptrtoint i8* %9 to i32
%11 = call i32 @exit(i32 %10)
unreachable
}

LLVM IR (-O2):
@.str = [42 x i8] c"Executing exitfunc16 (status=%d, arg=%d)\0A\00"
define void @exitfunc16(i32 %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = trunc i64 %3 to i32
%5 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %4)
%6 = tail call i32 @exit(i32 %4)
unreachable
}
/* Type definitions */
typedef unsigned int uint8_t;

/* Variables and functions */
uint8_t _parity(unsigned int value) {
  uint8_t p = 0;
  while (value) {
    p ^= value & 1;
    value >>= 1;
  }
  return (p);
}


x86 assembly (clang, -O0):
<_parity>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1132 <_parity+0x32>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110e <_parity+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_parity>:
xor    %eax,%eax
test   %edi,%edi
je     1120 <_parity+0x20>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edi,%edx
and    $0x1,%edx
xor    %edx,%eax
shr    %ecx
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <_parity+0x10>
ret

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

LLVM IR (-O2):
define i32 @_parity(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = and i32 %5, 1
%7 = xor i32 %4, %6
%8 = lshr i32 %5, 1
%9 = icmp ult i32 %5, 2
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void _default_free(void *data) {
  if (data) {
    free(data);
  }
}


x86 assembly (clang, -O0):
<_default_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <_default_free+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_default_free>:
test   %rdi,%rdi
je     111a <_default_free+0xa>
jmp    1030 <free@plt>
ret

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

LLVM IR (-O2):
define void @_default_free(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Type definitions */
struct _cmd {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ do_xit();
void xit(struct _cmd *dummy) { do_xit(); }


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

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

LLVM IR (-O0):
%struct._cmd = type { i32 }
define void @xit(%struct._cmd* %0) {
%2 = alloca %struct._cmd*
store %struct._cmd* %0, %struct._cmd** %2
%3 = call i32 (...) @do_xit()
ret void
}

LLVM IR (-O2):
%struct._cmd = type { i32 }
define void @xit(%struct._cmd* nocapture readnone %0) {
%2 = tail call i32 (...) @do_xit()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int quaddobl_Newton_step();
int quaddobl_sample_to_new_slices();
int quaddobl_witness_set_to_system_container();
int solcon_write_quaddobl_solutions();
int swap_quaddobl_slices();
int quaddobl_track_paths(void) {
  int *a, *b, fail;
  double *c;
  fail = quaddobl_sample_to_new_slices();
  if (0 > 0)
    printf("Done tracking.\n");
  if (0 > 1)
    printf("Solutions computed :\n");
  if (0 > 1)
    fail = solcon_write_quaddobl_solutions();
  fail = swap_quaddobl_slices();
  fail = quaddobl_witness_set_to_system_container();
  fail = quaddobl_Newton_step();
  return fail;
}


x86 assembly (clang, -O0):
<quaddobl_track_paths>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1030 <quaddobl_sample_to_new_slices@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <swap_quaddobl_slices@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1050 <quaddobl_witness_set_to_system_container@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1060 <quaddobl_Newton_step@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quaddobl_track_paths>:
push   %rax
xor    %eax,%eax
call   1030 <quaddobl_sample_to_new_slices@plt>
xor    %eax,%eax
call   1040 <swap_quaddobl_slices@plt>
xor    %eax,%eax
call   1050 <quaddobl_witness_set_to_system_container@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <quaddobl_Newton_step@plt>

LLVM IR (-O0):
define i32 @quaddobl_track_paths() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = call i32 (...) @quaddobl_sample_to_new_slices()
store i32 %5, i32* %3
%6 = call i32 (...) @swap_quaddobl_slices()
store i32 %6, i32* %3
%7 = call i32 (...) @quaddobl_witness_set_to_system_container()
store i32 %7, i32* %3
%8 = call i32 (...) @quaddobl_Newton_step()
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @quaddobl_track_paths() {
%1 = tail call i32 (...) @quaddobl_sample_to_new_slices()
%2 = tail call i32 (...) @swap_quaddobl_slices()
%3 = tail call i32 (...) @quaddobl_witness_set_to_system_container()
%4 = tail call i32 (...) @quaddobl_Newton_step()
ret i32 %4
}
/* Variables and functions */
char *findMatch(char *);
int /*<<< orphan*/ getString3(char **);
int /*<<< orphan*/ printString(char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  char *line;
  char *result;
  char *c;
  getString3(&line);
  printString(line);
  result = findMatch(line);
  if (result == NULL) {
    printf("Too bad no match\n");
  } else {
    printf("Yippee a match is found\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
call   1050 <getString3@plt>
mov    -0x18(%rbp),%rdi
call   1040 <printString@plt>
mov    -0x18(%rbp),%rdi
call   1060 <findMatch@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1191 <main+0x51>
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
jmp    119d <main+0x5d>
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %rsp,%rdi
call   1050 <getString3@plt>
mov    (%rsp),%rdi
call   1040 <printString@plt>
mov    (%rsp),%rdi
call   1060 <findMatch@plt>
test   %rax,%rax
lea    0xeb3(%rip),%rax
lea    0xe94(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Too bad no match\0A\00"
@.str.1 = [25 x i8] c"Yippee a match is found\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 @getString3(i8** %6)
%10 = load i8*, i8** %6
%11 = call i32 @printString(i8* %10)
%12 = load i8*, i8** %6
%13 = call i8* @findMatch(i8* %12)
store i8* %13, i8** %7
%14 = load i8*, i8** %7
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %20
18: ; preds = %2
%19 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %16
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@str = [24 x i8] c"Yippee a match is found\00"
@str.2 = [17 x i8] c"Too bad no match\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call i32 @getString3(i8** %3)
%6 = load i8*, i8** %3
%7 = call i32 @printString(i8* %6)
%8 = load i8*, i8** %3
%9 = call i8* @findMatch(i8* %8)
%10 = icmp eq i8* %9, null
%11 = select i1 %10, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0)
%12 = call i32 @puts(i8* dereferenceable(1) %11)
ret i32 0
}
int check_is_range(char *val) {
  for (; val[0]; *val++) {
    if (val[0] == '-') {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_is_range>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1147 <check_is_range+0x47>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1131 <check_is_range+0x31>
movl   $0x1,-0x4(%rbp)
jmp    114e <check_is_range+0x4e>
jmp    1136 <check_is_range+0x36>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1108 <check_is_range+0x8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_is_range>:
movzbl (%rdi),%eax
test   %al,%al
je     1111 <check_is_range+0x11>
cmp    $0x2d,%al
je     1114 <check_is_range+0x14>
add    $0x1,%rdi
jmp    1100 <check_is_range>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @check_is_range(i8* nocapture %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 0, label %8
i8 45, label %7
]
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2
br label %8
8: ; preds = %2, %7
%9 = phi i32 [ 1, %7 ], [ 0, %2 ]
ret i32 %9
}
const char *rcsid(const char *p) {
  return rcsid(
      p = "@(#)$Id: apptype.c,v 1.6 2003/11/11 20:01:45 christos Exp $");
}


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

x86 assembly (clang, -O2):
<rcsid>:
jmp    1100 <rcsid>

LLVM IR (-O0):
@.str = [60 x i8] c"@(#)$Id: apptype.c,v 1.6 2003/11/11 20:01:45 christos Exp $\00"
define i8* @rcsid(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = call i8* @rcsid(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
ret i8* %3
}

LLVM IR (-O2):
define noalias i8* @rcsid(i8* nocapture readnone %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ variadic(char *, char, char *, int, long, unsigned long,
                            unsigned long long, double);
int main(void) {
  variadic("print %c %s %d %ld %lu %lld %f", 'a', "hello", 100, 1234L, 5678UL,
           9876543210ULL, 3.141592);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee2(%rip),%rdi
mov    $0x61,%esi
lea    0xef5(%rip),%rdx
mov    $0x64,%ecx
mov    $0x4d2,%r8d
mov    $0x162e,%r9d
movabs $0x24cb016ea,%rax
movsd  0xeab(%rip),%xmm0
mov    %rax,(%rsp)
call   1030 <variadic@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movabs $0x24cb016ea,%rax
mov    %rax,(%rsp)
lea    0xee2(%rip),%rdi
lea    0xefa(%rip),%rdx
movsd  0xecb(%rip),%xmm0
mov    $0x4d2,%r8d
mov    $0x162e,%r9d
mov    $0x61,%esi
mov    $0x64,%ecx
call   1030 <variadic@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"print %c %s %d %ld %lu %lld %f\00"
@.str.1 = [6 x i8] c"hello\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @variadic(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8 signext 97, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 100, i64 1234, i64 5678, i64 9876543210, double 0x400921FAFC8B007A)
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"print %c %s %d %ld %lu %lld %f\00"
@.str.1 = [6 x i8] c"hello\00"
define i32 @main() {
%1 = tail call i32 @variadic(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8 signext 97, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 100, i64 1234, i64 5678, i64 9876543210, double 0x400921FAFC8B007A)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ bb_error_d(char *, char *, char *);
void show_usage(void) {
  bb_error_d(
      "%s\n%s\n",
      "Usage: [-I local_include_paths] [-dw] "
      "[-k path_for_stored_keys] [dirs]",
      "\nOptions:"
      "\n\t-I local_include_path  include paths, default: \""
      "include"
      "\""
      "\n\t-d                     don't generate depend"
      "\n\t-w                     show warning if include files not found"
      "\n\t-k include/config      default: \""
      "include"
      "/config"
      "\""
      "\n\t-c include/config.h    configs, default: \""
      "include"
      "/bb_config.h"
      "\""
      "\n\tdirs_to_scan           default \".\"");
}


x86 assembly (clang, -O0):
<show_usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee5(%rip),%rsi
lea    0xf25(%rip),%rdx
call   1030 <bb_error_d@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_usage>:
lea    0xee9(%rip),%rdi
lea    0xee9(%rip),%rsi
lea    0xf29(%rip),%rdx
jmp    1030 <bb_error_d@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%s\0A%s\0A\00"
@.str.1 = [71 x i8] c"Usage: [-I local_include_paths] [-dw] [-k path_for_stored_keys] [dirs]\00"
@.str.2 = [328 x i8] c"\0AOptions:\0A\09-I local_include_path include paths, default: \22include\22\0A\09-d don't generate depend\0A\09-w show warning if include files not found\0A\09-k include/config default: \22include/config\22\0A\09-c include/config.h configs, default: \22include/bb_config.h\22\0A\09dirs_to_scan default \22.\22\00"
define void @show_usage() {
%1 = call i32 @bb_error_d(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([328 x i8], [328 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s\0A%s\0A\00"
@.str.1 = [71 x i8] c"Usage: [-I local_include_paths] [-dw] [-k path_for_stored_keys] [dirs]\00"
@.str.2 = [328 x i8] c"\0AOptions:\0A\09-I local_include_path include paths, default: \22include\22\0A\09-d don't generate depend\0A\09-w show warning if include files not found\0A\09-k include/config default: \22include/config\22\0A\09-c include/config.h configs, default: \22include/bb_config.h\22\0A\09dirs_to_scan default \22.\22\00"
define void @show_usage() {
%1 = tail call i32 @bb_error_d(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([328 x i8], [328 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile uint16_t;

/* Variables and functions */
void reg16_toggle_bits(volatile uint16_t *reg, uint16_t value) {
  *reg ^= value;
}


x86 assembly (clang, -O0):
<reg16_toggle_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
xor    %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<reg16_toggle_bits>:
mov    %esi,-0x4(%rsp)
mov    -0x4(%rsp),%eax
xor    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @reg16_toggle_bits(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store volatile i32 %1, i32* %4
%5 = load volatile i32, i32* %4
%6 = load i32*, i32** %3
%7 = load volatile i32, i32* %6
%8 = xor i32 %7, %5
store volatile i32 %8, i32* %6
ret void
}

LLVM IR (-O2):
define void @reg16_toggle_bits(i32* %0, i32 %1) {
%3 = alloca i32
store volatile i32 %1, i32* %3
%4 = load volatile i32, i32* %3
%5 = load volatile i32, i32* %0
%6 = xor i32 %5, %4
store volatile i32 %6, i32* %0
ret void
}
void SPI3_IRQHandler() {}


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

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

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

LLVM IR (-O2):
define void @SPI3_IRQHandler() {
ret void
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
char *memchr(char const *, char, int);
ssize_t a_strnlen(const char *s, ssize_t n) {
  if (s) {
    const char *p = memchr(s, '\0', n);
    return p ? p - s : n;
  }
  return 0;
}


x86 assembly (clang, -O0):
<a_strnlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116f <a_strnlen+0x5f>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
xor    %esi,%esi
call   1030 <memchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     115b <a_strnlen+0x4b>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x28(%rbp)
jmp    1163 <a_strnlen+0x53>
movslq -0x14(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    1176 <a_strnlen+0x66>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_strnlen>:
test   %rdi,%rdi
je     1138 <a_strnlen+0x28>
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %esi,%esi
mov    %ebp,%edx
call   1030 <memchr@plt>
mov    %rax,%rcx
sub    %ebx,%eax
test   %rcx,%rcx
cmove  %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @a_strnlen(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %27
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = load i32, i32* %5
%12 = call i8* @memchr(i8* %10, i8 signext 0, i32 %11)
store i8* %12, i8** %6
%13 = load i8*, i8** %6
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %21
15: ; preds = %9
%16 = load i8*, i8** %6
%17 = load i8*, i8** %4
%18 = ptrtoint i8* %16 to i64
%19 = ptrtoint i8* %17 to i64
%20 = sub i64 %18, %19
br label %24
21: ; preds = %9
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
br label %24
24: ; preds = %21, %15
%25 = phi i64 [ %20, %15 ], [ %23, %21 ]
%26 = trunc i64 %25 to i32
store i32 %26, i32* %3
br label %28
27: ; preds = %2
store i32 0, i32* %3
br label %28
28: ; preds = %27, %24
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
define i32 @a_strnlen(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = tail call i8* @memchr(i8* %0, i8 signext 0, i32 %1)
%6 = icmp eq i8* %5, null
%7 = ptrtoint i8* %5 to i64
%8 = ptrtoint i8* %0 to i64
%9 = sub i64 %7, %8
%10 = zext i32 %1 to i64
%11 = select i1 %6, i64 %10, i64 %9
%12 = trunc i64 %11 to i32
br label %13
13: ; preds = %2, %4
%14 = phi i32 [ %12, %4 ], [ 0, %2 ]
ret i32 %14
}
void dbg(const char *format, ...) { (void)format; }


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

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

LLVM IR (-O0):
define void @dbg(i8* %0, ...) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
define void @dbg(i8* nocapture %0, ...) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void alrm(int signo) {
  printf("Operation timed out\n");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<alrm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@.str = [21 x i8] c"Operation timed out\0A\00"
@EXIT_SUCCESS = global i32 0
define void @alrm(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @EXIT_SUCCESS
%5 = call i32 @exit(i32 %4)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [20 x i8] c"Operation timed out\00"
define void @alrm(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128;

/* Variables and functions */
int /*<<< orphan*/ _mm_store_ps(float *, int /*<<< orphan*/);
float mm_sum(register __m128 sum) {
  float f[4] __attribute__((aligned(16)));
  _mm_store_ps(f, sum);
  return (f[0] + f[1] + f[2] + f[3]);
}


x86 assembly (clang, -O0):
<mm_sum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1030 <_mm_store_ps@plt>
movss  -0x20(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mm_sum>:
sub    $0x18,%rsp
mov    %edi,%esi
mov    %rsp,%rdi
call   1030 <_mm_store_ps@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @mm_sum(i32 %0) {
%2 = alloca i32
%3 = alloca [4 x float]
store i32 %0, i32* %2
%4 = getelementptr inbounds [4 x float], [4 x float]* %3, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @_mm_store_ps(float* %4, i32 %5)
%7 = getelementptr inbounds [4 x float], [4 x float]* %3, i64 0, i64 0
%8 = load float, float* %7
%9 = getelementptr inbounds [4 x float], [4 x float]* %3, i64 0, i64 1
%10 = load float, float* %9
%11 = fadd float %8, %10
%12 = getelementptr inbounds [4 x float], [4 x float]* %3, i64 0, i64 2
%13 = load float, float* %12
%14 = fadd float %11, %13
%15 = getelementptr inbounds [4 x float], [4 x float]* %3, i64 0, i64 3
%16 = load float, float* %15
%17 = fadd float %14, %16
ret float %17
}

LLVM IR (-O2):
define float @mm_sum(i32 %0) {
%2 = alloca [4 x float]
%3 = bitcast [4 x float]* %2 to i8*
%4 = getelementptr inbounds [4 x float], [4 x float]* %2, i64 0, i64 0
%5 = call i32 @_mm_store_ps(float* %4, i32 %0)
%6 = load float, float* %4
%7 = getelementptr inbounds [4 x float], [4 x float]* %2, i64 0, i64 1
%8 = load float, float* %7
%9 = fadd float %6, %8
%10 = getelementptr inbounds [4 x float], [4 x float]* %2, i64 0, i64 2
%11 = load float, float* %10
%12 = fadd float %9, %11
%13 = getelementptr inbounds [4 x float], [4 x float]* %2, i64 0, i64 3
%14 = load float, float* %13
%15 = fadd float %12, %14
ret float %15
}
long f3h(int i, long arg0, long arg1, long arg2, long arg3) {
  return i + arg0 + arg1 + arg2 + arg3;
}


x86 assembly (clang, -O0):
<f3h>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movslq -0x4(%rbp),%rax
add    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
add    -0x20(%rbp),%rax
add    -0x28(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f3h>:
movslq %edi,%rax
add    %rsi,%rax
add    %rdx,%rax
add    %rcx,%rax
add    %r8,%rax
ret

LLVM IR (-O0):
define i64 @f3h(i32 %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca i32
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i32 %0, i32* %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i64 %4, i64* %10
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = load i64, i64* %7
%14 = add nsw i64 %12, %13
%15 = load i64, i64* %8
%16 = add nsw i64 %14, %15
%17 = load i64, i64* %9
%18 = add nsw i64 %16, %17
%19 = load i64, i64* %10
%20 = add nsw i64 %18, %19
ret i64 %20
}

LLVM IR (-O2):
define i64 @f3h(i32 %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = sext i32 %0 to i64
%7 = add nsw i64 %6, %1
%8 = add nsw i64 %7, %2
%9 = add nsw i64 %8, %3
%10 = add nsw i64 %9, %4
ret i64 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ teste();
int main(int argc, char *argv[]) {
  printf("Exemplo de função\n\n");
  teste();
  teste();
  printf("Fim...");
  system("pause");
  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    0xeb3(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <teste@plt>
mov    $0x0,%al
call   1050 <teste@plt>
lea    0xeaf(%rip),%rdi
call   1040 <printf@plt>
lea    0xeaa(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <teste@plt>
xor    %eax,%eax
call   1060 <teste@plt>
lea    0xe9e(%rip),%rdi
call   1050 <printf@plt>
lea    0xe99(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Exemplo de fun\C3\A7\C3\A3o\0A\0A\00"
@.str.1 = [7 x i8] c"Fim...\00"
@.str.2 = [6 x i8] c"pause\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 ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @teste()
%8 = call i32 (...) @teste()
%9 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"Fim...\00"
@.str.2 = [6 x i8] c"pause\00"
@str = [21 x i8] c"Exemplo de fun\C3\A7\C3\A3o\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @teste()
%5 = tail call i32 (...) @teste()
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
long filesize(const char *name) {
  long n;
  FILE *f = fopen(name, "r");
  fseek(f, 0, SEEK_END);
  n = ftell(f) / sizeof(double);
  fclose(f);
  return n;
}


x86 assembly (clang, -O0):
<filesize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2e7d(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <fseek@plt>
mov    -0x18(%rbp),%rdi
call   1040 <ftell@plt>
cltq
shr    $0x3,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filesize>:
push   %r14
push   %rbx
push   %rax
lea    0xeb5(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r14
mov    0x2e8e(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <fseek@plt>
mov    %r14,%rdi
call   1040 <ftell@plt>
movslq %eax,%rbx
shr    $0x3,%rbx
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@SEEK_END = global i32 0
define i64 @filesize(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %4
%7 = load i32*, i32** %4
%8 = load i32, i32* @SEEK_END
%9 = call i32 @fseek(i32* %7, i32 0, i32 %8)
%10 = load i32*, i32** %4
%11 = call i32 @ftell(i32* %10)
%12 = sext i32 %11 to i64
%13 = udiv i64 %12, 8
store i64 %13, i64* %3
%14 = load i32*, i32** %4
%15 = call i32 @fclose(i32* %14)
%16 = load i64, i64* %3
ret i64 %16
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@SEEK_END = global i32 0
define i64 @filesize(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @SEEK_END
%4 = tail call i32 @fseek(i32* %2, i32 0, i32 %3)
%5 = tail call i32 @ftell(i32* %2)
%6 = sext i32 %5 to i64
%7 = lshr i64 %6, 3
%8 = tail call i32 @fclose(i32* %2)
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void free_int(void *num) { free(num); }


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

x86 assembly (clang, -O2):
<free_int>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_int(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int main(int argc, char **argv) {
  char str[50];
  sprintf(str, "Hello");
  strcat(str, "World");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xec6(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x50(%rbp),%rdi
lea    0xebc(%rip),%rsi
call   1030 <strcat@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
movw   $0x6f,0x4(%rsp)
movl   $0x6c6c6548,(%rsp)
lea    0xedd(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcat@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Hello\00"
@.str.1 = [6 x i8] c"World\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [50 x i8]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%7 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%9 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"Hello\00"
@.str.1 = [6 x i8] c"World\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [50 x i8]
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%5 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
int strlen(char const *);
char *qe_strdup(const char *str) {
  size_t size = strlen(str) + 1;
  char *p = malloc(size);
  if (p)
    memcpy(p, str, size);
  return p;
}


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

x86 assembly (clang, -O2):
<qe_strdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
add    $0x1,%eax
movslq %eax,%r15
mov    %r15,%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1161 <qe_strdup+0x31>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @qe_strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = sext i32 %3 to i64
%5 = tail call i8* @malloc(i64 %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 @memcpy(i8* %5, i8* %0, i64 %4)
br label %9
9: ; preds = %7, %1
ret i8* %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ remove(char *);
int main() {
  remove("sulong_test_file");
  FILE *writeableFile = fopen("sulong_test_file", "r+");
  if (writeableFile != NULL) {
    exit(1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <remove@plt>
lea    0xeb5(%rip),%rdi
lea    0xebf(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1170 <main+0x40>
mov    $0x1,%edi
call   1050 <exit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <remove@plt>
lea    0xeca(%rip),%rsi
mov    %rbx,%rdi
call   1040 <fopen@plt>
test   %rax,%rax
jne    1158 <main+0x28>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"sulong_test_file\00"
@.str.1 = [3 x i8] c"r+\00"
define i32 @main() {
%1 = alloca i32*
%2 = call i32 @remove(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp ne i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @exit(i32 1)
unreachable
8: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"sulong_test_file\00"
@.str.1 = [3 x i8] c"r+\00"
define i32 @main() {
%1 = tail call i32 @remove(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 @exit(i32 1)
unreachable
6: ; preds = %0
ret i32 0
}
/* Variables and functions */
unsigned int get_hex8(char *);
unsigned int get_hex32_le(char *txt) {
  unsigned int val = 0;
  int i;
  for (i = 3; i >= 0; i--)
    val = (val << 8) | get_hex8(&txt[i * 2]);
  return val;
}


x86 assembly (clang, -O0):
<get_hex32_le>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x3,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     1169 <get_hex32_le+0x59>
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
cltq
add    %rax,%rdi
call   1030 <get_hex8@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    112a <get_hex32_le+0x1a>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_hex32_le>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
add    $0x6,%rdi
call   1030 <get_hex8@plt>
mov    %eax,%ebp
lea    0x4(%r14),%rdi
call   1030 <get_hex8@plt>
mov    %eax,%ebx
shl    $0x10,%ebp
shl    $0x8,%ebx
or     %ebp,%ebx
lea    0x2(%r14),%rdi
call   1030 <get_hex8@plt>
mov    %eax,%ebp
or     %ebx,%ebp
shl    $0x8,%ebp
mov    %r14,%rdi
call   1030 <get_hex8@plt>
or     %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_hex32_le(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 3, i32* %4
br label %5
5: ; preds = %18, %1
%6 = load i32, i32* %4
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %21
8: ; preds = %5
%9 = load i32, i32* %3
%10 = shl i32 %9, 8
%11 = load i8*, i8** %2
%12 = load i32, i32* %4
%13 = mul nsw i32 %12, 2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %11, i64 %14
%16 = call i32 @get_hex8(i8* %15)
%17 = or i32 %10, %16
store i32 %17, i32* %3
br label %18
18: ; preds = %8
%19 = load i32, i32* %4
%20 = add nsw i32 %19, -1
store i32 %20, i32* %4
br label %5
21: ; preds = %5
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @get_hex32_le(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 6
%3 = tail call i32 @get_hex8(i8* %2)
%4 = getelementptr inbounds i8, i8* %0, i64 4
%5 = tail call i32 @get_hex8(i8* %4)
%6 = shl i32 %3, 16
%7 = shl i32 %5, 8
%8 = or i32 %6, %7
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = tail call i32 @get_hex8(i8* %9)
%11 = or i32 %10, %8
%12 = shl i32 %11, 8
%13 = tail call i32 @get_hex8(i8* %0)
%14 = or i32 %13, %12
ret i32 %14
}
/* Type definitions */
typedef int /*<<< orphan*/ MD5_CTX;

/* Variables and functions */
int MD5_Init(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int main(void) {
  MD5_CTX md5_ctx;
  int result;
  result = MD5_Init(&md5_ctx);
  if (result == 1) {
    printf("MD5_Init success!\n");
  } else {
    printf("MD5_Init error!\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <MD5_Init@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1156 <main+0x36>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
jmp    116e <main+0x4e>
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1175 <main+0x55>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rdi
call   1040 <MD5_Init@plt>
xor    %ebx,%ebx
cmp    $0x1,%eax
setne  %bl
lea    0xed2(%rip),%rax
lea    0xebb(%rip),%rdi
cmove  %rax,%rdi
neg    %ebx
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"MD5_Init success!\0A\00"
@.str.1 = [17 x i8] c"MD5_Init error!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @MD5_Init(i32* %2)
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %11
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %1
br label %12
11: ; preds = %7
store i32 0, i32* %1
br label %12
12: ; preds = %11, %9
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@str = [16 x i8] c"MD5_Init error!\00"
@str.2 = [18 x i8] c"MD5_Init success!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @MD5_Init(i32* %1)
%4 = icmp eq i32 %3, 1
%5 = select i1 %4, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0)
%6 = xor i1 %4, true
%7 = sext i1 %6 to i32
%8 = call i32 @puts(i8* dereferenceable(1) %5)
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *open_file(char const *, char *, char *);
FILE *open_text_file(const char *file) {
  return open_file(file, "r", "reading");
}


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

x86 assembly (clang, -O2):
<open_text_file>:
lea    0xee9(%rip),%rsi
lea    0xee4(%rip),%rdx
jmp    1030 <open_file@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [8 x i8] c"reading\00"
define i32* @open_text_file(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32* @open_file(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
ret i32* %4
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [8 x i8] c"reading\00"
define i32* @open_text_file(i8* %0) {
%2 = tail call i32* @open_file(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
ret i32* %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ free_();
void hlt() {
  free_();
  exit(0);
}


x86 assembly (clang, -O0):
<hlt>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <free_@plt>
xor    %edi,%edi
call   1030 <exit@plt>

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

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

LLVM IR (-O2):
define void @hlt() {
%1 = tail call i32 (...) @free_()
%2 = tail call i32 @exit(i32 0)
unreachable
}