xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ reqbuf;

/* Variables and functions */
int ph_rpc(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int phDelVline(int vlid) {
  char reqbuf[32];
  snprintf(reqbuf, sizeof(reqbuf), "DELVL VLID=%d", vlid);
  return ph_rpc(reqbuf);
}


x86 assembly (clang, -O0):
<phDelVline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    $0x20,%esi
lea    0xec2(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x30(%rbp),%rdi
call   1040 <ph_rpc@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<phDelVline>:
push   %rbx
sub    $0x20,%rsp
mov    %edi,%ecx
lea    0xed2(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x20,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <ph_rpc@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"DELVL VLID=%d\00"
define i32 @phDelVline(i32 %0) {
%2 = alloca i32
%3 = alloca [32 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @snprintf(i8* %4, i32 32, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%8 = call i32 @ph_rpc(i8* %7)
ret i32 %8
}

LLVM IR (-O2):
@.str = [14 x i8] c"DELVL VLID=%d\00"
define i32 @phDelVline(i32 %0) {
%2 = alloca [32 x i8]
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 32, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = call i32 @ph_rpc(i8* %3)
ret i32 %5
}
/* Variables and functions */
scalar_t__ rand();
void rand_init(unsigned short *seed) {
  seed[0] = (unsigned short)rand();
  seed[1] = (unsigned short)rand();
  seed[2] = (unsigned short)rand();
}


x86 assembly (clang, -O0):
<rand_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %ax,%cx
mov    -0x8(%rbp),%rax
mov    %cx,(%rax)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %ax,%cx
mov    -0x8(%rbp),%rax
mov    %cx,0x2(%rax)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %ax,%cx
mov    -0x8(%rbp),%rax
mov    %cx,0x4(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_init>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <rand@plt>
mov    %ax,(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %ax,0x2(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %ax,0x4(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @rand_init(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = call i64 (...) @rand()
%4 = trunc i64 %3 to i16
%5 = load i16*, i16** %2
%6 = getelementptr inbounds i16, i16* %5, i64 0
store i16 %4, i16* %6
%7 = call i64 (...) @rand()
%8 = trunc i64 %7 to i16
%9 = load i16*, i16** %2
%10 = getelementptr inbounds i16, i16* %9, i64 1
store i16 %8, i16* %10
%11 = call i64 (...) @rand()
%12 = trunc i64 %11 to i16
%13 = load i16*, i16** %2
%14 = getelementptr inbounds i16, i16* %13, i64 2
store i16 %12, i16* %14
ret void
}

LLVM IR (-O2):
define void @rand_init(i16* nocapture writeonly %0) {
%2 = tail call i64 (...) @rand()
%3 = trunc i64 %2 to i16
store i16 %3, i16* %0
%4 = tail call i64 (...) @rand()
%5 = trunc i64 %4 to i16
%6 = getelementptr inbounds i16, i16* %0, i64 1
store i16 %5, i16* %6
%7 = tail call i64 (...) @rand()
%8 = trunc i64 %7 to i16
%9 = getelementptr inbounds i16, i16* %0, i64 2
store i16 %8, i16* %9
ret void
}
int udg_test_simple_decl() { int x; }


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

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

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

LLVM IR (-O2):
define i32 @udg_test_simple_decl() {
ret i32 undef
}
__attribute__((__unused__)) unsigned char
psnip_builtin_subcb(unsigned char x, unsigned char y, unsigned char ci,
                    unsigned char *co) {
  unsigned char r = x - y;
  *co = x < y;
  if (ci) {
    r--;
    if (r == 0)
      *co = 1;
  }
  return r;
}


x86 assembly (clang, -O0):
<psnip_builtin_subcb>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%dl
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
mov    %dl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    %rcx,-0x10(%rbp)
movzbl -0x1(%rbp),%eax
movzbl -0x2(%rbp),%ecx
sub    %ecx,%eax
mov    %al,-0x11(%rbp)
movzbl -0x1(%rbp),%eax
movzbl -0x2(%rbp),%ecx
cmp    %ecx,%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
cmpb   $0x0,-0x3(%rbp)
je     116c <psnip_builtin_subcb+0x6c>
mov    -0x11(%rbp),%al
add    $0xff,%al
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
cmp    $0x0,%eax
jne    1167 <psnip_builtin_subcb+0x67>
mov    -0x10(%rbp),%rax
movb   $0x1,(%rax)
jmp    116c <psnip_builtin_subcb+0x6c>
movzbl -0x11(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<psnip_builtin_subcb>:
mov    %edi,%eax
sub    %sil,%al
setb   (%rcx)
test   %edx,%edx
je     1110 <psnip_builtin_subcb+0x10>
add    $0xff,%al
je     1111 <psnip_builtin_subcb+0x11>
ret
movb   $0x1,(%rcx)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define zeroext i8 @psnip_builtin_subcb(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2, i8* nocapture writeonly %3) {
%5 = sub i8 %0, %1
%6 = icmp ult i8 %0, %1
%7 = zext i1 %6 to i8
store i8 %7, i8* %3
%8 = icmp eq i8 %2, 0
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = add i8 %5, -1
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %9
store i8 1, i8* %3
br label %13
13: ; preds = %9, %12, %4
%14 = phi i8 [ 0, %12 ], [ %10, %9 ], [ %5, %4 ]
ret i8 %14
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ sys_write(int, char *, int);
int main(int argc, char *argv[]) {
  char str[] = "Hello World\n";
  sys_write(1, "Bye\n", 4);
  sys_write(1, str, 4);
  puts(str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x1d(%rbp)
mov    0xec1(%rip),%eax
mov    %eax,-0x15(%rbp)
mov    0xebc(%rip),%al
mov    %al,-0x11(%rbp)
mov    $0x1,%edi
lea    0xeae(%rip),%rsi
mov    $0x4,%edx
call   1040 <sys_write@plt>
lea    -0x1d(%rbp),%rsi
mov    $0x1,%edi
mov    $0x4,%edx
call   1040 <sys_write@plt>
lea    -0x1d(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0xa646c726f5720,%rax
mov    %rax,0x5(%rsp)
movabs $0x6f57206f6c6c6548,%rax
20 57 6f
mov    %rax,(%rsp)
lea    0xec4(%rip),%rsi
mov    $0x1,%edi
mov    $0x4,%edx
call   1040 <sys_write@plt>
mov    %rsp,%rbx
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1040 <sys_write@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str = [13 x i8] c"Hello World\0A\00"
@.str = [5 x i8] c"Bye\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [13 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [13 x i8]* %6 to i8*
%8 = call i32 @sys_write(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%9 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%10 = call i32 @sys_write(i32 1, i8* %9, i32 4)
%11 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%12 = call i32 @puts(i8* %11)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [13 x i8] c"Hello World\0A\00"
@.str = [5 x i8] c"Bye\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [13 x i8]
%4 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @sys_write(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%6 = call i32 @sys_write(i32 1, i8* %4, i32 4)
%7 = call i32 @puts(i8* %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ _message(char const *, int /*<<< orphan*/,
                            int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void message(const char *msg) { _message(msg, 0, stdout); }


x86 assembly (clang, -O0):
<message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb9(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <_message@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<message>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
jmp    1030 <_message@plt>

LLVM IR (-O0):
@stdout = global i32 0
define void @message(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @stdout
%5 = call i32 @_message(i8* %3, i32 0, i32 %4)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @message(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @_message(i8* %0, i32 0, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, int);
int main() {
  char Symbol = 0;
  int SymbolNumb = 0;
  while (SymbolNumb <= 255) {
    printf("%c - %d\n", Symbol, SymbolNumb);
    Symbol++;
    SymbolNumb++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xff,-0xc(%rbp)
jg     1162 <main+0x52>
mov    -0x5(%rbp),%al
mov    -0xc(%rbp),%edx
lea    0xebc(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
mov    -0x5(%rbp),%al
add    $0x1,%al
mov    %al,-0x5(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <main+0x1a>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xee3(%rip),%r14
nopl   (%rax)
movsbl %bl,%esi
mov    %r14,%rdi
mov    %ebx,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x100,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%c - %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
store i8 0, i8* %2
store i32 0, i32* %3
br label %4
4: ; preds = %7, %0
%5 = load i32, i32* %3
%6 = icmp sle i32 %5, 255
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i8, i8* %2
%9 = load i32, i32* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 signext %8, i32 %9)
%11 = load i8, i8* %2
%12 = add i8 %11, 1
store i8 %12, i8* %2
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%c - %d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %5, %1 ]
%3 = trunc i32 %2 to i8
%4 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 signext %3, i32 %2)
%5 = add nuw nsw i32 %2, 1
%6 = icmp eq i32 %5, 256
br i1 %6, label %7, label %1
7: ; preds = %1
ret i32 0
}
void ubi_dbg_dump_stack(void) { return; }


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

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

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

LLVM IR (-O2):
define void @ubi_dbg_dump_stack() {
ret void
}
long shr(long a, int b) { return a >> b; }


x86 assembly (clang, -O0):
<shr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sar    %cl,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<shr>:
mov    %esi,%ecx
mov    %rdi,%rax
sar    %cl,%rax
ret

LLVM IR (-O0):
define i64 @shr(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = load i32, i32* %4
%7 = zext i32 %6 to i64
%8 = ashr i64 %5, %7
ret i64 %8
}

LLVM IR (-O2):
define i64 @shr(i64 %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = ashr i64 %0, %3
ret i64 %4
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ test_assert(int, char const *);
void test_assert_equal_uint64(uint64_t val1, uint64_t val2, const char *msg) {
  test_assert(val1 == val2, msg);
}


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

x86 assembly (clang, -O2):
<test_assert_equal_uint64>:
xor    %eax,%eax
cmp    %rsi,%rdi
sete   %al
mov    %eax,%edi
mov    %rdx,%rsi
jmp    1030 <test_assert@plt>

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

LLVM IR (-O2):
define void @test_assert_equal_uint64(i64 %0, i64 %1, i8* %2) {
%4 = icmp eq i64 %0, %1
%5 = zext i1 %4 to i32
%6 = tail call i32 @test_assert(i32 %5, i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ printf(char *, char const *);
void fatal(char const *in_message) {
  printf("fatal error: %s\n", in_message);
  abort();
}


x86 assembly (clang, -O0):
<fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<fatal>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
@.str = [17 x i8] c"fatal error: %s\0A\00"
define void @fatal(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (...) @abort()
unreachable
}
/* Type definitions */
struct memfile {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct memfile *);
void close_cb(void *backend) {
  struct memfile *fp = backend;
  free(fp);
}


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

x86 assembly (clang, -O2):
<close_cb>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.memfile = type { i32 }
define void @close_cb(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.memfile*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to %struct.memfile*
store %struct.memfile* %5, %struct.memfile** %3
%6 = load %struct.memfile*, %struct.memfile** %3
%7 = call i32 @free(%struct.memfile* %6)
ret void
}

LLVM IR (-O2):
%struct.memfile = type { i32 }
define void @close_cb(i8* nocapture %0) {
%2 = bitcast i8* %0 to %struct.memfile*
%3 = tail call i32 @free(%struct.memfile* %2)
ret void
}
/* Variables and functions */
int c;
int inportb(int);
int /*<<< orphan*/ outportb(int, int);
Jgetcursor() {
  register c;
  outportb(0x3d4, 0xe);
  c = inportb(0x3d5) << 8;
  outportb(0x3d4, 0xf);
  c |= inportb(0x3d5) & 0xff;
  return (c);
}


x86 assembly (clang, -O0):
<Jgetcursor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x3d4,%edi
mov    $0xe,%esi
call   1040 <outportb@plt>
mov    $0x3d5,%edi
call   1030 <inportb@plt>
shl    $0x8,%eax
mov    %eax,-0x4(%rbp)
mov    $0x3d4,%edi
mov    $0xf,%esi
call   1040 <outportb@plt>
mov    $0x3d5,%edi
call   1030 <inportb@plt>
and    $0xff,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Jgetcursor>:
push   %rbx
mov    $0x3d4,%edi
mov    $0xe,%esi
call   1040 <outportb@plt>
mov    $0x3d5,%edi
call   1030 <inportb@plt>
mov    %eax,%ebx
shl    $0x8,%ebx
mov    $0x3d4,%edi
mov    $0xf,%esi
call   1040 <outportb@plt>
mov    $0x3d5,%edi
call   1030 <inportb@plt>
movzbl %al,%eax
or     %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@c = global i32 0
define i32 @Jgetcursor() {
%1 = alloca i32
%2 = call i32 @outportb(i32 980, i32 14)
%3 = call i32 @inportb(i32 981)
%4 = shl i32 %3, 8
store i32 %4, i32* %1
%5 = call i32 @outportb(i32 980, i32 15)
%6 = call i32 @inportb(i32 981)
%7 = and i32 %6, 255
%8 = load i32, i32* %1
%9 = or i32 %8, %7
store i32 %9, i32* %1
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
@c = global i32 0
define i32 @Jgetcursor() {
%1 = tail call i32 @outportb(i32 980, i32 14)
%2 = tail call i32 @inportb(i32 981)
%3 = shl i32 %2, 8
%4 = tail call i32 @outportb(i32 980, i32 15)
%5 = tail call i32 @inportb(i32 981)
%6 = and i32 %5, 255
%7 = or i32 %6, %3
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, unsigned char);
void sprint_xrl_Rn(char *str, unsigned char n) {
  sprintf(str, "XRL   A, R%X                     ", n);
}


x86 assembly (clang, -O0):
<sprint_xrl_Rn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed3(%rip),%rsi
movzbl -0x9(%rbp),%edx
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sprint_xrl_Rn>:
mov    %esi,%edx
lea    0xee7(%rip),%rsi
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"XRL A, R%X \00"
define void @sprint_xrl_Rn(i8* %0, i8 zeroext %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 @sprintf(i8* %5, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 zeroext %6)
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"XRL A, R%X \00"
define void @sprint_xrl_Rn(i8* nocapture writeonly %0, i8 zeroext %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 zeroext %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int /*<<< orphan*/ gptp(char *, int);
void g_fd_set() { gptp("fd_set", sizeof(fd_set)); }


x86 assembly (clang, -O0):
<g_fd_set>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x4,%esi
call   1030 <gptp@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_fd_set>:
lea    0xee9(%rip),%rdi
mov    $0x4,%esi
jmp    1030 <gptp@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"fd_set\00"
define void @g_fd_set() {
%1 = call i32 @gptp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 4)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"fd_set\00"
define void @g_fd_set() {
%1 = tail call i32 @gptp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 4)
ret void
}
void LOS_EvbUartPrintf(char *fmt, ...) { return; }


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

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

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

LLVM IR (-O2):
define void @LOS_EvbUartPrintf(i8* nocapture %0, ...) {
ret void
}
int test_imm_5Bint8_mem(signed char *val) {
  return ((*val) & (0x5B << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_5Bint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0x5b,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_5Bint8_mem>:
testb  $0x5b,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_5Bint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 91
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void sercomm_drv_lock(unsigned long __attribute__((unused)) * flags) {}


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

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

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

LLVM IR (-O2):
define void @sercomm_drv_lock(i64* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int main(void) {
  int a;
  float b;
  int c = 2;
  a = 5;
  b = 19.00;
  printf("A soma de a e b é: %d\n", a + c);
  printf("Minha idade é %.2f\n", b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x10(%rbp)
movl   $0x5,-0x8(%rbp)
movss  0xecb(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
cvtsi2ss %eax,%xmm0
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
movss  0xee0(%rip),%xmm0
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
movss  0xed0(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"A soma de a e b \C3\A9: %d\0A\00"
@.str.1 = [21 x i8] c"Minha idade \C3\A9 %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca i32
store i32 0, i32* %1
store i32 2, i32* %4
store i32 5, i32* %2
store float 1.900000e+01, float* %3
%5 = load i32, i32* %2
%6 = load i32, i32* %4
%7 = add nsw i32 %5, %6
%8 = sitofp i32 %7 to float
%9 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), float %8)
%10 = load float, float* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), float %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"A soma de a e b \C3\A9: %d\0A\00"
@.str.1 = [21 x i8] c"Minha idade \C3\A9 %.2f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), float 7.000000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), float 1.900000e+01)
ret i32 0
}
/* Variables and functions */
int printf(char *, int, unsigned long);
int out(int n, unsigned long v) { return printf("%d: %lu\n", n, v); }


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

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

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

LLVM IR (-O2):
@.str = [9 x i8] c"%d: %lu\0A\00"
define i32 @out(i32 %0, i64 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %0, i64 %1)
ret i32 %3
}
void gtk_drag_dest_get_target_list() {}


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

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

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

LLVM IR (-O2):
define void @gtk_drag_dest_get_target_list() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ HplMcs51GeneralIOC__P13__toggle();
void ReverseGPIOP__1__In__toggle(void) { HplMcs51GeneralIOC__P13__toggle(); }


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

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

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

LLVM IR (-O2):
define void @ReverseGPIOP__1__In__toggle() {
%1 = tail call i32 (...) @HplMcs51GeneralIOC__P13__toggle()
ret void
}
/* Variables and functions */
char const *keystr_find_full(char const *, char const *, int /*<<< orphan*/ *,
                             char);
const char *keystr_find(const char *restrict map, const char *restrict key) {
  return keystr_find_full(map, key, NULL, ':');
}


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

x86 assembly (clang, -O2):
<keystr_find>:
xor    %edx,%edx
mov    $0x3a,%ecx
jmp    1030 <keystr_find_full@plt>

LLVM IR (-O0):
define i8* @keystr_find(i8* noalias %0, i8* noalias %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 i8* @keystr_find_full(i8* %5, i8* %6, i32* null, i8 signext 58)
ret i8* %7
}

LLVM IR (-O2):
define i8* @keystr_find(i8* noalias %0, i8* noalias %1) {
%3 = tail call i8* @keystr_find_full(i8* %0, i8* %1, i32* null, i8 signext 58)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ WINS_Init();
int /*<<< orphan*/ WINS_MyAddress();
int /*<<< orphan*/ WinPrint(char *, int /*<<< orphan*/);
int Net_Setup(void) {
  WINS_Init();
  WinPrint("my address is %s\n", WINS_MyAddress());
  return 1;
}


x86 assembly (clang, -O0):
<Net_Setup>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <WINS_Init@plt>
mov    $0x0,%al
call   1030 <WINS_MyAddress@plt>
mov    %eax,%esi
lea    0xeb5(%rip),%rdi
call   1050 <WinPrint@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Net_Setup>:
push   %rax
xor    %eax,%eax
call   1040 <WINS_Init@plt>
xor    %eax,%eax
call   1030 <WINS_MyAddress@plt>
lea    0xeba(%rip),%rdi
mov    %eax,%esi
call   1050 <WinPrint@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"my address is %s\0A\00"
define i32 @Net_Setup() {
%1 = call i32 (...) @WINS_Init()
%2 = call i32 (...) @WINS_MyAddress()
%3 = call i32 @WinPrint(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 1
}

LLVM IR (-O2):
@.str = [18 x i8] c"my address is %s\0A\00"
define i32 @Net_Setup() {
%1 = tail call i32 (...) @WINS_Init()
%2 = tail call i32 (...) @WINS_MyAddress()
%3 = tail call i32 @WinPrint(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 1
}
void fb_negation_point(int row, int column, unsigned char *fb, int column_max) {
  int i;
  unsigned char word;
  i = row / 8;
  word = *(fb + i * column_max + column);
  word ^= 0x1 << (row % 8);
  *(fb + i * column_max + column) = word;
}


x86 assembly (clang, -O0):
<fb_negation_point>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
imul   -0x14(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x19(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
movzbl -0x19(%rbp),%eax
xor    %ecx,%eax
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%dl
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
imul   -0x14(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
movslq -0x8(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fb_negation_point>:
lea    0x7(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
sar    $0x3,%eax
imul   %ecx,%eax
cltq
add    %rdx,%rax
and    $0x7,%dil
mov    $0x1,%edx
mov    %edi,%ecx
shl    %cl,%edx
movslq %esi,%rcx
xor    %dl,(%rcx,%rax,1)
ret

LLVM IR (-O0):
define void @fb_negation_point(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%11 = load i32, i32* %5
%12 = sdiv i32 %11, 8
store i32 %12, i32* %9
%13 = load i8*, i8** %7
%14 = load i32, i32* %9
%15 = load i32, i32* %8
%16 = mul nsw i32 %14, %15
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %13, i64 %17
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
store i8 %22, i8* %10
%23 = load i32, i32* %5
%24 = srem i32 %23, 8
%25 = shl i32 1, %24
%26 = load i8, i8* %10
%27 = zext i8 %26 to i32
%28 = xor i32 %27, %25
%29 = trunc i32 %28 to i8
store i8 %29, i8* %10
%30 = load i8, i8* %10
%31 = load i8*, i8** %7
%32 = load i32, i32* %9
%33 = load i32, i32* %8
%34 = mul nsw i32 %32, %33
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %31, i64 %35
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %36, i64 %38
store i8 %30, i8* %39
ret void
}

LLVM IR (-O2):
define void @fb_negation_point(i32 %0, i32 %1, i8* nocapture %2, i32 %3) {
%5 = sdiv i32 %0, 8
%6 = mul nsw i32 %5, %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %2, i64 %7
%9 = sext i32 %1 to i64
%10 = getelementptr inbounds i8, i8* %8, i64 %9
%11 = load i8, i8* %10
%12 = and i32 %0, 7
%13 = shl nuw nsw i32 1, %12
%14 = trunc i32 %13 to i8
%15 = xor i8 %11, %14
store i8 %15, i8* %10
ret void
}
void INT_Excep_MTU7_TGIU7(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_MTU7_TGIU7() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ swap(int *, int *);
int main(int argc, char **argv) {
  int a = 3, b = 5;
  swap(&a, &b);
  printf("%i %i\n", a, b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x3,-0x14(%rbp)
movl   $0x5,-0x18(%rbp)
lea    -0x14(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <swap@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x3,0x4(%rsp)
movl   $0x5,(%rsp)
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1040 <swap@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%i %i\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
store i32 3, i32* %3
%6 = bitcast i32* %4 to i8*
store i32 5, i32* %4
%7 = call i32 @swap(i32* %3, i32* %4)
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void alarm_handler(int signo) { printf("Timer hit!\n"); }


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"Timer hit!\0A\00"
define void @alarm_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [11 x i8] c"Timer hit!\00"
define void @alarm_handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct timeval {
  long tv_sec;
  scalar_t__ tv_usec;
};
struct event {
  int dummy;
};

/* Variables and functions */
int event_add(struct event *, struct timeval *);
int event_add_w_timeout(struct event *ev, long int seconds) {
  struct timeval timeout;
  timeout.tv_sec = seconds;
  timeout.tv_usec = 0;
  return event_add(ev, &timeout);
}


x86 assembly (clang, -O0):
<event_add_w_timeout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <event_add@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<event_add_w_timeout>:
sub    $0x18,%rsp
mov    %rsi,0x8(%rsp)
movq   $0x0,0x10(%rsp)
lea    0x8(%rsp),%rsi
call   1030 <event_add@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.event = type { i32 }
%struct.timeval = type { i64, i64 }
define i32 @event_add_w_timeout(%struct.event* %0, i64 %1) {
%3 = alloca %struct.event*
%4 = alloca i64
%5 = alloca %struct.timeval
store %struct.event* %0, %struct.event** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
store i64 %6, i64* %7
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 1
store i64 0, i64* %8
%9 = load %struct.event*, %struct.event** %3
%10 = call i32 @event_add(%struct.event* %9, %struct.timeval* %5)
ret i32 %10
}

LLVM IR (-O2):
%struct.event = type { i32 }
%struct.timeval = type { i64, i64 }
define i32 @event_add_w_timeout(%struct.event* %0, i64 %1) {
%3 = alloca %struct.timeval
%4 = bitcast %struct.timeval* %3 to i8*
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
store i64 %1, i64* %5
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
store i64 0, i64* %6
%7 = call i32 @event_add(%struct.event* %0, %struct.timeval* %3)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "Usage: sulogin [-e] [-p] [-t timeout] [tty device]\n\r");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [53 x i8] c"Usage: sulogin [-e] [-p] [-t timeout] [tty device]\0A\0D\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [53 x i8] c"Usage: sulogin [-e] [-p] [-t timeout] [tty device]\0A\0D\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t fib8(uint8_t lfsr) {
  uint8_t bit = ((lfsr >> 0) ^ (lfsr >> 2) ^ (lfsr >> 3) ^ (lfsr >> 4) ^ 1);
  return (lfsr >> 1) | (bit << 7);
}


x86 assembly (clang, -O0):
<fib8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x0,%eax
mov    -0x4(%rbp),%ecx
sar    $0x2,%ecx
xor    %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0x3,%ecx
xor    %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0x4,%ecx
xor    %ecx,%eax
xor    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    -0x8(%rbp),%ecx
shl    $0x7,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib8>:
mov    %edi,%ecx
shr    $0x2,%ecx
xor    %edi,%ecx
mov    %edi,%edx
shr    $0x3,%edx
mov    %edi,%eax
shr    $0x4,%eax
xor    %edx,%eax
xor    %ecx,%eax
sar    %edi
xor    $0x1,%eax
shl    $0x7,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @fib8(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 0
%6 = load i32, i32* %2
%7 = ashr i32 %6, 2
%8 = xor i32 %5, %7
%9 = load i32, i32* %2
%10 = ashr i32 %9, 3
%11 = xor i32 %8, %10
%12 = load i32, i32* %2
%13 = ashr i32 %12, 4
%14 = xor i32 %11, %13
%15 = xor i32 %14, 1
store i32 %15, i32* %3
%16 = load i32, i32* %2
%17 = ashr i32 %16, 1
%18 = load i32, i32* %3
%19 = shl i32 %18, 7
%20 = or i32 %17, %19
ret i32 %20
}

LLVM IR (-O2):
define i32 @fib8(i32 %0) {
%2 = lshr i32 %0, 2
%3 = xor i32 %2, %0
%4 = lshr i32 %0, 3
%5 = xor i32 %3, %4
%6 = lshr i32 %0, 4
%7 = xor i32 %5, %6
%8 = ashr i32 %0, 1
%9 = shl i32 %7, 7
%10 = xor i32 %9, 128
%11 = or i32 %10, %8
ret i32 %11
}
void Initialize(void) { *(volatile unsigned int *)0xE01FC100 = 0x1; }


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

x86 assembly (clang, -O2):
<Initialize>:
mov    $0xe01fc100,%eax
movl   $0x1,(%rax)
ret

LLVM IR (-O0):
define void @Initialize() {
store volatile i32 1, i32* inttoptr (i64 3760177408 to i32*)
ret void
}

LLVM IR (-O2):
define void @Initialize() {
store volatile i32 1, i32* inttoptr (i64 3760177408 to i32*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ matriz_mult();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void matrices() {
  int menu;
  printf("Elige una opcion del menu\n");
  printf("1.-Multiplicacion\n");
  scanf("%d", &menu);
  switch (menu) {
  case 1:
    matriz_mult();
    break;
  }
}


x86 assembly (clang, -O0):
<matrices>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
lea    0xed0(%rip),%rdi
call   1040 <printf@plt>
lea    0xed7(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
jne    1178 <matrices+0x48>
jmp    1171 <matrices+0x41>
mov    $0x0,%al
call   1030 <matriz_mult@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matrices>:
push   %rax
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x1,0x4(%rsp)
jne    1168 <matrices+0x38>
xor    %eax,%eax
call   1040 <matriz_mult@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Elige una opcion del menu\0A\00"
@.str.1 = [19 x i8] c"1.-Multiplicacion\0A\00"
@.str.2 = [3 x i8] c"%d\00"
define void @matrices() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
switch i32 %5, label %8 [
i32 1, label %6
]
6: ; preds = %0
%7 = call i32 (...) @matriz_mult()
br label %8
8: ; preds = %0, %6
ret void
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"%d\00"
@str = [26 x i8] c"Elige una opcion del menu\00"
@str.3 = [18 x i8] c"1.-Multiplicacion\00"
define void @matrices() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.3, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (...) @matriz_mult()
br label %10
10: ; preds = %0, %8
ret void
}
long long f(long long b) {
  int c = b;
  return c;
}


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

x86 assembly (clang, -O2):
<f>:
movslq %edi,%rax
ret

LLVM IR (-O0):
define i64 @f(i64 %0) {
%2 = alloca i64
%3 = alloca i32
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = trunc i64 %4 to i32
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
ret i64 %7
}

LLVM IR (-O2):
define i64 @f(i64 %0) {
%2 = shl i64 %0, 32
%3 = ashr exact i64 %2, 32
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ emulate_pos();
int /*<<< orphan*/ push_int(int /*<<< orphan*/);
void fn_pos(void) { push_int(emulate_pos()); }


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

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

LLVM IR (-O0):
define void @fn_pos() {
%1 = call i32 (...) @emulate_pos()
%2 = call i32 @push_int(i32 %1)
ret void
}

LLVM IR (-O2):
define void @fn_pos() {
%1 = tail call i32 (...) @emulate_pos()
%2 = tail call i32 @push_int(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stdout;
void default_debug(const char *msg) { fprintf(stdout, "%s\n", msg); }


x86 assembly (clang, -O0):
<default_debug>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<default_debug>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stdout = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @default_debug(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int32_t is_number(char c) { return c >= '0' && c <= '9'; }


x86 assembly (clang, -O0):
<is_number>:
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 <is_number+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):
<is_number>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @is_number(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 @is_number(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Console_Char(int);
void Console_Ln(void) { Console_Char(0x0a); }


x86 assembly (clang, -O0):
<Console_Ln>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
call   1030 <Console_Char@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Console_Ln>:
mov    $0xa,%edi
jmp    1030 <Console_Char@plt>

LLVM IR (-O0):
define void @Console_Ln() {
%1 = call i32 @Console_Char(i32 10)
ret void
}

LLVM IR (-O2):
define void @Console_Ln() {
%1 = tail call i32 @Console_Char(i32 10)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ a_or(int *, int /*<<< orphan*/);
void a_or_64(volatile uint64_t *p, uint64_t v) {
  union {
    uint64_t v;
    uint32_t r[2];
  } u = {v};
  a_or((int *)p, u.r[0]);
  a_or((int *)p + 1, u.r[1]);
}


x86 assembly (clang, -O0):
<a_or_64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1030 <a_or@plt>
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
mov    -0x14(%rbp),%esi
call   1030 <a_or@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_or_64>:
push   %rbx
mov    %rdi,%rbx
call   1030 <a_or@plt>
add    $0x4,%rbx
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <a_or@plt>

LLVM IR (-O0):
%union.anon = type { [2 x i32] }
define void @a_or_64(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca %union.anon
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = bitcast %union.anon* %5 to i32*
%7 = load i32, i32* %4
store i32 %7, i32* %6
%8 = load i32*, i32** %3
%9 = bitcast %union.anon* %5 to [2 x i32]*
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%11 = load i32, i32* %10
%12 = call i32 @a_or(i32* %8, i32 %11)
%13 = load i32*, i32** %3
%14 = getelementptr inbounds i32, i32* %13, i64 1
%15 = bitcast %union.anon* %5 to [2 x i32]*
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %15, i64 0, i64 1
%17 = load i32, i32* %16
%18 = call i32 @a_or(i32* %14, i32 %17)
ret void
}

LLVM IR (-O2):
define void @a_or_64(i32* %0, i32 %1) {
%3 = tail call i32 @a_or(i32* %0, i32 %1)
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = tail call i32 @a_or(i32* %4, i32 undef)
ret void
}