xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ find_redstone_card();
int /*<<< orphan*/ time_loop();
int main(int argc, char *argv[]) {
  find_redstone_card();
  time_loop();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @find_redstone_card()
%7 = call i32 (...) @time_loop()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @find_redstone_card()
%4 = tail call i32 (...) @time_loop()
ret i32 0
}
void words(const char *sentence, void (*callback)(const char *, void *),
           void *memo) {}


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

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

LLVM IR (-O0):
define void @words(i8* %0, void (i8*, i8*)* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca void (i8*, i8*)*
%6 = alloca i8*
store i8* %0, i8** %4
store void (i8*, i8*)* %1, void (i8*, i8*)** %5
store i8* %2, i8** %6
ret void
}

LLVM IR (-O2):
define void @words(i8* nocapture %0, void (i8*, i8*)* nocapture %1, i8* nocapture %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("niagrad: [-d] [-n] config [logfile]\n");
  exit(EXIT_FAILURE);
}


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

x86 assembly (clang, -O2):
<usage>:
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 = [37 x i8] c"niagrad: [-d] [-n] config [logfile]\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_FAILURE
%3 = call i32 @exit(i32 %2)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@str = [36 x i8] c"niagrad: [-d] [-n] config [logfile]\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_FAILURE
%3 = tail call i32 @exit(i32 %2)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ html_parser_ltrim(char *, size_t *);
char *html_parser_rtrim(int /*<<< orphan*/, size_t *);
char *html_parser_trim(char *src, size_t *len) {
  return html_parser_rtrim(html_parser_ltrim(src, len), len);
}


x86 assembly (clang, -O0):
<html_parser_trim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <html_parser_ltrim@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1030 <html_parser_rtrim@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<html_parser_trim>:
push   %rbx
mov    %rsi,%rbx
call   1040 <html_parser_ltrim@plt>
mov    %eax,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <html_parser_rtrim@plt>

LLVM IR (-O0):
define i8* @html_parser_trim(i8* %0, i64* %1) {
%3 = alloca i8*
%4 = alloca i64*
store i8* %0, i8** %3
store i64* %1, i64** %4
%5 = load i8*, i8** %3
%6 = load i64*, i64** %4
%7 = call i32 @html_parser_ltrim(i8* %5, i64* %6)
%8 = load i64*, i64** %4
%9 = call i8* @html_parser_rtrim(i32 %7, i64* %8)
ret i8* %9
}

LLVM IR (-O2):
define i8* @html_parser_trim(i8* %0, i64* %1) {
%3 = tail call i32 @html_parser_ltrim(i8* %0, i64* %1)
%4 = tail call i8* @html_parser_rtrim(i32 %3, i64* %1)
ret i8* %4
}
void m_line_destroyed() {}


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

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

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

