xunge/DecIR huggingface dataset:
/* Variables and functions */
int error(int, char *);
int /*<<< orphan*/ sscanf(char *, char *, unsigned char *);
int /*<<< orphan*/ zaber_home(unsigned char);
int cmd_zhome(int argc, char *argv[]) {
  unsigned char unit;
  if (argc != 2)
    return error((-2), "Usage: zhome [unit]");
  sscanf(argv[1], "%hhu", &unit);
  zaber_home(unit);
  return 0;
}


x86 assembly (clang, -O0):
<cmd_zhome>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1162 <cmd_zhome+0x32>
mov    $0xfffffffe,%edi
lea    0xeab(%rip),%rsi
call   1040 <error@plt>
mov    %eax,-0x4(%rbp)
jmp    118a <cmd_zhome+0x5a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xea3(%rip),%rsi
lea    -0x11(%rbp),%rdx
call   1030 <sscanf@plt>
movzbl -0x11(%rbp),%edi
call   1050 <zaber_home@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_zhome>:
cmp    $0x2,%edi
jne    1159 <cmd_zhome+0x29>
push   %rax
mov    0x8(%rsi),%rdi
lea    0xed3(%rip),%rsi
lea    0x7(%rsp),%rdx
call   1030 <sscanf@plt>
movzbl 0x7(%rsp),%edi
call   1050 <zaber_home@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xea0(%rip),%rsi
mov    $0xfffffffe,%edi
jmp    1040 <error@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Usage: zhome [unit]\00"
@.str.1 = [5 x i8] c"%hhu\00"
define i32 @cmd_zhome(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @error(i32 -2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 %10, i32* %3
br label %18
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%16 = load i8, i8* %6
%17 = call i32 @zaber_home(i8 zeroext %16)
store i32 0, i32* %3
br label %18
18: ; preds = %11, %9
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@.str = [20 x i8] c"Usage: zhome [unit]\00"
@.str.1 = [5 x i8] c"%hhu\00"
define i32 @cmd_zhome(i32 %0, i8** nocapture %1) {
%3 = alloca i8
%4 = icmp eq i32 %0, 2
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @error(i32 -2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %13
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%11 = load i8, i8* %3
%12 = call i32 @zaber_home(i8 zeroext %11)
br label %13
13: ; preds = %7, %5
%14 = phi i32 [ %6, %5 ], [ 0, %7 ]
ret i32 %14
}
void ARGBToARGB1555Row_SSE2() {}


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

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

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

LLVM IR (-O2):
define void @ARGBToARGB1555Row_SSE2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *trap_MemAlloc(scalar_t__, char const *, int);
char *_G_CopyString(const char *in, const char *filename, int fileline) {
  char *out;
  out = trap_MemAlloc(strlen(in) + 1, filename, fileline);
  strcpy(out, in);
  return out;
}


x86 assembly (clang, -O0):
<_G_CopyString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <trap_MemAlloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_G_CopyString>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1050 <trap_MemAlloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rbp,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @_G_CopyString(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
%10 = add nsw i64 %9, 1
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = call i8* @trap_MemAlloc(i64 %10, i8* %11, i32 %12)
store i8* %13, i8** %7
%14 = load i8*, i8** %7
%15 = load i8*, i8** %4
%16 = call i32 @strcpy(i8* %14, i8* %15)
%17 = load i8*, i8** %7
ret i8* %17
}

LLVM IR (-O2):
define i8* @_G_CopyString(i8* %0, i8* %1, i32 %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = add nsw i64 %4, 1
%6 = tail call i8* @trap_MemAlloc(i64 %5, i8* %1, i32 %2)
%7 = tail call i32 @strcpy(i8* %6, i8* %0)
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ init_fec();
int /*<<< orphan*/ make_atan2_table();
int /*<<< orphan*/ read_from_stdin();
int main(int argc, char **argv) {
  make_atan2_table();
  init_fec();
  read_from_stdin();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @make_atan2_table()
%4 = tail call i32 (...) @init_fec()
%5 = tail call i32 (...) @read_from_stdin()
ret i32 0
}
/* Type definitions */
typedef enum xprt_stat { ____Placeholder_xprt_stat } xprt_stat;
typedef int /*<<< orphan*/ SVCXPRT;

/* Variables and functions */
int XPRT_IDLE;
enum xprt_stat svcraw_stat(SVCXPRT *__xprt) {
  (void)__xprt;
  return (XPRT_IDLE);
}


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

x86 assembly (clang, -O2):
<svcraw_stat>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

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

LLVM IR (-O2):
@XPRT_IDLE = global i32 0
define i32 @svcraw_stat(i32* nocapture readnone %0) {
%2 = load i32, i32* @XPRT_IDLE
ret i32 %2
}
/* Variables and functions */
int power(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("2^10 = %d\n", power(2, 10));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"2^10 = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @power(i32 2, i32 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
int precedence(char *operator) {
  if (*operator== '*')
    return 10;
  if (*operator== '/')
    return 10;
  if (*operator== '+')
    return 1;
  if (*operator== '-')
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<precedence>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2a,%eax
jne    1124 <precedence+0x24>
movl   $0xa,-0x4(%rbp)
jmp    117f <precedence+0x7f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1140 <precedence+0x40>
movl   $0xa,-0x4(%rbp)
jmp    117f <precedence+0x7f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
jne    115c <precedence+0x5c>
movl   $0x1,-0x4(%rbp)
jmp    117f <precedence+0x7f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1178 <precedence+0x78>
movl   $0x1,-0x4(%rbp)
jmp    117f <precedence+0x7f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<precedence>:
mov    (%rdi),%cl
add    $0xd6,%cl
xor    %eax,%eax
cmp    $0x5,%cl
ja     111a <precedence+0x1a>
movsbq %cl,%rax
lea    0xee9(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @precedence(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 42
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 10, i32* %2
br label %28
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 47
br i1 %13, label %14, label %15
14: ; preds = %9
store i32 10, i32* %2
br label %28
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 43
br i1 %19, label %20, label %21
20: ; preds = %15
store i32 1, i32* %2
br label %28
21: ; preds = %15
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 45
br i1 %25, label %26, label %27
26: ; preds = %21
store i32 1, i32* %2
br label %28
27: ; preds = %21
store i32 0, i32* %2
br label %28
28: ; preds = %27, %26, %20, %14, %8
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
@switch.table.precedence = [6 x i32] [i32 10, i32 1, i32 0, i32 1, i32 0, i32 10]
define i32 @precedence(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = add i8 %2, -42
%4 = icmp ult i8 %3, 6
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i8 %3 to i64
%7 = getelementptr inbounds [6 x i32], [6 x i32]* @switch.table.precedence, i64 0, i64 %6
%8 = load i32, i32* %7
br label %9
9: ; preds = %1, %5
%10 = phi i32 [ %8, %5 ], [ 0, %1 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int threeSumClosest(int *, int, int);
int main(void) {
  int x[] = {0, 1, 2};
  printf("%d\n", threeSumClosest(x, 3, 3));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x3,%edx
mov    %edx,%esi
call   1030 <threeSumClosest@plt>
mov    %eax,%esi
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xede(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xecb(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x3,%esi
mov    $0x3,%edx
call   1030 <threeSumClosest@plt>
lea    0xeb7(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@__const.main.x = [3 x i32] [i32 0, i32 1, i32 2]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%4 = call i32 @threeSumClosest(i32* %3, i32 3, i32 3)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
extern int isonum_711(p)
unsigned char *p;
{ return *p; }


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

x86 assembly (clang, -O2):
<isonum_711>:
movzbl (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @isonum_711(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @isonum_711(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ e_read(int, unsigned int *);
int /*<<< orphan*/ e_write(int, unsigned int);
int /*<<< orphan*/ printf(char *, unsigned int);
int main(int argc, char *argv[]) {
  unsigned int data, rdata;
  data = 2;
  e_write(0x810f0000, data);
  data = 3;
  e_write(0x810f0004, data);
  e_read(0x810f0008, &rdata);
  printf("RESULT=%d\n", rdata);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%esi
mov    $0x810f0000,%edi
call   1050 <e_write@plt>
movl   $0x3,-0x14(%rbp)
mov    -0x14(%rbp),%esi
mov    $0x810f0004,%edi
call   1050 <e_write@plt>
mov    $0x810f0008,%edi
lea    -0x18(%rbp),%rsi
call   1040 <e_read@plt>
mov    -0x18(%rbp),%esi
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x810f0000,%edi
mov    $0x2,%esi
call   1050 <e_write@plt>
mov    $0x810f0004,%edi
mov    $0x3,%esi
call   1050 <e_write@plt>
lea    0x4(%rsp),%rsi
mov    $0x810f0008,%edi
call   1040 <e_read@plt>
mov    0x4(%rsp),%esi
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"RESULT=%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 2, i32* %5
%7 = load i32, i32* %5
%8 = call i32 @e_write(i32 -2129723392, i32 %7)
store i32 3, i32* %5
%9 = load i32, i32* %5
%10 = call i32 @e_write(i32 -2129723388, i32 %9)
%11 = call i32 @e_read(i32 -2129723384, i32* %6)
%12 = load i32, i32* %6
%13 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"RESULT=%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @e_write(i32 -2129723392, i32 2)
%6 = tail call i32 @e_write(i32 -2129723388, i32 3)
%7 = call i32 @e_read(i32 -2129723384, i32* %3)
%8 = load i32, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ scull_trim(int);
void scull_cleanup_module(void) {
  int dev;
  scull_trim(dev);
}


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

x86 assembly (clang, -O2):
<scull_cleanup_module>:
jmp    1030 <scull_trim@plt>

LLVM IR (-O0):
define void @scull_cleanup_module() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = call i32 @scull_trim(i32 %2)
ret void
}

LLVM IR (-O2):
define void @scull_cleanup_module() {
%1 = tail call i32 @scull_trim(i32 undef)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
void receive_callback(char *from, char *data) {
  printf("Radio recv: from=%s data=%s\n", from, data);
}


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

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

LLVM IR (-O0):
@.str = [29 x i8] c"Radio recv: from=%s data=%s\0A\00"
define void @receive_callback(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 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"Radio recv: from=%s data=%s\0A\00"
define void @receive_callback(i8* %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a, *aa = &a;
  scanf("%d", aa);
  printf("%#p %d", aa, *aa);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed8(%rip),%rdi
lea    0xc(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%edx
lea    0xebc(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"%#p %d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32 %4)
ret i32 0
}
int int_comparator(const void *first_arg, const void *second_arg) {
  int first = *(int *)first_arg;
  int second = *(int *)second_arg;
  if (first < second) {
    return 0;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<int_comparator>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1136 <int_comparator+0x36>
movl   $0x0,-0x4(%rbp)
jmp    113d <int_comparator+0x3d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_comparator>:
mov    (%rdi),%ecx
xor    %eax,%eax
cmp    (%rsi),%ecx
setge  %al
ret

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

LLVM IR (-O2):
define i32 @int_comparator(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp sge i32 %4, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr,
          "usage: mktape [-b blocklen] [file1] [-b blocklen] [file2] ...\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [63 x i8] c"usage: mktape [-b blocklen] [file1] [-b blocklen] [file2] ...\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [63 x i8] c"usage: mktape [-b blocklen] [file1] [-b blocklen] [file2] ...\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void sigcatcher(int sig) {
  fprintf(stderr, "osmrelpoly"
                  ": "
                  "Output has been terminated."
                  "\n");
  exit(1);
}


x86 assembly (clang, -O0):
<sigcatcher>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [41 x i8] c"osmrelpoly: Output has been terminated.\0A\00"
define void @sigcatcher(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [41 x i8] c"osmrelpoly: Output has been terminated.\0A\00"
define void @sigcatcher(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int SIGINT;
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scr_dump(char *);
void sig_handler(int signo) {
  if (signo == SIGINT) {
    char *white = "\e[97m";
    printf("%sCleaning up ...\n", white);
    scr_dump("my_file");
    endwin();
    exit(1);
  }
}


x86 assembly (clang, -O0):
<sig_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2e93(%rip),%rcx
cmp    (%rcx),%eax
jne    1195 <sig_handler+0x55>
lea    0xe9c(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9a(%rip),%rdi
call   1040 <scr_dump@plt>
mov    $0x0,%al
call   1050 <endwin@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_handler>:
push   %rax
mov    0x2ea0(%rip),%rax
cmp    %edi,(%rax)
je     114e <sig_handler+0xe>
pop    %rax
ret
lea    0xeb1(%rip),%rdi
lea    0xea4(%rip),%rsi
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
call   1040 <scr_dump@plt>
xor    %eax,%eax
call   1050 <endwin@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@SIGINT = global i32 0
@.str = [6 x i8] c"\1B[97m\00"
@.str.1 = [19 x i8] c"%sCleaning up ...\0A\00"
@.str.2 = [8 x i8] c"my_file\00"
define void @sig_handler(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @SIGINT
%6 = icmp eq i32 %4, %5
br i1 %6, label %7, label %13
7: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %3
%8 = load i8*, i8** %3
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = call i32 @scr_dump(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (...) @endwin()
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %1
ret void
}

LLVM IR (-O2):
@SIGINT = global i32 0
@.str = [6 x i8] c"\1B[97m\00"
@.str.1 = [19 x i8] c"%sCleaning up ...\0A\00"
@.str.2 = [8 x i8] c"my_file\00"
define void @sig_handler(i32 %0) {
%2 = load i32, i32* @SIGINT
%3 = icmp eq i32 %2, %0
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @scr_dump(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 (...) @endwin()
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fill(int /*<<< orphan*/);
void clear() { fill(0); }


x86 assembly (clang, -O0):
<clear>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <fill@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear>:
xor    %edi,%edi
jmp    1030 <fill@plt>

LLVM IR (-O0):
define void @clear() {
%1 = call i32 @fill(i32 0)
ret void
}

LLVM IR (-O2):
define void @clear() {
%1 = tail call i32 @fill(i32 0)
ret void
}
int util_isdigit(char c) { return (c >= '0' && c <= '9'); }


x86 assembly (clang, -O0):
<util_isdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <util_isdigit+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_isdigit>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @util_isdigit(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @util_isdigit(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
unsigned char inb(unsigned short port) {
  unsigned char ret;
  asm volatile("inb (%%dx),%%al" : "=a"(ret) : "d"(port));
  return ret;
}


x86 assembly (clang, -O0):
<inb>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%al
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inb>:
mov    %edi,%edx
in     (%dx),%al
ret

LLVM IR (-O0):
define zeroext i8 @inb(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i8
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i8 asm sideeffect "inb (%dx),%al", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i8 %5, i8* %3
%6 = load i8, i8* %3
ret i8 %6
}

LLVM IR (-O2):
define zeroext i8 @inb(i16 zeroext %0) {
%2 = tail call i8 asm sideeffect "inb (%dx),%al", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ opicoesInicio();
main() { opicoesInicio(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @opicoesInicio()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ return_struct_vd4();
int /*<<< orphan*/ take_struct_vd4(int /*<<< orphan*/);
void test_struct_vd4() { take_struct_vd4(return_struct_vd4()); }


x86 assembly (clang, -O0):
<test_struct_vd4>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <return_struct_vd4@plt>
mov    %eax,%edi
call   1030 <take_struct_vd4@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_struct_vd4>:
push   %rax
xor    %eax,%eax
call   1040 <return_struct_vd4@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <take_struct_vd4@plt>

LLVM IR (-O0):
define void @test_struct_vd4() {
%1 = call i32 (...) @return_struct_vd4()
%2 = call i32 @take_struct_vd4(i32 %1)
ret void
}

LLVM IR (-O2):
define void @test_struct_vd4() {
%1 = tail call i32 (...) @return_struct_vd4()
%2 = tail call i32 @take_struct_vd4(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pwm_write(char *, char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, unsigned long);
int pwm_set_period(char *pwm_key, unsigned long period) {
  if (pwm_key == NULL)
    return -1;
  char value[64];
  snprintf(value, 64, "%lu", period);
  pwm_write(pwm_key, "period", value);
}


x86 assembly (clang, -O0):
<pwm_set_period>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1147 <pwm_set_period+0x27>
movl   $0xffffffff,-0x4(%rbp)
jmp    1174 <pwm_set_period+0x54>
lea    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x40,%esi
lea    0xea5(%rip),%rdx
call   1040 <snprintf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rdx
lea    0xe95(%rip),%rsi
call   1030 <pwm_write@plt>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pwm_set_period>:
test   %rdi,%rdi
je     1162 <pwm_set_period+0x42>
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%rcx
mov    %rdi,%rbx
lea    0xec7(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x40,%esi
call   1040 <snprintf@plt>
lea    0xeb4(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1030 <pwm_write@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lu\00"
@.str.1 = [7 x i8] c"period\00"
define i32 @pwm_set_period(i8* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca [64 x i8]
store i8* %0, i8** %4
store i64 %1, i64* %5
%7 = load i8*, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 -1, i32* %3
br label %17
10: ; preds = %2
%11 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%12 = load i64, i64* %5
%13 = call i32 @snprintf(i8* %11, i32 64, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %12)
%14 = load i8*, i8** %4
%15 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%16 = call i32 @pwm_write(i8* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %10, %9
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lu\00"
@.str.1 = [7 x i8] c"period\00"
define i32 @pwm_set_period(i8* %0, i64 %1) {
%3 = alloca [64 x i8]
%4 = icmp eq i8* %0, null
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%7 = call i32 @snprintf(i8* %6, i32 64, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %1)
%8 = call i32 @pwm_write(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %6)
br label %9
9: ; preds = %2, %5
ret i32 -1
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int getpos(int, int);
int /*<<< orphan*/ outb(int, int);
void terminal_movecursor(int x, int y) {
  int pos = getpos(x, y);
  uint8_t low = (uint8_t)(pos & 0xFF);
  uint8_t high = (uint8_t)((pos >> 8) & 0xFF);
  outb(0x3D4, 0x0F);
  outb(0x3D5, low);
  outb(0x3D4, 0x0E);
  outb(0x3D5, high);
}


x86 assembly (clang, -O0):
<terminal_movecursor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <getpos@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    $0x3d4,%edi
mov    $0xf,%esi
call   1030 <outb@plt>
mov    -0x10(%rbp),%esi
mov    $0x3d5,%edi
call   1030 <outb@plt>
mov    $0x3d4,%edi
mov    $0xe,%esi
call   1030 <outb@plt>
mov    -0x14(%rbp),%esi
mov    $0x3d5,%edi
call   1030 <outb@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<terminal_movecursor>:
push   %rbp
push   %rbx
push   %rax
call   1040 <getpos@plt>
movzbl %al,%ebp
movzbl %ah,%ebx
mov    $0x3d4,%edi
mov    $0xf,%esi
call   1030 <outb@plt>
mov    $0x3d5,%edi
mov    %ebp,%esi
call   1030 <outb@plt>
mov    $0x3d4,%edi
mov    $0xe,%esi
call   1030 <outb@plt>
mov    $0x3d5,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @terminal_movecursor(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @getpos(i32 %8, i32 %9)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = and i32 %11, 255
store i32 %12, i32* %6
%13 = load i32, i32* %5
%14 = ashr i32 %13, 8
%15 = and i32 %14, 255
store i32 %15, i32* %7
%16 = call i32 @outb(i32 980, i32 15)
%17 = load i32, i32* %6
%18 = call i32 @outb(i32 981, i32 %17)
%19 = call i32 @outb(i32 980, i32 14)
%20 = load i32, i32* %7
%21 = call i32 @outb(i32 981, i32 %20)
ret void
}

LLVM IR (-O2):
define void @terminal_movecursor(i32 %0, i32 %1) {
%3 = tail call i32 @getpos(i32 %0, i32 %1)
%4 = and i32 %3, 255
%5 = lshr i32 %3, 8
%6 = and i32 %5, 255
%7 = tail call i32 @outb(i32 980, i32 15)
%8 = tail call i32 @outb(i32 981, i32 %4)
%9 = tail call i32 @outb(i32 980, i32 14)
%10 = tail call i32 @outb(i32 981, i32 %6)
ret void
}
int util_ss() { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @util_ss() {
ret i32 1
}
void OSP_rotvec_init() {}


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

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

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

LLVM IR (-O2):
define void @OSP_rotvec_init() {
ret void
}
int strrev(char *s, int start, int last) {
  char temp;
  while (start < last) {
    temp = s[start];
    s[start++] = s[last];
    s[last--] = temp;
  }
}


x86 assembly (clang, -O0):
<strrev>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1165 <strrev+0x65>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x19(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x14(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x19(%rbp),%dl
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%esi
add    $0xffffffff,%esi
mov    %esi,-0x18(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    110e <strrev+0xe>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strrev>:
cmp    %edx,%esi
jge    1131 <strrev+0x31>
movslq %esi,%rax
movslq %edx,%rcx
add    $0x1,%rax
xchg   %ax,%ax
movzbl -0x1(%rdi,%rax,1),%esi
movzbl (%rdi,%rcx,1),%edx
mov    %dl,-0x1(%rdi,%rax,1)
mov    %sil,(%rdi,%rcx,1)
add    $0xffffffffffffffff,%rcx
lea    0x1(%rax),%rdx
cmp    %rcx,%rax
mov    %rdx,%rax
jl     1110 <strrev+0x10>
ret

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

LLVM IR (-O2):
define i32 @strrev(i8* nocapture %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %18
5: ; preds = %3
%6 = sext i32 %1 to i64
%7 = sext i32 %2 to i64
br label %8
8: ; preds = %5, %8
%9 = phi i64 [ %7, %5 ], [ %16, %8 ]
%10 = phi i64 [ %6, %5 ], [ %15, %8 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %0, i64 %9
%14 = load i8, i8* %13
%15 = add nsw i64 %10, 1
store i8 %14, i8* %11
%16 = add nsw i64 %9, -1
store i8 %12, i8* %13
%17 = icmp slt i64 %15, %16
br i1 %17, label %8, label %18
18: ; preds = %8, %3
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int /*<<< orphan*/);
int startWith(char *buf, char *str) { return !strncmp(buf, str, strlen(str)); }


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

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

LLVM IR (-O0):
define i32 @startWith(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 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @strncmp(i8* %5, i8* %6, i32 %8)
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
%12 = zext i1 %11 to i32
ret i32 %12
}

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


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

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

LLVM IR (-O0):
define void @test_simple() {
%1 = call i32 (...) @init_store()
%2 = call i32 (...) @destroy_store()
ret void
}

LLVM IR (-O2):
define void @test_simple() {
%1 = tail call i32 (...) @init_store()
%2 = tail call i32 (...) @destroy_store()
ret void
}
int isalpha(int ch) { return (unsigned int)((ch | 0x20) - 'a') < 26u; }


x86 assembly (clang, -O0):
<isalpha>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x20,%eax
sub    $0x61,%eax
cmp    $0x1a,%eax
setb   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isalpha>:
or     $0x20,%edi
add    $0xffffff9f,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @isalpha(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = or i32 %3, 32
%5 = sub nsw i32 %4, 97
%6 = icmp ult i32 %5, 26
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @isalpha(i32 %0) {
%2 = or i32 %0, 32
%3 = add nsw i32 %2, -97
%4 = icmp ult i32 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ va_double(int, double, double, double, double);
int /*<<< orphan*/ va_long_double(int, long double, long double, long double,
                                  long double);
main() {
  va_double(4, 3.141592, 2.71827, 2.2360679, 2.1474836);
  va_long_double(4, 3.141592L, 2.71827L, 2.2360679L, 2.1474836L);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
movsd  0xef4(%rip),%xmm0
movsd  0xef4(%rip),%xmm1
movsd  0xef4(%rip),%xmm2
movsd  0xef4(%rip),%xmm3
call   1030 <va_double@plt>
mov    %rsp,%rax
fldt   0xe8e(%rip)
fstpt  0x30(%rax)
fldt   0xe95(%rip)
fstpt  0x20(%rax)
fldt   0xe9c(%rip)
fstpt  0x10(%rax)
fldt   0xea3(%rip)
fstpt  (%rax)
mov    $0x4,%edi
call   1040 <va_long_double@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
movsd  0xec4(%rip),%xmm0
movsd  0xec4(%rip),%xmm1
movsd  0xec4(%rip),%xmm2
movsd  0xec4(%rip),%xmm3
mov    $0x4,%edi
call   1030 <va_double@plt>
fldt   0xebc(%rip)
fstpt  0x30(%rsp)
fldt   0xec2(%rip)
fstpt  0x20(%rsp)
fldt   0xec8(%rip)
fstpt  0x10(%rsp)
fldt   0xece(%rip)
fstpt  (%rsp)
mov    $0x4,%edi
call   1040 <va_long_double@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @va_double(i32 4, double 0x400921FAFC8B007A, double 2.718270e+00, double 0x4001E3779131154C, double 0x40012E0BE1B5921E)
%3 = call i32 @va_long_double(i32 4, x86_fp80 0xK4000C90FD7E45803CD14, x86_fp80 0xK4000ADF822BBECAAB8A6, x86_fp80 0xK40008F1BBC8988AA5E0D, x86_fp80 0xK400089705F0DAC90ED23)
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @va_double(i32 4, double 0x400921FAFC8B007A, double 2.718270e+00, double 0x4001E3779131154C, double 0x40012E0BE1B5921E)
%2 = tail call i32 @va_long_double(i32 4, x86_fp80 0xK4000C90FD7E45803CD14, x86_fp80 0xK4000ADF822BBECAAB8A6, x86_fp80 0xK40008F1BBC8988AA5E0D, x86_fp80 0xK400089705F0DAC90ED23)
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ pmm_modify_memory_region(unsigned int, unsigned int, int);
void pmm_remove_memory_region(unsigned int start, unsigned int end) {
  pmm_modify_memory_region(start, end, 1);
}


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

x86 assembly (clang, -O2):
<pmm_remove_memory_region>:
mov    $0x1,%edx
jmp    1030 <pmm_modify_memory_region@plt>

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

LLVM IR (-O2):
define void @pmm_remove_memory_region(i32 %0, i32 %1) {
%3 = tail call i32 @pmm_modify_memory_region(i32 %0, i32 %1, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ serial_putc(char);
void serial_puts(char *string) {
  int i = 0;
  while (string[i]) {
    serial_putc(string[i]);
    i++;
  }
}


x86 assembly (clang, -O0):
<serial_puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1154 <serial_puts+0x44>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <serial_putc@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <serial_puts+0x13>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @serial_puts(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8 [ %10, %4 ], [ %2, %1 ]
%7 = tail call i32 @serial_putc(i8 signext %6)
%8 = add nuw i64 %5, 1
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
short makeShort(char a, char b) {
  short s;
  s = a * 256 + b;
  return s;
}


x86 assembly (clang, -O0):
<makeShort>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
shl    $0x8,%eax
movsbl -0x2(%rbp),%ecx
add    %ecx,%eax
mov    %ax,-0x4(%rbp)
movswl -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeShort>:
shl    $0x8,%edi
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define signext i16 @makeShort(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i16
store i8 %0, i8* %3
store i8 %1, i8* %4
%6 = load i8, i8* %3
%7 = sext i8 %6 to i32
%8 = mul nsw i32 %7, 256
%9 = load i8, i8* %4
%10 = sext i8 %9 to i32
%11 = add nsw i32 %8, %10
%12 = trunc i32 %11 to i16
store i16 %12, i16* %5
%13 = load i16, i16* %5
ret i16 %13
}

LLVM IR (-O2):
define signext i16 @makeShort(i8 signext %0, i8 signext %1) {
%3 = zext i8 %0 to i16
%4 = shl nuw i16 %3, 8
%5 = sext i8 %1 to i16
%6 = add i16 %4, %5
ret i16 %6
}