xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ dns_cache_init();
int /*<<< orphan*/ http_cache_init();
int /*<<< orphan*/ rst_cache_init();
int init_cache() {
  rst_cache_init();
  http_cache_init();
  dns_cache_init();
}


x86 assembly (clang, -O0):
<init_cache>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rst_cache_init@plt>
mov    $0x0,%al
call   1040 <http_cache_init@plt>
mov    $0x0,%al
call   1050 <dns_cache_init@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_cache>:
push   %rax
xor    %eax,%eax
call   1030 <rst_cache_init@plt>
xor    %eax,%eax
call   1040 <http_cache_init@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <dns_cache_init@plt>

LLVM IR (-O0):
define i32 @init_cache() {
%1 = alloca i32
%2 = call i32 (...) @rst_cache_init()
%3 = call i32 (...) @http_cache_init()
%4 = call i32 (...) @dns_cache_init()
%5 = load i32, i32* %1
ret i32 %5
}

LLVM IR (-O2):
define i32 @init_cache() {
%1 = tail call i32 (...) @rst_cache_init()
%2 = tail call i32 (...) @http_cache_init()
%3 = tail call i32 (...) @dns_cache_init()
ret i32 undef
}
/* Variables and functions */
char const *getenv(char *);
const char *cgi_client_software(void) { return (getenv("HTTP_USER_AGENT")); }


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"HTTP_USER_AGENT\00"
define i8* @cgi_client_software() {
%1 = call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [16 x i8] c"HTTP_USER_AGENT\00"
define i8* @cgi_client_software() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ __fpurge(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ write(int, char *, int);
int main(void) {
  printf("Get-up stand-up, stand-up for your rights, by: ");
  __fpurge(stdout);
  write(1, "Bob Marley.\n", 12);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
call   1040 <__fpurge@plt>
mov    $0x1,%edi
lea    0xecb(%rip),%rsi
mov    $0xc,%edx
call   1030 <write@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
call   1040 <__fpurge@plt>
lea    0xede(%rip),%rsi
mov    $0x1,%edi
mov    $0xc,%edx
call   1030 <write@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [48 x i8] c"Get-up stand-up, stand-up for your rights, by: \00"
@stdout = global i32 0
@.str.1 = [13 x i8] c"Bob Marley.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = call i32 @__fpurge(i32 %3)
%5 = call i32 @write(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 12)
%6 = load i32, i32* @EXIT_SUCCESS
ret i32 %6
}

LLVM IR (-O2):
@.str = [48 x i8] c"Get-up stand-up, stand-up for your rights, by: \00"
@stdout = global i32 0
@.str.1 = [13 x i8] c"Bob Marley.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = tail call i32 @__fpurge(i32 %2)
%4 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 12)
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}
int a(int x) { return ~x + 1; }


x86 assembly (clang, -O0):
<a>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<a>:
mov    %edi,%eax
neg    %eax
ret

LLVM IR (-O0):
define i32 @a(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = xor i32 %3, -1
%5 = add nsw i32 %4, 1
ret i32 %5
}

