xunge/DecIR huggingface dataset:
/* Variables and functions */
unsigned long long strtoull(char const *, char **, unsigned int);
unsigned long long asc2ullong(const char *s, unsigned base, int ignore_errors) {
  char *endp;
  unsigned long long rc = strtoull(s, &endp, base);
  if (*endp && !ignore_errors) {
    return -1;
  }
  return rc;
}


x86 assembly (clang, -O0):
<asc2ullong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    -0x20(%rbp),%rsi
call   1030 <strtoull@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115d <asc2ullong+0x4d>
cmpl   $0x0,-0x18(%rbp)
jne    115d <asc2ullong+0x4d>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1165 <asc2ullong+0x55>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asc2ullong>:
push   %rbx
sub    $0x10,%rsp
mov    %edx,%ebx
mov    %esi,%edx
lea    0x8(%rsp),%rsi
call   1030 <strtoull@plt>
mov    0x8(%rsp),%rcx
xor    %edx,%edx
cmp    (%rcx),%dl
sbb    %rcx,%rcx
or     %rax,%rcx
test   %ebx,%ebx
cmove  %rcx,%rax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @asc2ullong(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = call i64 @strtoull(i8* %0, i8** %4, i32 %1)
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
%10 = icmp ne i32 %2, 0
%11 = or i1 %10, %9
%12 = select i1 %11, i64 %6, i64 -1
ret i64 %12
}
void gtk_button_get_focus_on_click() {}


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

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

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

