xunge/DecIR huggingface dataset:
/* Variables and functions */
char *getenv(char *);
int /*<<< orphan*/ printf(char *, char *);
void show_invite() {
  char *username = getenv("USER");
  printf("%s@sh07 > ", username);
}


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

x86 assembly (clang, -O2):
<show_invite>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <getenv@plt>
lea    0xed1(%rip),%rdi
mov    %rax,%rsi
pop    %rax
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"USER\00"
@.str.1 = [11 x i8] c"%s@sh07 > \00"
define void @show_invite() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bwputs(char *);
void first(void) {
  bwputs("In user mode\n");
  while (1)
    ;
  return;
}


x86 assembly (clang, -O0):
<first>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <bwputs@plt>
jmp    1120 <first+0x10>

x86 assembly (clang, -O2):
<first>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <bwputs@plt>
nopl   (%rax)
jmp    1120 <first+0x10>

LLVM IR (-O0):
@.str = [14 x i8] c"In user mode\0A\00"
define void @first() {
%1 = call i32 @bwputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
@.str = [14 x i8] c"In user mode\0A\00"
define void @first() {
%1 = tail call i32 @bwputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ _log(int /*<<< orphan*/);
int /*<<< orphan*/ bformat(char *, char const *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *);
void block_temporary(const char *message) {
  printf("E451 %s (#4.3.0)\n", message);
  _log(bformat("temporary failure: %s", message));
  exit(0);
}


x86 assembly (clang, -O0):
<block_temporary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xeab(%rip),%rdi
call   1050 <bformat@plt>
mov    %eax,%edi
call   1030 <_log@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<block_temporary>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    0xeb8(%rip),%rdi
mov    %rbx,%rsi
call   1050 <bformat@plt>
mov    %eax,%edi
call   1030 <_log@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"E451 %s (.3.0)\0A\00"
@.str.1 = [22 x i8] c"temporary failure: %s\00"
define void @block_temporary(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @bformat(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = call i32 @_log(i32 %6)
%8 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [18 x i8] c"E451 %s (.3.0)\0A\00"
@.str.1 = [22 x i8] c"temporary failure: %s\00"
define void @block_temporary(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @bformat(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i32 @_log(i32 %3)
%5 = tail call i32 @exit(i32 0)
unreachable
}
void g_utf8_get_char_validated() {}


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

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

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

LLVM IR (-O2):
define void @g_utf8_get_char_validated() {
ret void
}
/* Variables and functions */
char getchar();
int /*<<< orphan*/ putchar(char);
int main() {
  char ch;
  ch = getchar();
  while (ch != ('\n')) {
    if (ch == ' ')
      putchar(ch);
    else
      putchar(ch + 1);
    ch = getchar();
  }
  putchar(ch);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
je     117f <main+0x5f>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jne    1161 <main+0x41>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
jmp    1170 <main+0x50>
movsbl -0x5(%rbp),%eax
add    $0x1,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
jmp    1139 <main+0x19>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
jmp    1138 <main+0x18>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0x20,%al
je     1130 <main+0x10>
cmp    $0xa,%al
je     114b <main+0x2b>
add    $0x1,%al
jmp    1130 <main+0x10>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %5, %0
%2 = tail call signext i8 (...) @getchar()
switch i8 %2, label %3 [
i8 10, label %8
i8 32, label %5
]
3: ; preds = %1
%4 = add i8 %2, 1
br label %5
5: ; preds = %1, %3
%6 = phi i8 [ %4, %3 ], [ %2, %1 ]
%7 = tail call i32 @putchar(i8 signext %6)
br label %1
8: ; preds = %1
%9 = tail call i32 @putchar(i8 signext 10)
ret i32 0
}
void __set_bit(int nr, volatile void *addr) {
  __asm__ __volatile__("btsl %1,%0"
                       : "+m"((*(volatile long *)addr))
                       : "Ir"(nr)
                       : "memory");
}


x86 assembly (clang, -O0):
<__set_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
bts    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__set_bit>:
bts    %edi,(%rsi)
ret

LLVM IR (-O0):
define void @__set_bit(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i64*
%7 = load i32, i32* %3
ret void
}

LLVM IR (-O2):
define void @__set_bit(i32 %0, i8* %1) {
%3 = bitcast i8* %1 to i64*
tail call void asm sideeffect "btsl $1,$0", "=*m,Ir,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %3, i32 %0, i64* elementtype(i64) %3)
ret void
}
/* Type definitions */
typedef unsigned int uint32_t;

/* Variables and functions */
uint32_t get_MCK_FREQ(void) { return (18432000U * 73U / 14U / 2U); }


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

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

LLVM IR (-O0):
define i32 @get_MCK_FREQ() {
ret i32 48054857
}

LLVM IR (-O2):
define i32 @get_MCK_FREQ() {
ret i32 48054857
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
fun5() { printf("Iam in function 5\n"); }


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

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

LLVM IR (-O0):
@.str = [19 x i8] c"Iam in function 5\0A\00"
define i32 @fun5() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [18 x i8] c"Iam in function 5\00"
define i32 @fun5() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ step_motor();
void main() { step_motor(); }


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

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

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

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @step_motor()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ tolower(int /*<<< orphan*/);
void to_lcase(char *str) {
  char *ptr;
  ptr = str;
  while (*ptr != '\0') {
    *ptr++ = tolower(*str++);
  }
  return;
}


x86 assembly (clang, -O0):
<to_lcase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1163 <to_lcase+0x53>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    1124 <to_lcase+0x14>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_lcase>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1136 <to_lcase+0x26>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <tolower@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <to_lcase+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @to_lcase(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %11, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @tolower(i32 %8)
%10 = trunc i32 %9 to i8
store i8 %10, i8* %6
%11 = load i8, i8* %7
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %1
ret void
}
/* Variables and functions */
int fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
getchar() { return (fgetc(stdin)); }


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

x86 assembly (clang, -O2):
<getchar>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <fgetc@plt>

LLVM IR (-O0):
@stdin = global i32 0
define i32 @getchar() {
%1 = load i32, i32* @stdin
%2 = call i32 @fgetc(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @getchar() {
%1 = load i32, i32* @stdin
%2 = tail call i32 @fgetc(i32 %1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ my_malloc1(void **, int);
void test1() {
  void *data = 0;
  my_malloc1(&data, 4);
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
mov    $0x4,%esi
call   1030 <my_malloc1@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
push   %rax
movq   $0x0,(%rsp)
mov    %rsp,%rdi
mov    $0x4,%esi
call   1030 <my_malloc1@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @test1() {
%1 = alloca i8*
store i8* null, i8** %1
%2 = call i32 @my_malloc1(i8** %1, i32 4)
ret void
}

LLVM IR (-O2):
define void @test1() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%3 = call i32 @my_malloc1(i8** %1, i32 4)
ret void
}
unsigned short SIO1_readMode16(void) { return 0; }


x86 assembly (clang, -O0):
<SIO1_readMode16>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
movzwl %ax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i16 @SIO1_readMode16() {
ret i16 0
}

LLVM IR (-O2):
define zeroext i16 @SIO1_readMode16() {
ret i16 0
}
/* Type definitions */
struct sembuf {
  int sem_num;
  int sem_op;
  int /*<<< orphan*/ sem_flg;
};

/* Variables and functions */
int /*<<< orphan*/ SEM_UNDO;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
scalar_t__ semop(int, struct sembuf *, int);
void V(int sem_id, int key) {
  struct sembuf *bf;
  bf->sem_num = key;
  bf->sem_op = -1;
  bf->sem_flg = SEM_UNDO;
  if (semop(sem_id, bf, 1) < 0) {
    perror("V failed\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<V>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
movl   $0xffffffff,0x4(%rax)
mov    0x2e97(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1040 <semop@plt>
cmp    $0x0,%rax
jge    1193 <V+0x63>
lea    0xe7c(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
%struct.sembuf = type { i32, i32, i32 }
@SEM_UNDO = global i32 0
@.str = [10 x i8] c"V failed\0A\00"
define void @V(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.sembuf*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = load %struct.sembuf*, %struct.sembuf** %5
%8 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %7, i32 0, i32 0
store i32 %6, i32* %8
%9 = load %struct.sembuf*, %struct.sembuf** %5
%10 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %9, i32 0, i32 1
store i32 -1, i32* %10
%11 = load i32, i32* @SEM_UNDO
%12 = load %struct.sembuf*, %struct.sembuf** %5
%13 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %12, i32 0, i32 2
store i32 %11, i32* %13
%14 = load i32, i32* %3
%15 = load %struct.sembuf*, %struct.sembuf** %5
%16 = call i64 @semop(i32 %14, %struct.sembuf* %15, i32 1)
%17 = icmp slt i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %2
%19 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %2
ret void
}

LLVM IR (-O2):
int main() {
  int a = 0;
  2 / a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
struct timeval {
  int dummy;
};

/* Variables and functions */
int ebbrt_newlib_gettimeofday(struct timeval *, void *);
int gettimeofday(struct timeval *p, void *z) {
  return ebbrt_newlib_gettimeofday(p, z);
}


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

x86 assembly (clang, -O2):
<gettimeofday>:
jmp    1030 <ebbrt_newlib_gettimeofday@plt>

LLVM IR (-O0):
%struct.timeval = type { i32 }
define i32 @gettimeofday(%struct.timeval* %0, i8* %1) {
%3 = alloca %struct.timeval*
%4 = alloca i8*
store %struct.timeval* %0, %struct.timeval** %3
store i8* %1, i8** %4
%5 = load %struct.timeval*, %struct.timeval** %3
%6 = load i8*, i8** %4
%7 = call i32 @ebbrt_newlib_gettimeofday(%struct.timeval* %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define i32 @gettimeofday(%struct.timeval* %0, i8* %1) {
%3 = tail call i32 @ebbrt_newlib_gettimeofday(%struct.timeval* %0, i8* %1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
size_t wcslen(wchar_t const *s) {
  size_t len = 0;
  while (*s++)
    ++len;
  return len;
}


x86 assembly (clang, -O0):
<wcslen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x8(%rbp)
cmpl   $0x0,(%rax)
je     1139 <wcslen+0x39>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <wcslen+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcslen>:
cmpl   $0x0,(%rdi)
je     111f <wcslen+0x1f>
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
lea    0x1(%rcx),%rax
cmpl   $0x0,0x4(%rdi,%rcx,4)
mov    %rax,%rcx
jne    1110 <wcslen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @wcslen(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i32* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i32, i32* %6, i64 1
%8 = add i64 %5, 1
%9 = load i32, i32* %7
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i64 [ 0, %1 ], [ %8, %4 ]
ret i64 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
void write_lsb_int(int n, FILE *f) {
  unsigned char buf[4];
  buf[0] = n & 0xFF;
  buf[1] = (n >> (1 * 8)) & 0xFF;
  buf[2] = (n >> (2 * 8)) & 0xFF;
  buf[3] = (n >> (3 * 8)) & 0xFF;
  fwrite(buf, 4, 1, f);
}


x86 assembly (clang, -O0):
<write_lsb_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x14(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,-0x13(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %al,-0x12(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
mov    %al,-0x11(%rbp)
lea    -0x14(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_lsb_int>:
push   %rax
mov    %rsi,%rcx
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @write_lsb_int(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca [4 x i8]
store i32 %0, i32* %3
store i32* %1, i32** %4
%6 = load i32, i32* %3
%7 = and i32 %6, 255
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
store i8 %8, i8* %9
%10 = load i32, i32* %3
%11 = ashr i32 %10, 8
%12 = and i32 %11, 255
%13 = trunc i32 %12 to i8
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 1
store i8 %13, i8* %14
%15 = load i32, i32* %3
%16 = ashr i32 %15, 16
%17 = and i32 %16, 255
%18 = trunc i32 %17 to i8
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 2
store i8 %18, i8* %19
%20 = load i32, i32* %3
%21 = ashr i32 %20, 24
%22 = and i32 %21, 255
%23 = trunc i32 %22 to i8
%24 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 3
store i8 %23, i8* %24
%25 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%26 = load i32*, i32** %4
%27 = call i32 @fwrite(i8* %25, i32 4, i32 1, i32* %26)
ret void
}

LLVM IR (-O2):
define void @write_lsb_int(i32 %0, i32* nocapture %1) {
%3 = alloca [4 x i8]
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = trunc i32 %0 to i8
store i8 %5, i8* %4
%6 = lshr i32 %0, 8
%7 = trunc i32 %6 to i8
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
store i8 %7, i8* %8
%9 = lshr i32 %0, 16
%10 = trunc i32 %9 to i8
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
store i8 %10, i8* %11
%12 = lshr i32 %0, 24
%13 = trunc i32 %12 to i8
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
store i8 %13, i8* %14
%15 = call i32 @fwrite(i8* %4, i32 4, i32 1, i32* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cprintf(char *, char *);
void help(void) {
  cprintf(
      "%s",
      "B <addr>  set break                    G  go from current PC\n"
      "BC <n>  clear break                    N [<radix>]  set/ask radix\n"
      "BD <n>  disable break                  Q  quit\n"
      "BE <n>  enable break                   R [<reg>]  register(s) display\n"
      "BL   list breaks                       S  step over branch or call\n"
      "D [<addr> [<lth>]]  dump               T [<n>]  trace N instructions\n"
      " DB, DW, DL, DC  format                U [<addr> [<lth>]]  unassemble\n"
      "I <port>  input byte port\n"
      "O <port> <byte>  out to byte port\n"
      "                      ? or H  print help\n");
}


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

x86 assembly (clang, -O2):
<help>:
lea    0xee9(%rip),%rdi
lea    0xee5(%rip),%rsi
jmp    1030 <cprintf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [552 x i8] c"B <addr> set break G go from current PC\0ABC <n> clear break N [<radix>] set/ask radix\0ABD <n> disable break Q quit\0ABE <n> enable break R [<reg>] register(s) display\0ABL list breaks S step over branch or call\0AD [<addr> [<lth>]] dump T [<n>] trace N instructions\0A DB, DW, DL, DC format U [<addr> [<lth>]] unassemble\0AI <port> input byte port\0AO <port> <byte> out to byte port\0A ? or H print help\0A\00"
define void @help() {
%1 = call i32 @cprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([552 x i8], [552 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [552 x i8] c"B <addr> set break G go from current PC\0ABC <n> clear break N [<radix>] set/ask radix\0ABD <n> disable break Q quit\0ABE <n> enable break R [<reg>] register(s) display\0ABL list breaks S step over branch or call\0AD [<addr> [<lth>]] dump T [<n>] trace N instructions\0A DB, DW, DL, DC format U [<addr> [<lth>]] unassemble\0AI <port> input byte port\0AO <port> <byte> out to byte port\0A ? or H print help\0A\00"
define void @help() {
%1 = tail call i32 @cprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([552 x i8], [552 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ syscall(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
void iwrites(char *str) { syscall(0x4953, str, 0, 0); }


x86 assembly (clang, -O0):
<iwrites>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x4953,%edi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @iwrites(i8* %0) {
%2 = tail call i32 @syscall(i32 18771, i8* %0, i32 0, i32 0)
ret void
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int libcall(int uno, int dos) {
  if (dos == 0) {
    return 1;
  }
  if (dos == 1) {
    return 2;
  }
  if (dos == 2) {
    return 3;
  }
  srand(time(NULL));
  return rand() % (uno + dos);
}


x86 assembly (clang, -O0):
<libcall>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1154 <libcall+0x24>
movl   $0x1,-0x4(%rbp)
jmp    11a3 <libcall+0x73>
cmpl   $0x1,-0xc(%rbp)
jne    116a <libcall+0x3a>
movl   $0x2,-0x4(%rbp)
jmp    11a3 <libcall+0x73>
cmpl   $0x2,-0xc(%rbp)
jne    1180 <libcall+0x50>
movl   $0x3,-0x4(%rbp)
jmp    11a3 <libcall+0x73>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0x0,%al
call   1050 <rand@plt>
mov    -0x8(%rbp),%ecx
add    -0xc(%rbp),%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<libcall>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
cmp    $0x3,%esi
jae    113f <libcall+0xf>
add    $0x1,%ebx
jmp    115d <libcall+0x2d>
mov    %edi,%ebp
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %eax,%eax
call   1050 <rand@plt>
add    %ebp,%ebx
cltd
idiv   %ebx
mov    %edx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @libcall(i32 %0, i32 %1) {
%3 = icmp ult i32 %1, 3
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = tail call i32 @time(i32* null)
%6 = tail call i32 @srand(i32 %5)
%7 = tail call i32 (...) @rand()
%8 = add nsw i32 %1, %0
%9 = srem i32 %7, %8
br label %12
10: ; preds = %2
%11 = add i32 %1, 1
br label %12
12: ; preds = %10, %4
%13 = phi i32 [ %9, %4 ], [ %11, %10 ]
ret i32 %13
}
struct sst_header *sst_mmap_header(const char *map) {
  return (struct sst_header *)map;
}


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

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

LLVM IR (-O0):
%struct.sst_header = type opaque
define %struct.sst_header* @sst_mmap_header(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.sst_header*
ret %struct.sst_header* %4
}

LLVM IR (-O2):
%struct.sst_header = type opaque
define %struct.sst_header* @sst_mmap_header(i8* readnone %0) {
%2 = bitcast i8* %0 to %struct.sst_header*
ret %struct.sst_header* %2
}
void __attribute__((sysv_abi)) foo() {}


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

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

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

LLVM IR (-O2):
define void @foo() {
ret void
}
int extn(unsigned char n) {
  if (n & 0x08) {
    int x = -16;
    return (x | n);
  } else {
    return n;
  }
}


x86 assembly (clang, -O0):
<extn>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1132 <extn+0x32>
movl   $0xfffffff0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movzbl -0x5(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1139 <extn+0x39>
movzbl -0x5(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extn>:
mov    %edi,%eax
or     $0xfffffff0,%eax
test   $0x8,%dil
cmove  %edi,%eax
ret

LLVM IR (-O0):
define i32 @extn(i8 zeroext %0) {
%2 = alloca i32
%3 = alloca i8
%4 = alloca i32
store i8 %0, i8* %3
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = and i32 %6, 8
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %1
store i32 -16, i32* %4
%10 = load i32, i32* %4
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = or i32 %10, %12
store i32 %13, i32* %2
br label %17
14: ; preds = %1
%15 = load i8, i8* %3
%16 = zext i8 %15 to i32
store i32 %16, i32* %2
br label %17
17: ; preds = %14, %9
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @extn(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = and i32 %2, 8
%4 = icmp eq i32 %3, 0
%5 = or i32 %2, -16
%6 = select i1 %4, i32 %2, i32 %5
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
void _mm_storeu_epi8(void *, int /*<<< orphan*/);
void test_mm_storeu_epi8(void *__p, __m128i __a) {
  return _mm_storeu_epi8(__p, __a);
}


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

x86 assembly (clang, -O2):
<test_mm_storeu_epi8>:
jmp    1030 <_mm_storeu_epi8@plt>

LLVM IR (-O0):
define void @test_mm_storeu_epi8(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
ret void
}

LLVM IR (-O2):
define void @test_mm_storeu_epi8(i8* %0, i32 %1) {
tail call void @_mm_storeu_epi8(i8* %0, i32 %1)
ret void
}
void start_test(void) {}


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

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

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

LLVM IR (-O2):
define void @start_test() {
ret void
}
/* Variables and functions */
size_t strlen(char *);
scalar_t__ strncmp(char *, char *, size_t);
int strisprefix(char *s1, char *s2) {
  size_t l = strlen(s1);
  return (0 == strncmp(s2, s1, l));
}


x86 assembly (clang, -O0):
<strisprefix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strisprefix>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @strisprefix(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
store i64 %7, i64* %5
%8 = load i8*, i8** %4
%9 = load i8*, i8** %3
%10 = load i64, i64* %5
%11 = call i64 @strncmp(i8* %8, i8* %9, i64 %10)
%12 = icmp eq i64 0, %11
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @strisprefix(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strncmp(i8* %1, i8* %0, i64 %3)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ LSR8(int /*<<< orphan*/);
int /*<<< orphan*/ SA1Absolute(int);
void Op4EM1(void) { LSR8(SA1Absolute(3)); }


x86 assembly (clang, -O0):
<Op4EM1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1030 <SA1Absolute@plt>
mov    %eax,%edi
call   1040 <LSR8@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Op4EM1>:
push   %rax
mov    $0x3,%edi
call   1030 <SA1Absolute@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <LSR8@plt>

LLVM IR (-O0):
define void @Op4EM1() {
%1 = call i32 @SA1Absolute(i32 3)
%2 = call i32 @LSR8(i32 %1)
ret void
}

LLVM IR (-O2):
define void @Op4EM1() {
%1 = tail call i32 @SA1Absolute(i32 3)
%2 = tail call i32 @LSR8(i32 %1)
ret void
}
void RTS3GetKey(void) {}


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

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

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

LLVM IR (-O2):
define void @RTS3GetKey() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("bcachify DEVICE [SB_SPACE]\n\n"
         "DEVICE - Device to insert bcache on. Must have at least\n"
         "\tSB_SPACE free space left at the end of the block device\n"
         "\tafter the filesystem. Use resize2fs or similar FIRST.\n"
         "SB_SPACE - Amount of room to leave for the bcache SB\n"
         "\t(in bytes). Minimum is 8k, default is 512k.\n");
  exit(0);
}


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

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

LLVM IR (-O0):
@.str = [295 x i8] c"bcachify DEVICE [SB_SPACE]\0A\0ADEVICE - Device to insert bcache on. Must have at least\0A\09SB_SPACE free space left at the end of the block device\0A\09after the filesystem. Use resize2fs or similar FIRST.\0ASB_SPACE - Amount of room to leave for the bcache SB\0A\09(in bytes). Minimum is 8k, default is 512k.\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([295 x i8], [295 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [294 x i8] c"bcachify DEVICE [SB_SPACE]\0A\0ADEVICE - Device to insert bcache on. Must have at least\0A\09SB_SPACE free space left at the end of the block device\0A\09after the filesystem. Use resize2fs or similar FIRST.\0ASB_SPACE - Amount of room to leave for the bcache SB\0A\09(in bytes). Minimum is 8k, default is 512k.\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([294 x i8], [294 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
void mpeg2_free(void *buf) {}


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

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

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

LLVM IR (-O2):
define void @mpeg2_free(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
void Fatal_error(char *x, char *y) {
  (void)fprintf(stderr, "Fatal error: %s %s !\n", x, y);
  error("Aborted !\n");
}


x86 assembly (clang, -O0):
<Fatal_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xeb8(%rip),%rsi
call   1030 <fprintf@plt>
lea    0xec2(%rip),%rdi
call   1040 <error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fatal_error>:
push   %rax
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
lea    0xed3(%rip),%rdi
pop    %rax
jmp    1040 <error@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"Fatal error: %s %s !\0A\00"
@.str.1 = [11 x i8] c"Aborted !\0A\00"
define void @Fatal_error(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7)
%9 = call i32 @error(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"Fatal error: %s %s !\0A\00"
@.str.1 = [11 x i8] c"Aborted !\0A\00"
define void @Fatal_error(i8* %0, i8* %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%5 = tail call i32 @error(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ check_io(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void output_end(FILE *output, char *oname) {
  fprintf(output, "---end---\n");
  check_io(output, oname, 0);
  return;
}


x86 assembly (clang, -O0):
<output_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1040 <check_io@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_end>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecf(%rip),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <check_io@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"---end---\0A\00"
define void @output_end(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i32*, i32** %3
%6 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%7 = load i32*, i32** %3
%8 = load i8*, i8** %4
%9 = call i32 @check_io(i32* %7, i8* %8, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"---end---\0A\00"
define void @output_end(i32* %0, i8* %1) {
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 10, i64 1, i32* %0)
%4 = tail call i32 @check_io(i32* %0, i8* %1, i32 0)
ret void
}
yyerror(s) char *s;
{ printf("%s\n", s); }


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

x86 assembly (clang, -O2):
<yyerror>:
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
define i32 @yyerror(i8* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) %0)
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/);
struct tm getTime() {
  time_t now = time(0);
  return *localtime(&now);
}


x86 assembly (clang, -O0):
<getTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getTime>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @getTime() {
%1 = alloca %struct.tm
%2 = alloca i32
%3 = call i32 @time(i32 0)
store i32 %3, i32* %2
%4 = call %struct.tm* @localtime(i32* %2)
%5 = bitcast %struct.tm* %1 to i8*
%6 = bitcast %struct.tm* %4 to i8*
%7 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 0
%8 = load i32, i32* %7
ret i32 %8
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @getTime() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32 0)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%6 = load i32, i32* %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ SIGQUIT;
scalar_t__ SIG_ERR;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
scalar_t__ signal(int /*<<< orphan*/, void (*)(int));
void sigquit(int signo) {
  if (signal(SIGQUIT, sigquit) == SIG_ERR) {
    perror("Unable to set signal handler");
  }
  printf("SIGQUIT caught\n");
}


x86 assembly (clang, -O0):
<sigquit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
mov    0x2e95(%rip),%rsi
call   1040 <signal@plt>
mov    0x2e79(%rip),%rcx
cmp    (%rcx),%rax
jne    116c <sigquit+0x3c>
lea    0xe99(%rip),%rdi
call   1050 <perror@plt>
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigquit>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
mov    0x2e9f(%rip),%rsi
call   1040 <signal@plt>
mov    0x2e83(%rip),%rcx
cmp    (%rcx),%rax
je     115f <sigquit+0x2f>
lea    0xec4(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0xe9a(%rip),%rdi
call   1050 <perror@plt>
jmp    1152 <sigquit+0x22>

LLVM IR (-O0):
@SIGQUIT = global i32 0
@SIG_ERR = global i64 0
@.str = [29 x i8] c"Unable to set signal handler\00"
@.str.1 = [16 x i8] c"SIGQUIT caught\0A\00"
define void @sigquit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @SIGQUIT
%4 = call i64 @signal(i32 %3, void (i32)* @sigquit)
%5 = load i64, i64* @SIG_ERR
%6 = icmp eq i64 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@SIGQUIT = global i32 0
@SIG_ERR = global i64 0
@.str = [29 x i8] c"Unable to set signal handler\00"
@str = [15 x i8] c"SIGQUIT caught\00"
define void @sigquit(i32 %0) {
%2 = load i32, i32* @SIGQUIT
%3 = tail call i64 @signal(i32 %2, void (i32)* @sigquit)
%4 = load i64, i64* @SIG_ERR
%5 = icmp eq i64 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret void
}
void show_flags(void) {}


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

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

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

LLVM IR (-O2):
define void @show_flags() {
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int const uint16_t;

/* Variables and functions */
uint16_t sg_get_unaligned_be16(const void *p) {
  return ((const uint8_t *)p)[0] << 8 | ((const uint8_t *)p)[1];
}


x86 assembly (clang, -O0):
<sg_get_unaligned_be16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
or     0x4(%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sg_get_unaligned_be16>:
mov    (%rdi),%eax
shl    $0x8,%eax
or     0x4(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @sg_get_unaligned_be16(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = shl i32 %3, 8
%5 = getelementptr inbounds i8, i8* %0, i64 4
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = or i32 %4, %7
ret i32 %8
}
/* Type definitions */
typedef size_t uint64_t;
typedef size_t uint32_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
size_t SIZE_MAX;
void *malloc(size_t);
void *alloc_img(uint32_t width, uint32_t height) {
  uint64_t tmp;
  size_t size;
  tmp = (uint64_t)width * height;
  size = 4 * sizeof(uint16_t);
  if (tmp > SIZE_MAX / size) {
    return 0;
  }
  return malloc(tmp * size);
}


x86 assembly (clang, -O0):
<alloc_img>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
movq   $0x10,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    0x2e94(%rip),%rax
mov    (%rax),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x28(%rbp)
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
jbe    116c <alloc_img+0x5c>
movq   $0x0,-0x8(%rbp)
jmp    117e <alloc_img+0x6e>
mov    -0x20(%rbp),%rdi
imul   -0x28(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_img>:
imul   %rsi,%rdi
mov    0x2ebd(%rip),%rax
mov    (%rax),%rax
shr    $0x4,%rax
cmp    %rax,%rdi
jbe    112a <alloc_img+0x1a>
xor    %eax,%eax
ret
shl    $0x4,%rdi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
@SIZE_MAX = global i64 0
define i8* @alloc_img(i64 %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%8 = load i64, i64* %4
%9 = load i64, i64* %5
%10 = mul i64 %8, %9
store i64 %10, i64* %6
store i64 16, i64* %7
%11 = load i64, i64* %6
%12 = load i64, i64* @SIZE_MAX
%13 = load i64, i64* %7
%14 = udiv i64 %12, %13
%15 = icmp ugt i64 %11, %14
br i1 %15, label %16, label %17
16: ; preds = %2
store i8* null, i8** %3
br label %22
17: ; preds = %2
%18 = load i64, i64* %6
%19 = load i64, i64* %7
%20 = mul i64 %18, %19
%21 = call i8* @malloc(i64 %20)
store i8* %21, i8** %3
br label %22
22: ; preds = %17, %16
%23 = load i8*, i8** %3
ret i8* %23
}

LLVM IR (-O2):
@SIZE_MAX = global i64 0
define noalias i8* @alloc_img(i64 %0, i64 %1) {
%3 = mul i64 %1, %0
%4 = load i64, i64* @SIZE_MAX
%5 = lshr i64 %4, 4
%6 = icmp ugt i64 %3, %5
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = shl i64 %3, 4
%9 = tail call i8* @malloc(i64 %8)
br label %10
10: ; preds = %2, %7
%11 = phi i8* [ %9, %7 ], [ null, %2 ]
ret i8* %11
}