LLVM IR (-O2):
define i32 @a(i32 %0) {
%2 = sub i32 0, %0
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ _DIAGASSERT(int /*<<< orphan*/);
int __sgetc(int /*<<< orphan*/ *);
int getc(FILE *fp) {
  int r;
  _DIAGASSERT(fp != NULL);
  ;
  r = __sgetc(fp);
  ;
  return r;
}


x86 assembly (clang, -O0):
<getc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <_DIAGASSERT@plt>
mov    -0x8(%rbp),%rdi
call   1040 <__sgetc@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getc>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <_DIAGASSERT@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <__sgetc@plt>

LLVM IR (-O0):
define i32 @getc(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = icmp ne i32* %4, null
%6 = zext i1 %5 to i32
%7 = call i32 @_DIAGASSERT(i32 %6)
%8 = load i32*, i32** %2
%9 = call i32 @__sgetc(i32* %8)
store i32 %9, i32* %3
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
define i32 @getc(i32* %0) {
%2 = icmp ne i32* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @_DIAGASSERT(i32 %3)
%5 = tail call i32 @__sgetc(i32* %0)
ret i32 %5
}
int main() {
  int sum = 0;
  if (sum++ || sum++) {
    sum += 4;
  }
  if (0 && sum++) {
    sum += 8;
  }
  return sum;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jne    113a <main+0x3a>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1143 <main+0x43>
mov    -0x8(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 6
}
int dagoptwrap(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @dagoptwrap() {
ret i32 1
}

LLVM IR (-O2):
define i32 @dagoptwrap() {
ret i32 1
}
/* Type definitions */
struct genlist {
  int dummy;
};
struct fileinfo_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ genlist_unique(struct genlist *);
void fileinfo_list_unique(struct fileinfo_list *tthis) {
  genlist_unique((struct genlist *)tthis);
}


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

x86 assembly (clang, -O2):
<fileinfo_list_unique>:
jmp    1030 <genlist_unique@plt>

LLVM IR (-O0):
%struct.fileinfo_list = type { i32 }
%struct.genlist = type { i32 }
define void @fileinfo_list_unique(%struct.fileinfo_list* %0) {
%2 = alloca %struct.fileinfo_list*
store %struct.fileinfo_list* %0, %struct.fileinfo_list** %2
%3 = load %struct.fileinfo_list*, %struct.fileinfo_list** %2
%4 = bitcast %struct.fileinfo_list* %3 to %struct.genlist*
%5 = call i32 @genlist_unique(%struct.genlist* %4)
ret void
}

LLVM IR (-O2):
%struct.fileinfo_list = type { i32 }
%struct.genlist = type { i32 }
define void @fileinfo_list_unique(%struct.fileinfo_list* %0) {
%2 = bitcast %struct.fileinfo_list* %0 to %struct.genlist*
%3 = tail call i32 @genlist_unique(%struct.genlist* %2)
ret void
}
/* Variables and functions */
int isPalindrome(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d\n", isPalindrome(123454321));
  printf("%d\n", isPalindrome(-123454321));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x75bc371,%edi
call   1040 <isPalindrome@plt>
mov    %eax,%esi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    $0xf8a43c8f,%edi
call   1040 <isPalindrome@plt>
mov    %eax,%esi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x75bc371,%edi
call   1040 <isPalindrome@plt>
lea    0xece(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0xf8a43c8f,%edi
call   1040 <isPalindrome@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @isPalindrome(i32 123454321)
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 @isPalindrome(i32 -123454321)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @isPalindrome(i32 123454321)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @isPalindrome(i32 -123454321)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
void kbd_unlock(void) {}


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

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

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

LLVM IR (-O2):
define void @kbd_unlock() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pem_password_cb;
typedef int /*<<< orphan*/ d2i_of_void;
typedef int /*<<< orphan*/ DH;
typedef int /*<<< orphan*/ BIO;

/* Variables and functions */
int /*<<< orphan*/ *PEM_ASN1_read_bio(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                      int /*<<< orphan*/ *, void **,
                                      int /*<<< orphan*/ *, void *);
int /*<<< orphan*/ PEM_STRING_DHPARAMS;
scalar_t__ d2i_DHparams;
DH *PEM_read_bio_DHparams(BIO *bp, DH **x, pem_password_cb *cb, void *u) {
  return PEM_ASN1_read_bio((d2i_of_void *)d2i_DHparams, PEM_STRING_DHPARAMS, bp,
                           (void **)x, cb, u);
}


x86 assembly (clang, -O0):
<PEM_read_bio_DHparams>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%rdi
mov    0x2e97(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
call   1030 <PEM_ASN1_read_bio@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PEM_read_bio_DHparams>:
mov    %rcx,%r9
mov    %rdx,%r8
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    0x2ec5(%rip),%rax
mov    (%rax),%rdi
mov    0x2ea3(%rip),%rax
mov    (%rax),%esi
jmp    1030 <PEM_ASN1_read_bio@plt>

LLVM IR (-O0):
@d2i_DHparams = global i64 0
@PEM_STRING_DHPARAMS = global i32 0
define i32* @PEM_read_bio_DHparams(i32* %0, i32** %1, i32* %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32**
%7 = alloca i32*
%8 = alloca i8*
store i32* %0, i32** %5
store i32** %1, i32*** %6
store i32* %2, i32** %7
store i8* %3, i8** %8
%9 = load i64, i64* @d2i_DHparams
%10 = inttoptr i64 %9 to i32*
%11 = load i32, i32* @PEM_STRING_DHPARAMS
%12 = load i32*, i32** %5
%13 = load i32**, i32*** %6
%14 = bitcast i32** %13 to i8**
%15 = load i32*, i32** %7
%16 = load i8*, i8** %8
%17 = call i32* @PEM_ASN1_read_bio(i32* %10, i32 %11, i32* %12, i8** %14, i32* %15, i8* %16)
ret i32* %17
}

LLVM IR (-O2):
@d2i_DHparams = global i64 0
@PEM_STRING_DHPARAMS = global i32 0
define i32* @PEM_read_bio_DHparams(i32* %0, i32** %1, i32* %2, i8* %3) {
%5 = load i64, i64* @d2i_DHparams
%6 = inttoptr i64 %5 to i32*
%7 = load i32, i32* @PEM_STRING_DHPARAMS
%8 = bitcast i32** %1 to i8**
%9 = tail call i32* @PEM_ASN1_read_bio(i32* %6, i32 %7, i32* %0, i8** %8, i32* %2, i8* %3)
ret i32* %9
}
/* Variables and functions */
int /*<<< orphan*/ g_free(char *);
extern void DeleteString(char *p) { g_free(p); }


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

x86 assembly (clang, -O2):
<DeleteString>:
jmp    1030 <g_free@plt>

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

LLVM IR (-O2):
define void @DeleteString(i8* %0) {
%2 = tail call i32 @g_free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ system(char *);
int rp_app_init() {
  fprintf(stderr, "Starting SDR transceiver server.\n");
  system("/opt/redpitaya/www/apps/sdr_transceiver/start.sh");
  return 0;
}


x86 assembly (clang, -O0):
<rp_app_init>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
lea    0xee2(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rp_app_init>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1040 <fprintf@plt>
lea    0xee5(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"Starting SDR transceiver server.\0A\00"
@.str.1 = [49 x i8] c"/opt/redpitaya/www/apps/sdr_transceiver/start.sh\00"
define i32 @rp_app_init() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @system(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"Starting SDR transceiver server.\0A\00"
@.str.1 = [49 x i8] c"/opt/redpitaya/www/apps/sdr_transceiver/start.sh\00"
define i32 @rp_app_init() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @system(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ read_user();
void start_game() { read_user(); }


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

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

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

LLVM IR (-O2):
define void @start_game() {
%1 = tail call i32 (...) @read_user()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f2_bar();
void f2_cconly(signed long long v_a, signed long long v_b) {
  if ((v_a & -15) | (v_b & 14))
    f2_bar();
}


x86 assembly (clang, -O0):
<f2_cconly>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
and    $0xfffffffffffffff1,%rax
mov    -0x10(%rbp),%rcx
and    $0xe,%rcx
or     %rcx,%rax
cmp    $0x0,%rax
je     1144 <f2_cconly+0x34>
mov    $0x0,%al
call   1030 <f2_bar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2_cconly>:
and    $0xfffffffffffffff1,%rdi
and    $0xe,%esi
or     %rdi,%rsi
je     1123 <f2_cconly+0x13>
xor    %eax,%eax
jmp    1030 <f2_bar@plt>
ret

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

LLVM IR (-O2):
define void @f2_cconly(i64 %0, i64 %1) {
%3 = and i64 %0, -15
%4 = and i64 %1, 14
%5 = or i64 %4, %3
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call i32 (...) @f2_bar()
br label %9
9: ; preds = %7, %2
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int INT_MIN;
int /*<<< orphan*/ itoa(int, char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  int n = INT_MIN;
  int m = 30;
  char s[50];
  itoa(n, s, m);
  printf("result:%s\n", s);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
movl   $0x1e,-0xc(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <itoa@plt>
lea    -0x40(%rbp),%rsi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
mov    0x2ebc(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rbx
mov    %rbx,%rsi
mov    $0x1e,%edx
call   1040 <itoa@plt>
lea    0xebb(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@INT_MIN = global i32 0
@.str = [11 x i8] c"result:%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [50 x i8]
store i32 0, i32* %1
%5 = load i32, i32* @INT_MIN
store i32 %5, i32* %2
store i32 30, i32* %3
%6 = load i32, i32* %2
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%8 = load i32, i32* %3
%9 = call i32 @itoa(i32 %6, i8* %7, i32 %8)
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32, i32* @EXIT_SUCCESS
ret i32 %12
}

LLVM IR (-O2):
@INT_MIN = global i32 0
@.str = [11 x i8] c"result:%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [50 x i8]
%2 = load i32, i32* @INT_MIN
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%4 = call i32 @itoa(i32 %2, i8* %3, i32 30)
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = load i32, i32* @EXIT_SUCCESS
ret i32 %6
}
print(const char *a, ...) {
  __builtin_va_list l;
  __builtin_va_start(l, a);
  int const t = printv(a, l);
  __builtin_va_end(l);
  return t;
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
test   %al,%al
je     114c <print+0x3c>
movaps %xmm0,-0xb0(%rbp)
movaps %xmm1,-0xa0(%rbp)
movaps %xmm2,-0x90(%rbp)
movaps %xmm3,-0x80(%rbp)
movaps %xmm4,-0x70(%rbp)
movaps %xmm5,-0x60(%rbp)
movaps %xmm6,-0x50(%rbp)
movaps %xmm7,-0x40(%rbp)
mov    %r9,-0xb8(%rbp)
mov    %r8,-0xc0(%rbp)
mov    %rcx,-0xc8(%rbp)
mov    %rdx,-0xd0(%rbp)
mov    %rsi,-0xd8(%rbp)
mov    %rdi,-0x8(%rbp)
lea    -0xe0(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x30,-0x1c(%rbp)
movl   $0x8,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
lea    -0x20(%rbp),%rsi
call   1030 <printv@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
sub    $0xd8,%rsp
mov    %rsi,0x28(%rsp)
mov    %rdx,0x30(%rsp)
mov    %rcx,0x38(%rsp)
mov    %r8,0x40(%rsp)
mov    %r9,0x48(%rsp)
test   %al,%al
je     116b <print+0x5b>
movaps %xmm0,0x50(%rsp)
movaps %xmm1,0x60(%rsp)
movaps %xmm2,0x70(%rsp)
movaps %xmm3,0x80(%rsp)
movaps %xmm4,0x90(%rsp)
movaps %xmm5,0xa0(%rsp)
movaps %xmm6,0xb0(%rsp)
movaps %xmm7,0xc0(%rsp)
lea    0x20(%rsp),%rax
mov    %rax,0x10(%rsp)
lea    0xe0(%rsp),%rax
mov    %rax,0x8(%rsp)
movabs $0x3000000008,%rax
mov    %rax,(%rsp)
mov    %rsp,%rsi
xor    %eax,%eax
call   1030 <printv@plt>
add    $0xd8,%rsp
ret

LLVM IR (-O0):
%struct.__va_list_tag = type { i32, i32, i8*, i8* }
define i32 @print(i8* %0, ...) {
%2 = alloca i8*
%3 = alloca [1 x %struct.__va_list_tag]
%4 = alloca i32
store i8* %0, i8** %2
%5 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %3, i64 0, i64 0
%6 = bitcast %struct.__va_list_tag* %5 to i8*
%7 = load i8*, i8** %2
%8 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %3, i64 0, i64 0
%9 = call i32 (i8*, %struct.__va_list_tag*, ...) bitcast (i32 (...)* @printv to i32 (i8*, %struct.__va_list_tag*, ...)*)(i8* %7, %struct.__va_list_tag* %8)
store i32 %9, i32* %4
%10 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %3, i64 0, i64 0
%11 = bitcast %struct.__va_list_tag* %10 to i8*
%12 = load i32, i32* %4
ret i32 %12
}

LLVM IR (-O2):
%struct.__va_list_tag = type { i32, i32, i8*, i8* }
define i32 @print(i8* %0, ...) {
%2 = alloca [1 x %struct.__va_list_tag]
%3 = bitcast [1 x %struct.__va_list_tag]* %2 to i8*
%4 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %2, i64 0, i64 0
%5 = call i32 (i8*, %struct.__va_list_tag*, ...) bitcast (i32 (...)* @printv to i32 (i8*, %struct.__va_list_tag*, ...)*)(i8* %0, %struct.__va_list_tag* %4)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int write(int, char *, int);
void writeToDeviceForRead(int fd, int reg) {
  char buf[1];
  buf[0] = reg;
  if (write(fd, buf, 1) != 1) {
    fprintf(stderr, "Can't write to device\n");
  }
}


x86 assembly (clang, -O0):
<writeToDeviceForRead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %al,-0x9(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x9(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
cmp    $0x1,%eax
je     1163 <writeToDeviceForRead+0x43>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
lea    0xea2(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeToDeviceForRead>:
push   %rax
mov    %sil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
cmp    $0x1,%eax
jne    113c <writeToDeviceForRead+0x1c>
pop    %rax
ret
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
lea    0xeb4(%rip),%rsi
pop    %rax
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"Can't write to device\0A\00"
define void @writeToDeviceForRead(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [1 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = trunc i32 %6 to i8
%8 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
store i8 %7, i8* %8
%9 = load i32, i32* %3
%10 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
%11 = call i32 @write(i32 %9, i8* %10, i32 1)
%12 = icmp ne i32 %11, 1
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %13, %2
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"Can't write to device\0A\00"
define void @writeToDeviceForRead(i32 %0, i32 %1) {
%3 = alloca [1 x i8]
%4 = getelementptr inbounds [1 x i8], [1 x i8]* %3, i64 0, i64 0
%5 = trunc i32 %1 to i8
store i8 %5, i8* %4
%6 = call i32 @write(i32 %0, i8* %4, i32 1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %8, %2
ret void
}
/* Variables and functions */
size_t strspn(char const *, char const *);
__attribute__((__weak__, __always___)) size_t
softboundcets_strspn(const char *s, const char *accept) {
  return strspn(s, accept);
}


x86 assembly (clang, -O0):
<softboundcets_strspn>:
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   1030 <strspn@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<softboundcets_strspn>:
jmp    1030 <strspn@plt>

LLVM IR (-O0):
define weak i64 @softboundcets_strspn(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i64 @strspn(i8* %5, i8* %6)
ret i64 %7
}

LLVM IR (-O2):
define weak i64 @softboundcets_strspn(i8* %0, i8* %1) {
%3 = tail call i64 @strspn(i8* %0, i8* %1)
ret i64 %3
}
int main(void) {
  char *s = "hello world";
  *s = 'H';
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x48,(%rax)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [12 x i8] c"hello world\00"
define i32 @main() {
%1 = alloca i8*
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
store i8 72, i8* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int syscall(int, char *, char *, char);
int caesarenc(char *src, char *dest, char key) {
  return syscall(314, src, dest, key);
}


x86 assembly (clang, -O0):
<caesarenc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x13a,%edi
movsbl -0x11(%rbp),%ecx
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<caesarenc>:
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x13a,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
define i32 @caesarenc(i8* %0, i8* %1, i8 signext %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8 %2, i8* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i8, i8* %6
%10 = call i32 @syscall(i32 314, i8* %7, i8* %8, i8 signext %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @caesarenc(i8* %0, i8* %1, i8 signext %2) {
%4 = tail call i32 @syscall(i32 314, i8* %0, i8* %1, i8 signext %2)
ret i32 %4
}
/* Variables and functions */
int close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ printf(char *, char *);
char *strerror(int /*<<< orphan*/);
int myClose(int fd) {
  int diditwork;
  if (fd >= 0) {
    diditwork = close(fd);
    if (diditwork < 0) {
      printf("failed to close: %s\n", strerror(errno));
    }
  } else {
    diditwork = -10;
  }
  return diditwork;
}


x86 assembly (clang, -O0):
<myClose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     117c <myClose+0x4c>
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1177 <myClose+0x47>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %rax,%rsi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
jmp    1183 <myClose+0x53>
movl   $0xfffffff6,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myClose>:
push   %rbx
test   %edi,%edi
js     115f <myClose+0x2f>
call   1040 <close@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1164 <myClose+0x34>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xeab(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
jmp    1164 <myClose+0x34>
mov    $0xfffffff6,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [21 x i8] c"failed to close: %s\0A\00"
@errno = global i32 0
define i32 @myClose(i32 %0) {
%2 = icmp sgt i32 %0, -1
br i1 %2, label %3, label %10
3: ; preds = %1
%4 = tail call i32 @close(i32 %0)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = load i32, i32* @errno
%8 = tail call i8* @strerror(i32 %7)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %10
10: ; preds = %1, %3, %6
%11 = phi i32 [ %4, %6 ], [ %4, %3 ], [ -10, %1 ]
ret i32 %11
}
/* Type definitions */
struct _Locale_codecvt {
  int dummy;
};
typedef int /*<<< orphan*/ mbstate_t;

/* Variables and functions */
size_t _WLocale_unshift(struct _Locale_codecvt *lcodecvt, mbstate_t *st,
                        char *buf, size_t n, char **next) {
  *next = buf;
  return 0;
}


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

x86 assembly (clang, -O2):
<_WLocale_unshift>:
mov    %rdx,(%r8)
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct._Locale_codecvt = type { i32 }
define i64 @_WLocale_unshift(%struct._Locale_codecvt* %0, i32* %1, i8* %2, i64 %3, i8** %4) {
%6 = alloca %struct._Locale_codecvt*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i8**
store %struct._Locale_codecvt* %0, %struct._Locale_codecvt** %6
store i32* %1, i32** %7
store i8* %2, i8** %8
store i64 %3, i64* %9
store i8** %4, i8*** %10
%11 = load i8*, i8** %8
%12 = load i8**, i8*** %10
store i8* %11, i8** %12
ret i64 0
}

LLVM IR (-O2):
%struct._Locale_codecvt = type { i32 }
define i64 @_WLocale_unshift(%struct._Locale_codecvt* nocapture readnone %0, i32* nocapture readnone %1, i8* %2, i64 %3, i8** nocapture writeonly %4) {
store i8* %2, i8** %4
ret i64 0
}
int test_imm_CCint16_reg(short val) {
  return ((val) & (-0xCC << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_CCint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffff34,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_CCint16_reg>:
test   $0xff34,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_CCint16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, -204
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_CCint16_reg(i16 signext %0) {
%2 = and i16 %0, -204
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void dog() { printf("dog\n"); }


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

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

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

LLVM IR (-O2):
@str = [4 x i8] c"dog\00"
define void @dog() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret void
}
void BIO_set_callback_arg(void) {}


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

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

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

LLVM IR (-O2):
define void @BIO_set_callback_arg() {
ret void
}
void ar2315_arch_init_irq(void) {}


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

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

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

LLVM IR (-O2):
define void @ar2315_arch_init_irq() {
ret void
}
/* Variables and functions */
int subtract_func(int, int, int, int, int /*<<< orphan*/);
int sub_func_for_scas(int src, int dest, int is_word) {
  return subtract_func(dest, src, is_word, 1, 0);
}


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

x86 assembly (clang, -O2):
<sub_func_for_scas>:
mov    %edi,%eax
mov    %esi,%edi
mov    %eax,%esi
mov    $0x1,%ecx
xor    %r8d,%r8d
jmp    1030 <subtract_func@plt>

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

LLVM IR (-O2):
define i32 @sub_func_for_scas(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @subtract_func(i32 %1, i32 %0, i32 %2, i32 1, i32 0)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ __NR_getdents64;
int errno;
int syscall(int /*<<< orphan*/, unsigned int, void *, unsigned int);
int __sulong_posix_getdents64(unsigned int fd, void *dirp, unsigned int count) {
  {
    int native_errno = errno;
    int result = syscall(__NR_getdents64, fd, dirp, count);
    if (result == (int)-1) {
      result = (int)(long)-errno;
    }
    errno = native_errno;
    return result;
  };
}


x86 assembly (clang, -O0):
<__sulong_posix_getdents64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2eaf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1030 <syscall@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    1163 <__sulong_posix_getdents64+0x53>
xor    %eax,%eax
mov    0x2e7c(%rip),%rcx
sub    (%rcx),%eax
cltq
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%ecx
mov    0x2e6b(%rip),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__sulong_posix_getdents64>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %edi,%esi
mov    0x2eb7(%rip),%rbx
mov    (%rbx),%ebp
mov    0x2eb6(%rip),%rax
mov    (%rax),%edi
call   1030 <syscall@plt>
xor    %ecx,%ecx
sub    (%rbx),%ecx
cmp    $0xffffffff,%eax
cmove  %ecx,%eax
mov    %ebp,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@errno = global i32 0
@__NR_getdents64 = global i32 0
define i32 @__sulong_posix_getdents64(i32 %0, i8* %1, i32 %2) {
%4 = load i32, i32* @errno
%5 = load i32, i32* @__NR_getdents64
%6 = tail call i32 @syscall(i32 %5, i32 %0, i8* %1, i32 %2)
%7 = icmp eq i32 %6, -1
%8 = load i32, i32* @errno
%9 = sub nsw i32 0, %8
%10 = select i1 %7, i32 %9, i32 %6
store i32 %4, i32* @errno
ret i32 %10
}
void glDisableClientState(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glDisableClientState() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fclose(int /*<<< orphan*/ *);
int fsafeclose(FILE *f) {
  if (f) {
    return fclose(f);
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<fsafeclose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1138 <fsafeclose+0x28>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    %eax,-0x4(%rbp)
jmp    113f <fsafeclose+0x2f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @fsafeclose(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @fclose(i32* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 0, %1 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ foo();
main() {
  foo();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @foo()
ret i32 0
}
double update_ratio(double new_ratio) {
  static double ratio = 1.0;
  double old_ratio = ratio;
  ratio = new_ratio;
  return old_ratio;
}


x86 assembly (clang, -O0):
<update_ratio>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0x2f0f(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,0x2efd(%rip)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_ratio>:
movsd  0x2f18(%rip),%xmm1
movsd  %xmm0,0x2f10(%rip)
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
@update_ratio.ratio = internal global double 1.000000e+00
define double @update_ratio(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* @update_ratio.ratio
store double %4, double* %3
%5 = load double, double* %2
store double %5, double* @update_ratio.ratio
%6 = load double, double* %3
ret double %6
}

LLVM IR (-O2):
@update_ratio.ratio = internal unnamed_addr global double 1.000000e+00
define double @update_ratio(double %0) {
%2 = load double, double* @update_ratio.ratio
store double %0, double* @update_ratio.ratio
ret double %2
}
void view_displayArray(void) {}


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

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

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

LLVM IR (-O2):
define void @view_displayArray() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cdecl_func__opterr(int /*<<< orphan*/);
int /*<<< orphan*/ opterr;
void cdecl_expr__opterr() { cdecl_func__opterr(opterr); }


x86 assembly (clang, -O0):
<cdecl_expr__opterr>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <cdecl_func__opterr@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdecl_expr__opterr>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <cdecl_func__opterr@plt>

LLVM IR (-O0):
@opterr = global i32 0
define void @cdecl_expr__opterr() {
%1 = load i32, i32* @opterr
%2 = call i32 @cdecl_func__opterr(i32 %1)
ret void
}

LLVM IR (-O2):
@opterr = global i32 0
define void @cdecl_expr__opterr() {
%1 = load i32, i32* @opterr
%2 = tail call i32 @cdecl_func__opterr(i32 %1)
ret void
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ __NR_readlinkat;
int syscall(int /*<<< orphan*/, int, char const *, char *, size_t);
ssize_t xreadlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz) {
  ssize_t ret = syscall(__NR_readlinkat, dirfd, pathname, buf, bufsiz);
  if (ret == -1) {
    ;
  } else {
    buf[ret] = '\0';
  }
  return ret;
}


x86 assembly (clang, -O0):
<xreadlinkat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
call   1030 <syscall@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    1156 <xreadlinkat+0x46>
jmp    1162 <xreadlinkat+0x52>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xreadlinkat>:
push   %rbx
mov    %rcx,%r8
mov    %rdx,%rbx
mov    %rsi,%rdx
mov    %edi,%esi
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rcx
call   1030 <syscall@plt>
cmp    $0xffffffff,%eax
je     1139 <xreadlinkat+0x29>
movslq %eax,%rcx
movb   $0x0,(%rbx,%rcx,1)
pop    %rbx
ret

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

LLVM IR (-O2):
@__NR_readlinkat = global i32 0
define i32 @xreadlinkat(i32 %0, i8* %1, i8* %2, i64 %3) {
%5 = load i32, i32* @__NR_readlinkat
%6 = tail call i32 @syscall(i32 %5, i32 %0, i8* %1, i8* %2, i64 %3)
%7 = icmp eq i32 %6, -1
br i1 %7, label %11, label %8
8: ; preds = %4
%9 = sext i32 %6 to i64
%10 = getelementptr inbounds i8, i8* %2, i64 %9
store i8 0, i8* %10
br label %11
11: ; preds = %4, %8
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ ciab_init();
int /*<<< orphan*/ mt_end();
int /*<<< orphan*/ mt_remove_cia();
void mod_stop(void) {
  mt_end();
  mt_remove_cia();
  ciab_init();
}


x86 assembly (clang, -O0):
<mod_stop>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <mt_end@plt>
mov    $0x0,%al
call   1050 <mt_remove_cia@plt>
mov    $0x0,%al
call   1040 <ciab_init@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod_stop>:
push   %rax
xor    %eax,%eax
call   1030 <mt_end@plt>
xor    %eax,%eax
call   1050 <mt_remove_cia@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <ciab_init@plt>

LLVM IR (-O0):
define void @mod_stop() {
%1 = call i32 (...) @mt_end()
%2 = call i32 (...) @mt_remove_cia()
%3 = call i32 (...) @ciab_init()
ret void
}

LLVM IR (-O2):
define void @mod_stop() {
%1 = tail call i32 (...) @mt_end()
%2 = tail call i32 (...) @mt_remove_cia()
%3 = tail call i32 (...) @ciab_init()
ret void
}
int higher_nums(int num) {
  if (num >= 10000000) {
    if (num >= 1000000000)
      return (10);
    if (num >= 100000000)
      return (9);
    return (8);
  }
  if (num >= 1000000)
    return (7);
  return (6);
}


x86 assembly (clang, -O0):
<higher_nums>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x989680,-0x8(%rbp)
jl     1152 <higher_nums+0x52>
cmpl   $0x3b9aca00,-0x8(%rbp)
jl     112d <higher_nums+0x2d>
movl   $0xa,-0x4(%rbp)
jmp    1172 <higher_nums+0x72>
cmpl   $0x5f5e100,-0x8(%rbp)
jl     1146 <higher_nums+0x46>
movl   $0x9,-0x4(%rbp)
jmp    1172 <higher_nums+0x72>
movl   $0x8,-0x4(%rbp)
jmp    1172 <higher_nums+0x72>
cmpl   $0xf4240,-0x8(%rbp)
jl     116b <higher_nums+0x6b>
movl   $0x7,-0x4(%rbp)
jmp    1172 <higher_nums+0x72>
movl   $0x6,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<higher_nums>:
cmp    $0x989680,%edi
jl     1124 <higher_nums+0x24>
mov    $0xa,%eax
cmp    $0x3b9ac9ff,%edi
ja     1132 <higher_nums+0x32>
xor    %eax,%eax
cmp    $0x5f5e100,%edi
setae  %al
or     $0x8,%eax
ret
xor    %eax,%eax
cmp    $0xf4240,%edi
setge  %al
or     $0x6,%eax
ret

LLVM IR (-O0):
define i32 @higher_nums(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 10000000
br i1 %5, label %6, label %15
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sge i32 %7, 1000000000
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 10, i32* %2
br label %20
10: ; preds = %6
%11 = load i32, i32* %3
%12 = icmp sge i32 %11, 100000000
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 9, i32* %2
br label %20
14: ; preds = %10
store i32 8, i32* %2
br label %20
15: ; preds = %1
%16 = load i32, i32* %3
%17 = icmp sge i32 %16, 1000000
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 7, i32* %2
br label %20
19: ; preds = %15
store i32 6, i32* %2
br label %20
20: ; preds = %19, %18, %14, %13, %9
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @higher_nums(i32 %0) {
%2 = icmp sgt i32 %0, 9999999
br i1 %2, label %3, label %8
3: ; preds = %1
%4 = icmp ugt i32 %0, 999999999
br i1 %4, label %11, label %5
5: ; preds = %3
%6 = icmp ugt i32 %0, 99999999
%7 = select i1 %6, i32 9, i32 8
br label %11
8: ; preds = %1
%9 = icmp sgt i32 %0, 999999
%10 = select i1 %9, i32 7, i32 6
br label %11
11: ; preds = %8, %5, %3
%12 = phi i32 [ 10, %3 ], [ %7, %5 ], [ %10, %8 ]
ret i32 %12
}
/* Variables and functions */
void *strdup(void *);
void *hashmap_string_duplicate(void *key) { return strdup(key); }


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

x86 assembly (clang, -O2):
<hashmap_string_duplicate>:
jmp    1030 <strdup@plt>

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

LLVM IR (-O2):
define noalias i8* @hashmap_string_duplicate(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
ret i8* %2
}