LLVM IR (-O2):
define void @gtk_button_get_focus_on_click() {
ret void
}
/* Type definitions */
struct m_config {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ bstr(char const *);
int m_config_set_option(struct m_config *, int /*<<< orphan*/,
                        int /*<<< orphan*/, int);
int m_config_set_option0(struct m_config *config, const char *name,
                         const char *param, bool ambiguous) {
  return m_config_set_option(config, bstr(name), bstr(param), ambiguous);
}


x86 assembly (clang, -O0):
<m_config_set_option0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <bstr@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <bstr@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    %eax,%edx
mov    -0x1c(%rbp),%ecx
call   1040 <m_config_set_option@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_config_set_option0>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %rdi,%r15
mov    %rsi,%rdi
call   1030 <bstr@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <bstr@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %eax,%edx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <m_config_set_option@plt>

LLVM IR (-O0):
%struct.m_config = type { i32 }
define i32 @m_config_set_option0(%struct.m_config* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca %struct.m_config*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store %struct.m_config* %0, %struct.m_config** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load %struct.m_config*, %struct.m_config** %5
%10 = load i8*, i8** %6
%11 = call i32 @bstr(i8* %10)
%12 = load i8*, i8** %7
%13 = call i32 @bstr(i8* %12)
%14 = load i32, i32* %8
%15 = call i32 @m_config_set_option(%struct.m_config* %9, i32 %11, i32 %13, i32 %14)
ret i32 %15
}

LLVM IR (-O2):
%struct.m_config = type { i32 }
define i32 @m_config_set_option0(%struct.m_config* %0, i8* %1, i8* %2, i32 %3) {
%5 = tail call i32 @bstr(i8* %1)
%6 = tail call i32 @bstr(i8* %2)
%7 = tail call i32 @m_config_set_option(%struct.m_config* %0, i32 %5, i32 %6, i32 %3)
ret i32 %7
}
/* Variables and functions */
int getprimer(int);
int /*<<< orphan*/ printf(char *, int);
int main() { printf("%d\n", getprimer(10000)); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2710,%edi
call   1040 <getprimer@plt>
mov    %eax,%esi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @getprimer(i32 10000)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ NG_Create_NG_TestSuite();
void EXTN_Create_Suites(void) { NG_Create_NG_TestSuite(); }


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

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

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

LLVM IR (-O2):
define void @EXTN_Create_Suites() {
%1 = tail call i32 (...) @NG_Create_NG_TestSuite()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int);
void cpybrd(char a[64], char b[64]) { memcpy(a, b, 64); }


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

x86 assembly (clang, -O2):
<cpybrd>:
mov    $0x40,%edx
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @cpybrd(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 i32 @memcpy(i8* %5, i8* %6, i32 64)
ret void
}

LLVM IR (-O2):
define void @cpybrd(i8* %0, i8* %1) {
%3 = tail call i32 @memcpy(i8* %0, i8* %1, i32 64)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(void) {
  int comeco, fim, duracao;
  scanf("%d %d", &comeco, &fim);
  if (comeco < fim) {
    duracao = fim - comeco;
  } else {
    duracao = 24 - comeco + fim;
  }
  printf("O JOGO DUROU %d HORA(S)\n", duracao);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115d <main+0x3d>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    116b <main+0x4b>
mov    $0x18,%eax
sub    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%eax
mov    %esi,%ecx
sub    %eax,%ecx
add    $0x18,%ecx
sub    %eax,%esi
cmovle %ecx,%esi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [25 x i8] c"O JOGO DUROU %d HORA(S)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, %6
%9 = select i1 %8, i32 0, i32 24
%10 = sub i32 %7, %6
%11 = add i32 %10, %9
%12 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %11)
ret i32 0
}
unsigned char padding(void) { return 0xff; }


x86 assembly (clang, -O0):
<padding>:
push   %rbp
mov    %rsp,%rbp
mov    $0xff,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<padding>:
mov    $0xff,%al
ret

LLVM IR (-O0):
define zeroext i8 @padding() {
ret i8 -1
}

LLVM IR (-O2):
define zeroext i8 @padding() {
ret i8 -1
}
void wbinvd(void) { asm volatile("wbinvd"); }


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

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

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

LLVM IR (-O2):
define void @wbinvd() {
tail call void asm sideeffect "wbinvd", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
void PKCS8_PRIV_KEY_INFO_free(void) {}


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

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

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

LLVM IR (-O2):
define void @PKCS8_PRIV_KEY_INFO_free() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_array_max();
int /*<<< orphan*/ test_array_min();
int /*<<< orphan*/ test_array_reverse();
int /*<<< orphan*/ test_array_shuffle();
int /*<<< orphan*/ test_array_size();
int /*<<< orphan*/ test_array_sum();
void test_array() {
  test_array_size();
  test_array_min();
  test_array_max();
  test_array_sum();
  test_array_reverse();
  test_array_shuffle();
}


x86 assembly (clang, -O0):
<test_array>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1070 <test_array_size@plt>
mov    $0x0,%al
call   1040 <test_array_min@plt>
mov    $0x0,%al
call   1050 <test_array_max@plt>
mov    $0x0,%al
call   1080 <test_array_sum@plt>
mov    $0x0,%al
call   1030 <test_array_reverse@plt>
mov    $0x0,%al
call   1060 <test_array_shuffle@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_array>:
push   %rax
xor    %eax,%eax
call   1070 <test_array_size@plt>
xor    %eax,%eax
call   1040 <test_array_min@plt>
xor    %eax,%eax
call   1050 <test_array_max@plt>
xor    %eax,%eax
call   1080 <test_array_sum@plt>
xor    %eax,%eax
call   1030 <test_array_reverse@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <test_array_shuffle@plt>

LLVM IR (-O0):
define void @test_array() {
%1 = call i32 (...) @test_array_size()
%2 = call i32 (...) @test_array_min()
%3 = call i32 (...) @test_array_max()
%4 = call i32 (...) @test_array_sum()
%5 = call i32 (...) @test_array_reverse()
%6 = call i32 (...) @test_array_shuffle()
ret void
}

LLVM IR (-O2):
define void @test_array() {
%1 = tail call i32 (...) @test_array_size()
%2 = tail call i32 (...) @test_array_min()
%3 = tail call i32 (...) @test_array_max()
%4 = tail call i32 (...) @test_array_sum()
%5 = tail call i32 (...) @test_array_reverse()
%6 = tail call i32 (...) @test_array_shuffle()
ret void
}
unsigned int add_one(unsigned int i) { return i + 1; }


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

x86 assembly (clang, -O2):
<add_one>:
lea    0x1(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @add_one(i32 %0) {
%2 = add i32 %0, 1
ret i32 %2
}
/* Type definitions */
typedef unsigned char uint16_t;

/* Variables and functions */
uint16_t get2BE(const unsigned char *buf) {
  uint16_t val;
  val = (buf[0] << 8) | buf[1];
  return val;
}


x86 assembly (clang, -O0):
<get2BE>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
or     %ecx,%eax
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get2BE>:
mov    0x1(%rdi),%al
ret

LLVM IR (-O0):
define zeroext i8 @get2BE(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl i32 %7, 8
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = or i32 %8, %12
%14 = trunc i32 %13 to i8
store i8 %14, i8* %3
%15 = load i8, i8* %3
ret i8 %15
}

LLVM IR (-O2):
define zeroext i8 @get2BE(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %2
ret i8 %3
}
/* Variables and functions */
#define SIGINT 129
#define SIGTERM 128
int badsignal(int sig) {
  switch (sig) {
  case SIGINT:
    return 0;
  case SIGTERM:
    return 0;
  default:
    return 1;
  }
}


x86 assembly (clang, -O0):
<badsignal>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x80,%eax
je     113c <badsignal+0x3c>
jmp    111d <badsignal+0x1d>
mov    -0xc(%rbp),%eax
sub    $0x81,%eax
jne    1148 <badsignal+0x48>
jmp    1130 <badsignal+0x30>
movl   $0x0,-0x4(%rbp)
jmp    114f <badsignal+0x4f>
movl   $0x0,-0x4(%rbp)
jmp    114f <badsignal+0x4f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<badsignal>:
and    $0xfffffffe,%edi
xor    %eax,%eax
cmp    $0x80,%edi
setne  %al
ret

LLVM IR (-O0):
define i32 @badsignal(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 129, label %5
i32 128, label %6
]
5: ; preds = %1
store i32 0, i32* %2
br label %8
6: ; preds = %1
store i32 0, i32* %2
br label %8
7: ; preds = %1
store i32 1, i32* %2
br label %8
8: ; preds = %7, %6, %5
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @badsignal(i32 %0) {
%2 = and i32 %0, -2
%3 = icmp ne i32 %2, 128
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
void test_vorr_s32x2(int32_t *__restrict__ dest, int32_t *a, int32_t *b) {
  int i;
  for (i = 0; i < 2; i++) {
    dest[i] = a[i] | b[i];
  }
}


x86 assembly (clang, -O0):
<test_vorr_s32x2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jge    1150 <test_vorr_s32x2+0x50>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
or     (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1117 <test_vorr_s32x2+0x17>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_vorr_s32x2>:
mov    (%rdx),%eax
or     (%rsi),%eax
mov    %eax,(%rdi)
mov    0x4(%rdx),%eax
or     0x4(%rsi),%eax
mov    %eax,0x4(%rdi)
ret

LLVM IR (-O0):
define void @test_vorr_s32x2(i32* noalias %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
store i32 0, i32* %7
br label %8
8: ; preds = %27, %3
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 2
br i1 %10, label %11, label %30
11: ; preds = %8
%12 = load i32*, i32** %5
%13 = load i32, i32* %7
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = load i32*, i32** %6
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
%21 = load i32, i32* %20
%22 = or i32 %16, %21
%23 = load i32*, i32** %4
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 %22, i32* %26
br label %27
27: ; preds = %11
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 1
store i32 %29, i32* %7
br label %8
30: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @test_vorr_s32x2(i32* noalias nocapture writeonly %0, i32* nocapture %1, i32* nocapture %2) {
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = or i32 %5, %4
store i32 %6, i32* %0
%7 = getelementptr inbounds i32, i32* %1, i64 1
%8 = load i32, i32* %7
%9 = getelementptr inbounds i32, i32* %2, i64 1
%10 = load i32, i32* %9
%11 = or i32 %10, %8
%12 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %11, i32* %12
ret void
}
/* Variables and functions */
char tolower(int /*<<< orphan*/);
void str_tolower(const char *from, char *to) {
  if (from == NULL || to == NULL)
    return;
  while ((*to++ = tolower(*from++)))
    ;
}


x86 assembly (clang, -O0):
<str_tolower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1136 <str_tolower+0x26>
cmpq   $0x0,-0x10(%rbp)
jne    113b <str_tolower+0x2b>
jmp    1175 <str_tolower+0x65>
jmp    1140 <str_tolower+0x30>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    -0x10(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     1175 <str_tolower+0x65>
jmp    1140 <str_tolower+0x30>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_tolower>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1146 <str_tolower+0x36>
mov    %rsi,%r14
test   %rsi,%rsi
je     1146 <str_tolower+0x36>
mov    %rdi,%r15
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%edi
call   1030 <tolower@plt>
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
test   %al,%al
jne    1130 <str_tolower+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @str_tolower(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 = icmp eq i8* %5, null
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %11
10: ; preds = %7, %2
br label %22
11: ; preds = %7
br label %12
12: ; preds = %21, %11
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %3
%15 = load i8, i8* %13
%16 = sext i8 %15 to i32
%17 = call signext i8 @tolower(i32 %16)
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %4
store i8 %17, i8* %18
%20 = icmp ne i8 %17, 0
br i1 %20, label %21, label %22
21: ; preds = %12
br label %12
22: ; preds = %10, %12
ret void
}

LLVM IR (-O2):
define void @str_tolower(i8* %0, i8* writeonly %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i8* %1, null
%5 = or i1 %3, %4
br i1 %5, label %15, label %6
6: ; preds = %2, %6
%7 = phi i8* [ %9, %6 ], [ %0, %2 ]
%8 = phi i8* [ %13, %6 ], [ %1, %2 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = load i8, i8* %7
%11 = sext i8 %10 to i32
%12 = tail call signext i8 @tolower(i32 %11)
%13 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %12, i8* %8
%14 = icmp eq i8 %12, 0
br i1 %14, label %15, label %6
15: ; preds = %6, %2
ret void
}
volatile void vvoid_fn2(void) {}


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

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

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

LLVM IR (-O2):
define void @vvoid_fn2() {
ret void
}
/* Variables and functions */
long pathconf(char *, int);
__attribute__((__weak__, __always___)) long softboundmpx_pathconf(char *path,
                                                                  int name) {
  return pathconf(path, name);
}


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

x86 assembly (clang, -O2):
<softboundmpx_pathconf>:
jmp    1030 <pathconf@plt>

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

LLVM IR (-O2):
define weak i64 @softboundmpx_pathconf(i8* %0, i32 %1) {
%3 = tail call i64 @pathconf(i8* %0, i32 %1)
ret i64 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
struct timeval {
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
uint64_t __now() {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return ((uint64_t)tv.tv_sec);
}


x86 assembly (clang, -O0):
<__now>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__now>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i64 }
define i32 @__now() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i64, i64* %3
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
%struct.timeval = type { i64 }
define i32 @__now() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isgraph(int);
void t_isgraph_0x66() {
  Assert_real((isgraph(102)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isgraph.c",
              515, ("isgraph should be 1 for f"));
}


x86 assembly (clang, -O0):
<t_isgraph_0x66>:
push   %rbp
mov    %rsp,%rbp
mov    $0x66,%edi
call   1040 <isgraph@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x203,%edx
lea    0xf65(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isgraph_0x66>:
push   %rax
mov    $0x66,%edi
call   1040 <isgraph@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x203,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [26 x i8] c"isgraph should be 1 for f\00"
define void @t_isgraph_0x66() {
%1 = call i32 @isgraph(i32 102)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 515, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [26 x i8] c"isgraph should be 1 for f\00"
define void @t_isgraph_0x66() {
%1 = tail call i32 @isgraph(i32 102)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 515, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
void print_usage(char *prog) {
  printf(
      "USAGE: %s <command> <flags?> <args?>\n'%s help' for more information\n",
      prog, prog);
}


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

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

LLVM IR (-O0):
@.str = [69 x i8] c"USAGE: %s <command> <flags?> <args?>\0A'%s help' for more information\0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [69 x i8] c"USAGE: %s <command> <flags?> <args?>\0A'%s help' for more information\0A\00"
define void @print_usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %0)
ret void
}
int test_imm_A2uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0xA2 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_A2uint64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $0x10,%rdx
and    $0xa2,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_A2uint64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = and i64 %4, 162
%6 = icmp ne i64 %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_A2uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 10616832
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ asm_syscall(int, int /*<<< orphan*/, int, int);
off_t __attribute__((section("libgloss_epiphany")))
_lseek(int fildes, off_t offset, int whence) {
  return asm_syscall(fildes, offset, whence, 0x405);
}


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

x86 assembly (clang, -O2):
<_lseek>:
mov    $0x405,%ecx
jmp    1030 <asm_syscall@plt>

LLVM IR (-O0):
define i32 @_lseek(i32 %0, i32 %1, i32 %2) section "libgloss_epiphany" {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @asm_syscall(i32 %7, i32 %8, i32 %9, i32 1029)
ret i32 %10
}

LLVM IR (-O2):
define i32 @_lseek(i32 %0, i32 %1, i32 %2) section "libgloss_epiphany" {
%4 = tail call i32 @asm_syscall(i32 %0, i32 %1, i32 %2, i32 1029)
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ execl(char *, char *, char *, char const *, char *);
int /*<<< orphan*/ fork();
extern pid_t execCommand(const char *command) {
  pid_t pid;
  if ((pid = fork()) == 0) {
    execl("/bin/sh", "sh", "-c", command, (char *)0);
  }
  return pid;
}


x86 assembly (clang, -O0):
<execCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <fork@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jne    1162 <execCommand+0x42>
mov    -0x8(%rbp),%rcx
lea    0xeb6(%rip),%rdi
lea    0xeb4(%rip),%rsi
lea    0xeb0(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <execl@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execCommand>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <fork@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    1153 <execCommand+0x33>
lea    0xec6(%rip),%rdi
lea    0xec4(%rip),%rsi
lea    0xec0(%rip),%rdx
mov    %rbx,%rcx
xor    %r8d,%r8d
call   1030 <execl@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"/bin/sh\00"
@.str.1 = [3 x i8] c"sh\00"
@.str.2 = [3 x i8] c"-c\00"
define i32 @execCommand(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = call i32 (...) @fork()
store i32 %4, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %7, i8* null)
br label %9
9: ; preds = %6, %1
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
@.str = [8 x i8] c"/bin/sh\00"
@.str.1 = [3 x i8] c"sh\00"
@.str.2 = [3 x i8] c"-c\00"
define i32 @execCommand(i8* %0) {
%2 = tail call i32 (...) @fork()
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* null)
br label %6
6: ; preds = %4, %1
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ sysctlbyname(char *, int /*<<< orphan*/ *, size_t *,
                                int /*<<< orphan*/ *, int /*<<< orphan*/);
void print_cpuinfo(char *name, int64_t *buffer, size_t *size) {
  sysctlbyname(name, buffer, size, NULL, 0);
  printf("%s: %lld\n", name, *buffer);
}


x86 assembly (clang, -O0):
<print_cpuinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
xor    %r8d,%r8d
call   1040 <sysctlbyname@plt>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_cpuinfo>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <sysctlbyname@plt>
mov    (%rbx),%edx
lea    0xec3(%rip),%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"%s: %lld\0A\00"
define void @print_cpuinfo(i8* %0, i32* %1, i64* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i64*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i64* %2, i64** %6
%7 = load i8*, i8** %4
%8 = load i32*, i32** %5
%9 = load i64*, i64** %6
%10 = call i32 @sysctlbyname(i8* %7, i32* %8, i64* %9, i32* null, i32 0)
%11 = load i8*, i8** %4
%12 = load i32*, i32** %5
%13 = load i32, i32* %12
%14 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %11, i32 %13)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"%s: %lld\0A\00"
define void @print_cpuinfo(i8* %0, i32* %1, i64* %2) {
%4 = tail call i32 @sysctlbyname(i8* %0, i32* %1, i64* %2, i32* null, i32 0)
%5 = load i32, i32* %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fill_table();
int /*<<< orphan*/ simulate_thread_done();
int /*<<< orphan*/ simulate_thread_main();
main() {
  fill_table();
  simulate_thread_main();
  simulate_thread_done();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @fill_table()
%2 = tail call i32 (...) @simulate_thread_main()
%3 = tail call i32 (...) @simulate_thread_done()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Yup, for a basic test that's a basic test! Hello World! \n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [58 x i8] c"Yup, for a basic test that's a basic test! Hello World! \0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [57 x i8] c"Yup, for a basic test that's a basic test! Hello World! \00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int nvClampi(int i, int min, int max) {
  return (i < min) ? min : ((i > max) ? max : i);
}


x86 assembly (clang, -O0):
<nvClampi>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1124 <nvClampi+0x24>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1147 <nvClampi+0x47>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    113b <nvClampi+0x3b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1141 <nvClampi+0x41>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nvClampi>:
mov    %edx,%eax
cmp    %edx,%edi
cmovle %edi,%eax
cmp    %esi,%edi
cmovl  %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @nvClampi(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
%5 = icmp sgt i32 %0, %2
%6 = select i1 %5, i32 %2, i32 %0
%7 = select i1 %4, i32 %1, i32 %6
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ lv;
typedef int /*<<< orphan*/ int16_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fread(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ ntohs(int /*<<< orphan*/);
int read_be_int16(FILE *fp, int16_t *ptr) {
  int16_t lv;
  if (fread(&lv, sizeof(lv), 1, fp) != 1) {
    return 1;
  }
  *ptr = ntohs(lv);
  return 0;
}


x86 assembly (clang, -O0):
<read_be_int16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
lea    -0x1c(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x1,%eax
je     115c <read_be_int16+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    1173 <read_be_int16+0x53>
mov    -0x1c(%rbp),%edi
call   1040 <ntohs@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_be_int16>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%rcx
lea    0x4(%rsp),%rdi
mov    $0x1,%ebp
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x1,%eax
jne    1154 <read_be_int16+0x34>
mov    0x4(%rsp),%edi
call   1040 <ntohs@plt>
mov    %eax,(%rbx)
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @read_be_int16(i32* nocapture %0, i32* nocapture writeonly %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @fread(i32* %3, i32 4, i32 1, i32* %0)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %3
%9 = tail call i32 @ntohs(i32 %8)
store i32 %9, i32* %1
br label %10
10: ; preds = %2, %7
%11 = phi i32 [ 0, %7 ], [ 1, %2 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void *malloc(size_t);
void *ss_malloc(size_t size) {
  void *tmp = malloc(size);
  if (tmp == NULL)
    exit(EXIT_FAILURE);
  return tmp;
}


x86 assembly (clang, -O0):
<ss_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1152 <ss_malloc+0x32>
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ss_malloc>:
push   %rax
call   1030 <malloc@plt>
test   %rax,%rax
je     112d <ss_malloc+0xd>
pop    %rcx
ret
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define i8* @ss_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @exit(i32 %9)
unreachable
11: ; preds = %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define noalias i8* @ss_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = load i32, i32* @EXIT_FAILURE
%6 = tail call i32 @exit(i32 %5)
unreachable
7: ; preds = %1
ret i8* %2
}
/* Type definitions */
struct b6_tree {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ b6_tree_root(struct b6_tree const *);
int b6_tree_empty(const struct b6_tree *tree) { return !b6_tree_root(tree); }


x86 assembly (clang, -O0):
<b6_tree_empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <b6_tree_root@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<b6_tree_empty>:
push   %rax
call   1030 <b6_tree_root@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.b6_tree = type { i32 }
define i32 @b6_tree_empty(%struct.b6_tree* %0) {
%2 = alloca %struct.b6_tree*
store %struct.b6_tree* %0, %struct.b6_tree** %2
%3 = load %struct.b6_tree*, %struct.b6_tree** %2
%4 = call i32 @b6_tree_root(%struct.b6_tree* %3)
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
%struct.b6_tree = type { i32 }
define i32 @b6_tree_empty(%struct.b6_tree* %0) {
%2 = tail call i32 @b6_tree_root(%struct.b6_tree* %0)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
int tc_format_ms_supported(int format) {
  return (format == 0x55 || format == 0x2000 || format == 0x1);
}


x86 assembly (clang, -O0):
<tc_format_ms_supported>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x55,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1132 <tc_format_ms_supported+0x32>
mov    $0x1,%al
cmpl   $0x2000,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1132 <tc_format_ms_supported+0x32>
cmpl   $0x1,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tc_format_ms_supported>:
mov    $0x1,%eax
cmp    $0x55,%edi
je     1112 <tc_format_ms_supported+0x12>
cmp    $0x2000,%edi
jne    1113 <tc_format_ms_supported+0x13>
ret
xor    %eax,%eax
cmp    $0x1,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @tc_format_ms_supported(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 85
br i1 %4, label %11, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 8192
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 1
br label %11
11: ; preds = %8, %5, %1
%12 = phi i1 [ true, %5 ], [ true, %1 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @tc_format_ms_supported(i32 %0) {
switch i32 %0, label %2 [
i32 8192, label %5
i32 85, label %5
]
2: ; preds = %1
%3 = icmp eq i32 %0, 1
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ]
ret i32 %6
}
/* Variables and functions */
int bar(int);
int /*<<< orphan*/ baz(int);
void foo(int y) {
  int a;
  if (y == 6)
    a = bar(7) + 6;
  else
    a = bar(7) + 6;
  baz(a);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x6,-0x4(%rbp)
jne    114a <foo+0x2a>
mov    $0x7,%edi
call   1040 <bar@plt>
add    $0x6,%eax
mov    %eax,-0x8(%rbp)
jmp    115a <foo+0x3a>
mov    $0x7,%edi
call   1040 <bar@plt>
add    $0x6,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <baz@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
mov    $0x7,%edi
call   1040 <bar@plt>
lea    0x6(%rax),%edi
pop    %rax
jmp    1030 <baz@plt>

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

LLVM IR (-O2):
define void @foo(i32 %0) {
%2 = tail call i32 @bar(i32 7)
%3 = add nsw i32 %2, 6
%4 = tail call i32 @baz(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_use_and_exit() {
  fprintf(stderr, "Usage:  prj5-client host port\n\n");
  fprintf(stderr, "   example ./prj5-client 127.0.0.1 4000\n\n");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<print_use_and_exit>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
lea    0xed7(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<print_use_and_exit>:
push   %rbx
mov    0x2eb8(%rip),%rbx
mov    (%rbx),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xee1(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"Usage: prj5-client host port\0A\0A\00"
@.str.1 = [42 x i8] c" example ./prj5-client 127.0.0.1 4000\0A\0A\00"
@EXIT_FAILURE = global i32 0
define void @print_use_and_exit() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @EXIT_FAILURE
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"Usage: prj5-client host port\0A\0A\00"
@.str.1 = [42 x i8] c" example ./prj5-client 127.0.0.1 4000\0A\0A\00"
@EXIT_FAILURE = global i32 0
define void @print_use_and_exit() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @EXIT_FAILURE
%6 = tail call i32 @exit(i32 %5)
unreachable
}