LLVM IR (-O2):
define void @m_line_destroyed() {
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
void func() {
  int *arr = (int *)malloc(sizeof(int) * 10);
  int i;
  for (i = 0; i < 10; i++)
    arr[i] = i;
  int *b = &arr[5];
  int **c = &arr;
  int **d = &arr + 4;
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x28,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1153 <func+0x43>
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <func+0x1d>
mov    -0x8(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x18(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x8(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x28(%rbp)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
push   %rax
mov    $0x28,%edi
call   1030 <malloc@plt>
movaps 0xede(%rip),%xmm0
movups %xmm0,(%rax)
movaps 0xee4(%rip),%xmm0
movups %xmm0,0x10(%rax)
movabs $0x900000008,%rcx
mov    %rcx,0x20(%rax)
pop    %rax
ret

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

LLVM IR (-O2):
define void @func() {
%1 = tail call i64 @malloc(i32 40)
%2 = inttoptr i64 %1 to i32*
%3 = inttoptr i64 %1 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %3
%4 = getelementptr inbounds i32, i32* %2, i64 4
%5 = bitcast i32* %4 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %5
%6 = getelementptr inbounds i32, i32* %2, i64 8
store i32 8, i32* %6
%7 = getelementptr inbounds i32, i32* %2, i64 9
store i32 9, i32* %7
ret void
}
/* Type definitions */
struct TNCDATA {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ PUTCHARINBUFFER(struct TNCDATA *, int);
void KBECHO(struct TNCDATA *TNC, int Char) { PUTCHARINBUFFER(TNC, Char); }


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

x86 assembly (clang, -O2):
<KBECHO>:
jmp    1030 <PUTCHARINBUFFER@plt>

LLVM IR (-O0):
%struct.TNCDATA = type { i32 }
define void @KBECHO(%struct.TNCDATA* %0, i32 %1) {
%3 = alloca %struct.TNCDATA*
%4 = alloca i32
store %struct.TNCDATA* %0, %struct.TNCDATA** %3
store i32 %1, i32* %4
%5 = load %struct.TNCDATA*, %struct.TNCDATA** %3
%6 = load i32, i32* %4
%7 = call i32 @PUTCHARINBUFFER(%struct.TNCDATA* %5, i32 %6)
ret void
}

LLVM IR (-O2):
%struct.TNCDATA = type { i32 }
define void @KBECHO(%struct.TNCDATA* %0, i32 %1) {
%3 = tail call i32 @PUTCHARINBUFFER(%struct.TNCDATA* %0, i32 %1)
ret void
}
void error_simgen_destroy(void *gen) {}


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

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

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

LLVM IR (-O2):
define void @error_simgen_destroy(i8* nocapture %0) {
ret void
}
void ft_add_test_case(char **data, char *dest, char *src, char *nb) {
  data[0] = dest;
  data[1] = src;
  data[2] = nb;
}


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

x86 assembly (clang, -O2):
<ft_add_test_case>:
mov    %rsi,(%rdi)
mov    %rdx,0x8(%rdi)
mov    %rcx,0x10(%rdi)
ret

LLVM IR (-O0):
define void @ft_add_test_case(i8** %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8** %0, i8*** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %6
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
store i8* %9, i8** %11
%12 = load i8*, i8** %7
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
store i8* %12, i8** %14
%15 = load i8*, i8** %8
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 2
store i8* %15, i8** %17
ret void
}

LLVM IR (-O2):
define void @ft_add_test_case(i8** nocapture writeonly %0, i8* %1, i8* %2, i8* %3) {
store i8* %1, i8** %0
%5 = getelementptr inbounds i8*, i8** %0, i64 1
store i8* %2, i8** %5
%6 = getelementptr inbounds i8*, i8** %0, i64 2
store i8* %3, i8** %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ putchar(char);
void println(int a[], int len) {
  int i;
  for (i = 0; i < len; i++)
    printf("%d ", a[i]);
  putchar('\n');
}


x86 assembly (clang, -O0):
<println>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1167 <println+0x47>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <println+0x16>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<println>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1155 <println+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xec5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <println+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @println(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i8 signext 10)
ret void
}
/* Variables and functions */
size_t lha_basic_reader_read_compressed(void *, void *, size_t);
size_t decoder_callback(void *buf, size_t buf_len, void *user_data) {
  return lha_basic_reader_read_compressed(user_data, buf, buf_len);
}


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

x86 assembly (clang, -O2):
<decoder_callback>:
mov    %rdx,%rax
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    %rax,%rdi
jmp    1030 <lha_basic_reader_read_compressed@plt>

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

LLVM IR (-O2):
define i64 @decoder_callback(i8* %0, i64 %1, i8* %2) {
%4 = tail call i64 @lha_basic_reader_read_compressed(i8* %2, i8* %0, i64 %1)
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ charattr(int /*<<< orphan*/);
int /*<<< orphan*/ curs_set(int);
int /*<<< orphan*/ mouse_set(int /*<<< orphan*/);
int /*<<< orphan*/ refresh();
endwin() {
  curs_set(1);
  mouse_set(0);
  charattr(0);
  refresh();
}


x86 assembly (clang, -O0):
<endwin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1050 <curs_set@plt>
xor    %edi,%edi
call   1040 <mouse_set@plt>
xor    %edi,%edi
call   1060 <charattr@plt>
mov    $0x0,%al
call   1030 <refresh@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<endwin>:
push   %rax
mov    $0x1,%edi
call   1050 <curs_set@plt>
xor    %edi,%edi
call   1040 <mouse_set@plt>
xor    %edi,%edi
call   1060 <charattr@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <refresh@plt>

LLVM IR (-O0):
define i32 @endwin() {
%1 = alloca i32
%2 = call i32 @curs_set(i32 1)
%3 = call i32 @mouse_set(i32 0)
%4 = call i32 @charattr(i32 0)
%5 = call i32 (...) @refresh()
%6 = load i32, i32* %1
ret i32 %6
}

LLVM IR (-O2):
define i32 @endwin() {
%1 = tail call i32 @curs_set(i32 1)
%2 = tail call i32 @mouse_set(i32 0)
%3 = tail call i32 @charattr(i32 0)
%4 = tail call i32 (...) @refresh()
ret i32 undef
}
void setPinMode(int pinNumber, int mode) { return; }


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

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

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

LLVM IR (-O2):
define void @setPinMode(i32 %0, i32 %1) {
ret void
}
void ff_hevc_put_hevc_uni_w_epel_hv24_10_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_w_epel_hv24_10_sse4() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void gc3355_close(int fd) {
  if (fd > 0)
    close(fd);
  return;
}


x86 assembly (clang, -O0):
<gc3355_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    112d <gc3355_close+0x1d>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gc3355_close>:
test   %edi,%edi
jle    1119 <gc3355_close+0x9>
jmp    1030 <close@plt>
ret

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

LLVM IR (-O2):
define void @gc3355_close(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @close(i32 %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ e_eor();
int /*<<< orphan*/ e_imm();
void e_eor_imm() {
  e_imm();
  e_eor();
}


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

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

LLVM IR (-O0):
define void @e_eor_imm() {
%1 = call i32 (...) @e_imm()
%2 = call i32 (...) @e_eor()
ret void
}

LLVM IR (-O2):
define void @e_eor_imm() {
%1 = tail call i32 (...) @e_imm()
%2 = tail call i32 (...) @e_eor()
ret void
}
/* Variables and functions */
scalar_t__ mock(char *);
char *cf_s_lock_dbc(char *s) { return (char *)mock(s); }


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

x86 assembly (clang, -O2):
<cf_s_lock_dbc>:
jmp    1030 <mock@plt>

LLVM IR (-O0):
define i8* @cf_s_lock_dbc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @mock(i8* %3)
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}

LLVM IR (-O2):
define i8* @cf_s_lock_dbc(i8* %0) {
%2 = tail call i64 @mock(i8* %0)
%3 = inttoptr i64 %2 to i8*
ret i8* %3
}
int c_para_f(float celsius) { return celsius * (9.0 / 5.0); }


x86 assembly (clang, -O0):
<c_para_f>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xee6(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_para_f>:
cvtss2sd %xmm0,%xmm0
mulsd  0xef4(%rip),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @c_para_f(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fmul double %4, 1.800000e+00
%6 = fptosi double %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @c_para_f(float %0) {
%2 = fpext float %0 to double
%3 = fmul double %2, 1.800000e+00
%4 = fptosi double %3 to i32
ret i32 %4
}
/* Variables and functions */
int crash2(int);
__attribute__((no)) int crash(int a) {
  a = crash2(a) + 1;
  return a * 2;
}


x86 assembly (clang, -O0):
<crash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <crash2@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crash>:
push   %rax
call   1030 <crash2@plt>
add    %eax,%eax
add    $0x2,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @crash(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @crash2(i32 %3)
%5 = add nsw i32 %4, 1
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = mul nsw i32 %6, 2
ret i32 %7
}

LLVM IR (-O2):
define i32 @crash(i32 %0) {
%2 = tail call i32 @crash2(i32 %0)
%3 = shl i32 %2, 1
%4 = add i32 %3, 2
ret i32 %4
}
void lgtd_lifx_wire_null_packet_handler(
    struct lgtd_lifx_gateway *gw, const struct lgtd_lifx_packet_header *hdr,
    const void *pkt) {
  (void)gw;
  (void)hdr;
  (void)pkt;
}


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

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

LLVM IR (-O0):
%struct.lgtd_lifx_gateway = type opaque
%struct.lgtd_lifx_packet_header = type opaque
define void @lgtd_lifx_wire_null_packet_handler(%struct.lgtd_lifx_gateway* %0, %struct.lgtd_lifx_packet_header* %1, i8* %2) {
%4 = alloca %struct.lgtd_lifx_gateway*
%5 = alloca %struct.lgtd_lifx_packet_header*
%6 = alloca i8*
store %struct.lgtd_lifx_gateway* %0, %struct.lgtd_lifx_gateway** %4
store %struct.lgtd_lifx_packet_header* %1, %struct.lgtd_lifx_packet_header** %5
store i8* %2, i8** %6
%7 = load %struct.lgtd_lifx_gateway*, %struct.lgtd_lifx_gateway** %4
%8 = load %struct.lgtd_lifx_packet_header*, %struct.lgtd_lifx_packet_header** %5
%9 = load i8*, i8** %6
ret void
}

LLVM IR (-O2):
%struct.lgtd_lifx_gateway = type opaque
%struct.lgtd_lifx_packet_header = type opaque
define void @lgtd_lifx_wire_null_packet_handler(%struct.lgtd_lifx_gateway* nocapture %0, %struct.lgtd_lifx_packet_header* nocapture %1, i8* nocapture %2) {
ret void
}
/* Variables and functions */
unsigned int b1_get_word(unsigned int);
int /*<<< orphan*/ b1_put_byte(unsigned int, int);
int /*<<< orphan*/ b1_put_word(unsigned int, unsigned int);
unsigned int b1_rd_reg(unsigned int base, unsigned int reg) {
  b1_put_byte(base, 0x01);
  b1_put_word(base, reg);
  return b1_get_word(base);
}


x86 assembly (clang, -O0):
<b1_rd_reg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1040 <b1_put_byte@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <b1_put_word@plt>
mov    -0x4(%rbp),%edi
call   1050 <b1_get_word@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<b1_rd_reg>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x1,%esi
call   1040 <b1_put_byte@plt>
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <b1_put_word@plt>
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <b1_get_word@plt>

LLVM IR (-O0):
define i32 @b1_rd_reg(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = call i32 @b1_put_byte(i32 %5, i32 1)
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = call i32 @b1_put_word(i32 %7, i32 %8)
%10 = load i32, i32* %3
%11 = call i32 @b1_get_word(i32 %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @b1_rd_reg(i32 %0, i32 %1) {
%3 = tail call i32 @b1_put_byte(i32 %0, i32 1)
%4 = tail call i32 @b1_put_word(i32 %0, i32 %1)
%5 = tail call i32 @b1_get_word(i32 %0)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fcn_00fa(int, int, int, int);
int /*<<< orphan*/ fcn_0ba4(int, int, int);
void fcn_0e3f() {
  fcn_00fa(0x0f40, 0x0b00, 0x50, 0x6784);
  fcn_0ba4(0x04e8, 0x0b00, 0x04ec);
}


x86 assembly (clang, -O0):
<fcn_0e3f>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf40,%edi
mov    $0xb00,%esi
mov    $0x50,%edx
mov    $0x6784,%ecx
call   1030 <fcn_00fa@plt>
mov    $0x4e8,%edi
mov    $0xb00,%esi
mov    $0x4ec,%edx
call   1040 <fcn_0ba4@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fcn_0e3f>:
push   %rax
mov    $0xf40,%edi
mov    $0xb00,%esi
mov    $0x50,%edx
mov    $0x6784,%ecx
call   1030 <fcn_00fa@plt>
mov    $0x4e8,%edi
mov    $0xb00,%esi
mov    $0x4ec,%edx
pop    %rax
jmp    1040 <fcn_0ba4@plt>

LLVM IR (-O0):
define void @fcn_0e3f() {
%1 = call i32 @fcn_00fa(i32 3904, i32 2816, i32 80, i32 26500)
%2 = call i32 @fcn_0ba4(i32 1256, i32 2816, i32 1260)
ret void
}

LLVM IR (-O2):
define void @fcn_0e3f() {
%1 = tail call i32 @fcn_00fa(i32 3904, i32 2816, i32 80, i32 26500)
%2 = tail call i32 @fcn_0ba4(i32 1256, i32 2816, i32 1260)
ret void
}
void test1(int x) {
  int buf[100];
  buf[100] = 1;
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
add    $0x120,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test1(i32 %0) {
%2 = alloca i32
%3 = alloca [100 x i32]
store i32 %0, i32* %2
%4 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 100
store i32 1, i32* %4
ret void
}

LLVM IR (-O2):
define void @test1(i32 %0) {
ret void
}
/* Variables and functions */
scalar_t__ is_g(unsigned char *, int);
scalar_t__ is_t(unsigned char *, int);
int is_ttg(unsigned char *seq, int n) {
  if (is_t(seq, n) == 0 || is_t(seq, n + 1) == 0 || is_g(seq, n + 2) == 0)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<is_ttg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <is_t@plt>
cmp    $0x0,%rax
je     1177 <is_ttg+0x57>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
call   1030 <is_t@plt>
cmp    $0x0,%rax
je     1177 <is_ttg+0x57>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x2,%esi
call   1040 <is_g@plt>
cmp    $0x0,%rax
jne    1183 <is_ttg+0x63>
movl   $0x0,-0x4(%rbp)
jmp    118a <is_ttg+0x6a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_ttg>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %rdi,%r14
call   1030 <is_t@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     115b <is_ttg+0x3b>
lea    0x1(%rbx),%esi
mov    %r14,%rdi
call   1030 <is_t@plt>
test   %rax,%rax
je     115b <is_ttg+0x3b>
add    $0x2,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <is_g@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @is_ttg(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i8*, i8** %4
%7 = load i32, i32* %5
%8 = call i64 @is_t(i8* %6, i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %22, label %10
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = load i32, i32* %5
%13 = add nsw i32 %12, 1
%14 = call i64 @is_t(i8* %11, i32 %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %22, label %16
16: ; preds = %10
%17 = load i8*, i8** %4
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 2
%20 = call i64 @is_g(i8* %17, i32 %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %16, %10, %2
store i32 0, i32* %3
br label %24
23: ; preds = %16
store i32 1, i32* %3
br label %24
24: ; preds = %23, %22
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @is_ttg(i8* %0, i32 %1) {
%3 = tail call i64 @is_t(i8* %0, i32 %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2
%6 = add nsw i32 %1, 1
%7 = tail call i64 @is_t(i8* %0, i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %5
%10 = add nsw i32 %1, 2
%11 = tail call i64 @is_g(i8* %0, i32 %10)
%12 = icmp ne i64 %11, 0
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %9, %2, %5
%15 = phi i32 [ 0, %5 ], [ 0, %2 ], [ %13, %9 ]
ret i32 %15
}
void unlock_spinlock(volatile int *spinlock) {
  __sync_synchronize();
  *spinlock = 0;
}


x86 assembly (clang, -O0):
<unlock_spinlock>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mfence
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<unlock_spinlock>:
mfence
movl   $0x0,(%rdi)
ret

LLVM IR (-O0):
define void @unlock_spinlock(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
fence seq_cst
%3 = load i32*, i32** %2
store volatile i32 0, i32* %3
ret void
}

LLVM IR (-O2):
define void @unlock_spinlock(i32* %0) {
fence seq_cst
store volatile i32 0, i32* %0
ret void
}
unsigned max(unsigned a, unsigned b) {
  if (a <= b)
    return b;
  return a;
}


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
ja     1121 <max+0x21>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <max+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
mov    %esi,%eax
cmp    %esi,%edi
cmova  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @max(i32 %0, i32 %1) {
%3 = icmp ugt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
__attribute__((no, noclone)) unsigned int foo(int x) {
  unsigned long long y = -1ULL >> x;
  return (unsigned int)y >> 31;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
mov    $0xffffffffffffffff,%rax
shr    %cl,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x1f,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %edi,%ecx
mov    $0xffffffffffffffff,%rax
shr    %cl,%rax
shr    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = zext i32 %4 to i64
%6 = lshr i64 -1, %5
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = trunc i64 %7 to i32
%9 = lshr i32 %8, 31
ret i32 %9
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = zext i32 %0 to i64
%3 = lshr i64 -1, %2
%4 = trunc i64 %3 to i32
%5 = lshr i32 %4, 31
ret i32 %5
}
void h(int *salida) {
  *salida = 123;
  return;
}


x86 assembly (clang, -O0):
<h>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x7b,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<h>:
movl   $0x7b,(%rdi)
ret

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

LLVM IR (-O2):
define void @h(i32* nocapture writeonly %0) {
store i32 123, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void main() { printf("Hello world...\n"); }


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

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

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

LLVM IR (-O2):
@str = [15 x i8] c"Hello world...\00"
define void @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *str_dup(const char *src) {
  char *tmp = (char *)malloc(strlen(src) + 1);
  if (tmp)
    strcpy(tmp, src);
  return tmp;
}


x86 assembly (clang, -O0):
<str_dup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116d <str_dup+0x3d>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_dup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1158 <str_dup+0x28>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @str_dup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i64 @malloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 @strcpy(i8* %5, i8* %0)
br label %9
9: ; preds = %7, %1
ret i8* %5
}
unsigned long swap(unsigned long value) {
  return ((value & 0x000000FF) << 24) | ((value & 0x0000FF00) << 8) |
         ((value & 0x00FF0000) >> 8) | ((value & 0xFF000000) >> 24);
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xff,%rax
shl    $0x18,%rax
mov    -0x8(%rbp),%rcx
and    $0xff00,%rcx
shl    $0x8,%rcx
or     %rcx,%rax
mov    -0x8(%rbp),%rcx
and    $0xff0000,%rcx
shr    $0x8,%rcx
or     %rcx,%rax
movabs $0xff000000,%rcx
and    -0x8(%rbp),%rcx
shr    $0x18,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
mov    %rdi,%rax
bswap  %eax
ret

LLVM IR (-O0):
define i64 @swap(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 255
%5 = shl i64 %4, 24
%6 = load i64, i64* %2
%7 = and i64 %6, 65280
%8 = shl i64 %7, 8
%9 = or i64 %5, %8
%10 = load i64, i64* %2
%11 = and i64 %10, 16711680
%12 = lshr i64 %11, 8
%13 = or i64 %9, %12
%14 = load i64, i64* %2
%15 = and i64 %14, 4278190080
%16 = lshr i64 %15, 24
%17 = or i64 %13, %16
ret i64 %17
}

LLVM IR (-O2):
define i64 @swap(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = tail call i32 @llvm.bswap.i32(i32 %2)
%4 = zext i32 %3 to i64
ret i64 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
size_t fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
long strtol(char *, int /*<<< orphan*/ *, int);
long get_value(FILE *fp) {
  char *tmp = malloc(20 * sizeof(char));
  memset(tmp, 0, 20 * sizeof(char));
  size_t read = fread(tmp, sizeof(char), 20, fp);
  long val = strtol(tmp, NULL, 10);
  free(tmp);
  return val;
}


x86 assembly (clang, -O0):
<get_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x14,%edi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1050 <memset@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x14,%edx
call   1040 <fread@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_value>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x14,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1050 <memset@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x14,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @get_value(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i32* %0, i32** %2
%6 = call i8* @malloc(i32 20)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = call i32 @memset(i8* %7, i32 0, i32 20)
%9 = load i8*, i8** %3
%10 = load i32*, i32** %2
%11 = call i64 @fread(i8* %9, i32 1, i32 20, i32* %10)
store i64 %11, i64* %4
%12 = load i8*, i8** %3
%13 = call i64 @strtol(i8* %12, i32* null, i32 10)
store i64 %13, i64* %5
%14 = load i8*, i8** %3
%15 = call i32 @free(i8* %14)
%16 = load i64, i64* %5
ret i64 %16
}

LLVM IR (-O2):
define i64 @get_value(i32* nocapture %0) {
%2 = tail call dereferenceable_or_null(20) i8* @malloc(i32 20)
%3 = tail call i32 @memset(i8* %2, i32 0, i32 20)
%4 = tail call i64 @fread(i8* %2, i32 1, i32 20, i32* %0)
%5 = tail call i64 @strtol(i8* nocapture %2, i32* null, i32 10)
%6 = tail call i32 @free(i8* %2)
ret i64 %5
}
int xtoi(char ch) {
  if ((ch >= '0') && (ch <= '9')) {
    return (ch - '0');
  }
  if ((ch >= 'a') && (ch <= 'f')) {
    return ch - 'a' + 10;
  }
  return ch - 'A' + 10;
}


x86 assembly (clang, -O0):
<xtoi>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1133 <xtoi+0x33>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1133 <xtoi+0x33>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    116c <xtoi+0x6c>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     115f <xtoi+0x5f>
movsbl -0x5(%rbp),%eax
cmp    $0x66,%eax
jg     115f <xtoi+0x5f>
movsbl -0x5(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    116c <xtoi+0x6c>
movsbl -0x5(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xtoi>:
lea    -0x30(%rdi),%eax
lea    -0x61(%rdi),%ecx
xor    %edx,%edx
cmp    $0x6,%cl
setae  %dl
shl    $0x5,%edx
add    $0xffffffa9,%edx
cmp    $0xa,%al
mov    $0xffffffd0,%eax
cmovae %edx,%eax
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @xtoi(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 48
store i32 %14, i32* %2
br label %33
15: ; preds = %7, %1
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = icmp sge i32 %17, 97
br i1 %18, label %19, label %28
19: ; preds = %15
%20 = load i8, i8* %3
%21 = sext i8 %20 to i32
%22 = icmp sle i32 %21, 102
br i1 %22, label %23, label %28
23: ; preds = %19
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = sub nsw i32 %25, 97
%27 = add nsw i32 %26, 10
store i32 %27, i32* %2
br label %33
28: ; preds = %19, %15
%29 = load i8, i8* %3
%30 = sext i8 %29 to i32
%31 = sub nsw i32 %30, 65
%32 = add nsw i32 %31, 10
store i32 %32, i32* %2
br label %33
33: ; preds = %28, %23, %11
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
define i32 @xtoi(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add i8 %0, -48
%4 = icmp ult i8 %3, 10
%5 = add i8 %0, -97
%6 = icmp ult i8 %5, 6
%7 = select i1 %6, i32 -87, i32 -55
%8 = select i1 %4, i32 -48, i32 %7
%9 = add nsw i32 %8, %2
ret i32 %9
}
/* Variables and functions */
int RSA2048_execute(int, char *);
int /*<<< orphan*/ printf(char *);
int RSA2048_Sign_STD(int fd) {
  int ret;
  ret = RSA2048_execute(fd, "BF13C00000");
  if (ret != 0) {
    printf("ERR:RSA2048_Encrypt failed!\n");
    return 1;
  }
}


x86 assembly (clang, -O0):
<RSA2048_Sign_STD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    0xecb(%rip),%rsi
call   1040 <RSA2048_execute@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     115a <RSA2048_Sign_STD+0x3a>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RSA2048_Sign_STD>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <RSA2048_execute@plt>
test   %eax,%eax
je     113d <RSA2048_Sign_STD+0x1d>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"BF13C00000\00"
@.str.1 = [29 x i8] c"ERR:RSA2048_Encrypt failed!\0A\00"
define i32 @RSA2048_Sign_STD(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @RSA2048_execute(i32 %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %2
br label %11
11: ; preds = %9, %1
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
@.str = [11 x i8] c"BF13C00000\00"
@str = [28 x i8] c"ERR:RSA2048_Encrypt failed!\00"
define i32 @RSA2048_Sign_STD(i32 %0) {
%2 = tail call i32 @RSA2048_execute(i32 %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %1, %4
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ jonesforth();
int main(int argc, char **argv) {
  jonesforth();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @jonesforth()
ret i32 0
}
/* Variables and functions */
scalar_t__ isalpha(char const);
int IsFullName(const char *FilePath) {
  if (isalpha(FilePath[0]) && ':' == FilePath[1]) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<IsFullName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isalpha@plt>
cmp    $0x0,%rax
je     1153 <IsFullName+0x43>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%ecx
mov    $0x3a,%eax
cmp    %ecx,%eax
jne    1153 <IsFullName+0x43>
movl   $0x1,-0x4(%rbp)
jmp    115a <IsFullName+0x4a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsFullName>:
push   %rbx
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <isalpha@plt>
test   %rax,%rax
je     112c <IsFullName+0x1c>
mov    $0x1,%eax
cmpb   $0x3a,0x1(%rbx)
je     112e <IsFullName+0x1e>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @IsFullName(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i64 @isalpha(i8 signext %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 58
br i1 %8, label %10, label %9
9: ; preds = %5, %1
br label %10
10: ; preds = %5, %9
%11 = phi i32 [ 0, %9 ], [ 1, %5 ]
ret i32 %11
}
/* Variables and functions */
float get(char *);
int /*<<< orphan*/ printf(char *, float);
void add() {
  float firstNum = get("Enter your first number");
  float secondNum = get("Enter your second number");
  float result = firstNum + secondNum;
  printf("Result: %f", result);
}


x86 assembly (clang, -O0):
<add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1040 <get@plt>
movss  %xmm0,-0x4(%rbp)
lea    0xed8(%rip),%rdi
call   1040 <get@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <get@plt>
movss  %xmm0,0x4(%rsp)
lea    0xede(%rip),%rdi
call   1040 <get@plt>
addss  0x4(%rsp),%xmm0
lea    0xee5(%rip),%rdi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"Enter your first number\00"
@.str.1 = [25 x i8] c"Enter your second number\00"
@.str.2 = [11 x i8] c"Result: %f\00"
define void @add() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = call float @get(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
store float %4, float* %1
%5 = call float @get(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
store float %5, float* %2
%6 = load float, float* %1
%7 = load float, float* %2
%8 = fadd float %6, %7
store float %8, float* %3
%9 = load float, float* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), float %9)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"Enter your first number\00"
@.str.1 = [25 x i8] c"Enter your second number\00"
@.str.2 = [11 x i8] c"Result: %f\00"
define void @add() {
%1 = tail call float @get(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%2 = tail call float @get(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%3 = fadd float %1, %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), float %3)
ret void
}
main() {
  int f() __attribute__((warn_unused));
  f();
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @f()
ret i32 0
}

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

/* Variables and functions */
int /*<<< orphan*/ ASN1_UTF8STRING_it;
int /*<<< orphan*/ ASN1_item_free(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
void ASN1_UTF8STRING_free(ASN1_UTF8STRING *a) {
  ASN1_item_free((ASN1_VALUE *)a, &ASN1_UTF8STRING_it);
}


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

x86 assembly (clang, -O2):
<ASN1_UTF8STRING_free>:
mov    0x2ec9(%rip),%rsi
jmp    1030 <ASN1_item_free@plt>

LLVM IR (-O0):
@ASN1_UTF8STRING_it = global i32 0
define void @ASN1_UTF8STRING_free(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @ASN1_item_free(i32* %3, i32* @ASN1_UTF8STRING_it)
ret void
}

LLVM IR (-O2):
@ASN1_UTF8STRING_it = global i32 0
define void @ASN1_UTF8STRING_free(i32* %0) {
%2 = tail call i32 @ASN1_item_free(i32* %0, i32* @ASN1_UTF8STRING_it)
ret void
}
int do_152() { return 152; }


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

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

LLVM IR (-O0):
define i32 @do_152() {
ret i32 152
}

LLVM IR (-O2):
define i32 @do_152() {
ret i32 152
}