xunge/DecIR huggingface dataset:
/* Variables and functions */
int touch(char *);
main(int argc, char *argv[]) {
  int i, err = 0;
  for (i = 1; --argc; ++i)
    err |= touch(argv[i]);
  return err;
}


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   $0x0,-0x18(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     116b <main+0x5b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <touch@plt>
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1134 <main+0x24>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x1,%edi
je     1146 <main+0x36>
mov    %rsi,%r14
mov    %edi,%r15d
xor    %ebp,%ebp
mov    $0x1,%ebx
nopl   0x0(%rax)
mov    (%r14,%rbx,8),%rdi
call   1030 <touch@plt>
or     %eax,%ebp
add    $0x1,%rbx
cmp    %ebx,%r15d
jne    1130 <main+0x20>
jmp    1148 <main+0x38>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
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 0, i32* %7
store i32 1, i32* %6
br label %8
8: ; preds = %21, %2
%9 = load i32, i32* %4
%10 = add nsw i32 %9, -1
store i32 %10, i32* %4
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %24
12: ; preds = %8
%13 = load i8**, i8*** %5
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = call i32 @touch(i8* %17)
%19 = load i32, i32* %7
%20 = or i32 %19, %18
store i32 %20, i32* %7
br label %21
21: ; preds = %12
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %6
br label %8
24: ; preds = %8
%25 = load i32, i32* %7
ret i32 %25
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = add nsw i32 %0, -1
%4 = icmp eq i32 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %13, %5 ], [ 1, %2 ]
%7 = phi i32 [ %14, %5 ], [ %3, %2 ]
%8 = phi i32 [ %12, %5 ], [ 0, %2 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %6
%10 = load i8*, i8** %9
%11 = tail call i32 @touch(i8* %10)
%12 = or i32 %11, %8
%13 = add nuw nsw i64 %6, 1
%14 = add nsw i32 %7, -1
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %2
%17 = phi i32 [ 0, %2 ], [ %12, %5 ]
ret i32 %17
}
void hi_mci_sys_ctrl_suspend(struct himci_host *host) {}


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

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

LLVM IR (-O0):
%struct.himci_host = type opaque
define void @hi_mci_sys_ctrl_suspend(%struct.himci_host* %0) {
%2 = alloca %struct.himci_host*
store %struct.himci_host* %0, %struct.himci_host** %2
ret void
}

LLVM IR (-O2):
%struct.himci_host = type opaque
define void @hi_mci_sys_ctrl_suspend(%struct.himci_host* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int num;
  printf("Digite um numero: ");
  scanf("%d", &num);
  if (num >= 0)
    printf("O numero entrado eh positivo.\n");
  else
    printf("O numero entrado eh negativo.\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x4(%rbp)
jl     115f <main+0x3f>
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
jmp    116b <main+0x4b>
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
lea    0xecf(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
lea    0xeda(%rip),%rax
lea    0xeb5(%rip),%rdi
cmovns %rax,%rdi
call   1030 <puts@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Digite um numero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [31 x i8] c"O numero entrado eh positivo.\0A\00"
@.str.3 = [31 x i8] c"O numero entrado eh negativo.\0A\00"
define void @main() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp sge i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
br label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %10
10: ; preds = %8, %6
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"Digite um numero: \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [30 x i8] c"O numero entrado eh negativo.\00"
@str.4 = [30 x i8] c"O numero entrado eh positivo.\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, -1
%7 = select i1 %6, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0)
%8 = call i32 @puts(i8* dereferenceable(1) %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cpuid_m(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ outb(int, unsigned char);
void set_cur_pos(unsigned char col, unsigned char row) {
  unsigned short pos = (row * 80) + col;
  outb(0x3D4, 0x0F);
  outb(0x3D5, (unsigned char)(pos & 0xFF));
  outb(0x3D4, 0x0E);
  outb(0x3D5, (unsigned char)((pos >> 8) & 0xFF));
  cpuid_m(0, 0);
}


x86 assembly (clang, -O0):
<set_cur_pos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
imul   $0x50,%eax,%eax
movzbl -0x1(%rbp),%ecx
add    %ecx,%eax
mov    %ax,-0x4(%rbp)
mov    $0x3d4,%edi
mov    $0xf,%esi
call   1030 <outb@plt>
movzwl -0x4(%rbp),%eax
and    $0xff,%eax
mov    $0x3d5,%edi
movzbl %al,%esi
call   1030 <outb@plt>
mov    $0x3d4,%edi
mov    $0xe,%esi
call   1030 <outb@plt>
movzwl -0x4(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    $0x3d5,%edi
movzbl %al,%esi
call   1030 <outb@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1040 <cpuid_m@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_cur_pos>:
push   %rbx
lea    (%rsi,%rsi,4),%ebx
shl    $0x4,%ebx
add    %edi,%ebx
mov    $0x3d4,%edi
mov    $0xf,%esi
call   1030 <outb@plt>
movzbl %bl,%esi
mov    $0x3d5,%edi
call   1030 <outb@plt>
mov    $0x3d4,%edi
mov    $0xe,%esi
call   1030 <outb@plt>
shr    $0x8,%ebx
mov    $0x3d5,%edi
mov    %ebx,%esi
call   1030 <outb@plt>
xor    %edi,%edi
xor    %esi,%esi
pop    %rbx
jmp    1040 <cpuid_m@plt>

LLVM IR (-O0):
define void @set_cur_pos(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i16
store i8 %0, i8* %3
store i8 %1, i8* %4
%6 = load i8, i8* %4
%7 = zext i8 %6 to i32
%8 = mul nsw i32 %7, 80
%9 = load i8, i8* %3
%10 = zext i8 %9 to i32
%11 = add nsw i32 %8, %10
%12 = trunc i32 %11 to i16
store i16 %12, i16* %5
%13 = call i32 @outb(i32 980, i8 zeroext 15)
%14 = load i16, i16* %5
%15 = zext i16 %14 to i32
%16 = and i32 %15, 255
%17 = trunc i32 %16 to i8
%18 = call i32 @outb(i32 981, i8 zeroext %17)
%19 = call i32 @outb(i32 980, i8 zeroext 14)
%20 = load i16, i16* %5
%21 = zext i16 %20 to i32
%22 = ashr i32 %21, 8
%23 = and i32 %22, 255
%24 = trunc i32 %23 to i8
%25 = call i32 @outb(i32 981, i8 zeroext %24)
%26 = call i32 @cpuid_m(i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @set_cur_pos(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %1 to i32
%4 = mul nuw nsw i32 %3, 80
%5 = zext i8 %0 to i32
%6 = add nuw nsw i32 %4, %5
%7 = tail call i32 @outb(i32 980, i8 zeroext 15)
%8 = trunc i32 %6 to i8
%9 = tail call i32 @outb(i32 981, i8 zeroext %8)
%10 = tail call i32 @outb(i32 980, i8 zeroext 14)
%11 = lshr i32 %6, 8
%12 = trunc i32 %11 to i8
%13 = tail call i32 @outb(i32 981, i8 zeroext %12)
%14 = tail call i32 @cpuid_m(i32 0, i32 0)
ret void
}
int i2m(int i) {
  int m;
  m = (i + 1) / 2;
  if ((i & 1) == 0)
    m = -m;
  return m;
}


x86 assembly (clang, -O0):
<i2m>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    112f <i2m+0x2f>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2m>:
lea    0x1(%rdi),%eax
shr    $0x1f,%eax
lea    (%rdi,%rax,1),%ecx
add    $0x1,%ecx
sar    %ecx
mov    %ecx,%eax
neg    %eax
test   $0x1,%dil
cmovne %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @i2m(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = sdiv i32 %2, 2
%4 = and i32 %0, 1
%5 = icmp eq i32 %4, 0
%6 = sub nsw i32 0, %3
%7 = select i1 %5, i32 %6, i32 %3
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ libtest_args_none();
int /*<<< orphan*/ libtest_args_real(int /*<<< orphan*/, char *, char *,
                                     int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
extern void test(void) {
  libtest_args_none();
  libtest_args_real(stderr, "slug", "", NULL);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <libtest_args_none@plt>
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
lea    0xec2(%rip),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <libtest_args_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
xor    %eax,%eax
call   1040 <libtest_args_none@plt>
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
lea    0xec8(%rip),%rsi
lea    0xec5(%rip),%rdx
xor    %ecx,%ecx
pop    %rax
jmp    1030 <libtest_args_real@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [5 x i8] c"slug\00"
@.str.1 = [1 x i8] zeroinitializer
define void @test() {
%1 = call i32 (...) @libtest_args_none()
%2 = load i32, i32* @stderr
%3 = call i32 @libtest_args_real(i32 %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i32* null)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [5 x i8] c"slug\00"
@.str.1 = [1 x i8] zeroinitializer
define void @test() {
%1 = tail call i32 (...) @libtest_args_none()
%2 = load i32, i32* @stderr
%3 = tail call i32 @libtest_args_real(i32 %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i32* null)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ glutPostRedisplay();
int /*<<< orphan*/ help();
void key(unsigned char key, int x, int y) {
  switch (key) {
  case 'h':
    help();
    break;
  case '\033':
    exit(EXIT_SUCCESS);
    break;
  default:
    break;
  }
  glutPostRedisplay();
}


x86 assembly (clang, -O0):
<key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movzbl -0x1(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1b,%eax
je     1176 <key+0x46>
jmp    1159 <key+0x29>
mov    -0x10(%rbp),%eax
sub    $0x68,%eax
jne    1184 <key+0x54>
jmp    116a <key+0x3a>
mov    $0x0,%al
call   1040 <help@plt>
jmp    1189 <key+0x59>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
jmp    1189 <key+0x59>
mov    $0x0,%al
call   1030 <glutPostRedisplay@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<key>:
push   %rax
cmp    $0x68,%dil
je     114b <key+0x1b>
cmp    $0x1b,%dil
jne    1152 <key+0x22>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1040 <help@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <glutPostRedisplay@plt>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define void @key(i8 zeroext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
switch i32 %8, label %14 [
i32 104, label %9
i32 27, label %11
]
9: ; preds = %3
%10 = call i32 (...) @help()
br label %15
11: ; preds = %3
%12 = load i32, i32* @EXIT_SUCCESS
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %3
br label %15
15: ; preds = %14, %9
%16 = call i32 (...) @glutPostRedisplay()
ret void
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define void @key(i8 zeroext %0, i32 %1, i32 %2) {
switch i8 %0, label %9 [
i8 104, label %4
i8 27, label %6
]
4: ; preds = %3
%5 = tail call i32 (...) @help()
br label %9
6: ; preds = %3
%7 = load i32, i32* @EXIT_SUCCESS
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %3, %4
%10 = tail call i32 (...) @glutPostRedisplay()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void help(const char *program) {
  printf("usage:\n-d run [%s] in background\n-h show help\n", program);
}


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

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

LLVM IR (-O0):
@.str = [47 x i8] c"usage:\0A-d run [%s] in background\0A-h show help\0A\00"
define void @help(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [47 x i8] c"usage:\0A-d run [%s] in background\0A-h show help\0A\00"
define void @help(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
long long r10(void *x) { return *(long long *)(x + 32758); }


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

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

LLVM IR (-O0):
define i64 @r10(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr i8, i8* %3, i64 32758
%5 = bitcast i8* %4 to i64*
%6 = load i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @r10(i8* nocapture %0) {
%2 = getelementptr i8, i8* %0, i64 32758
%3 = bitcast i8* %2 to i64*
%4 = load i64, i64* %3
ret i64 %4
}
void __attribute__((weak)) tim5_isr() { debug_handler(__FUNCTION__); }


x86 assembly (clang, -O0):
<tim5_isr>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <debug_handler@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<tim5_isr>:
lea    0xee9(%rip),%rdi
xor    %eax,%eax
jmp    1030 <debug_handler@plt>

LLVM IR (-O0):
@__FUNCTION__.tim5_isr = [9 x i8] c"tim5_isr\00"
define weak void @tim5_isr() {
%1 = call i32 (i8*, ...) bitcast (i32 (...)* @debug_handler to i32 (i8*, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__FUNCTION__.tim5_isr, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__FUNCTION__.tim5_isr = [9 x i8] c"tim5_isr\00"
define weak void @tim5_isr() {
%1 = tail call i32 (i8*, ...) bitcast (i32 (...)* @debug_handler to i32 (i8*, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__FUNCTION__.tim5_isr, i64 0, i64 0))
ret void
}
/* Variables and functions */
double sqrt(int);
double magnitude(int r, int i) { return sqrt(r * r + i * i); }


x86 assembly (clang, -O0):
<magnitude>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
imul   -0x4(%rbp),%edi
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
add    %eax,%edi
call   1030 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<magnitude>:
imul   %edi,%edi
imul   %esi,%esi
add    %esi,%edi
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @magnitude(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* %3
%7 = mul nsw i32 %5, %6
%8 = load i32, i32* %4
%9 = load i32, i32* %4
%10 = mul nsw i32 %8, %9
%11 = add nsw i32 %7, %10
%12 = call double @sqrt(i32 %11)
ret double %12
}

LLVM IR (-O2):
define double @magnitude(i32 %0, i32 %1) {
%3 = mul nsw i32 %0, %0
%4 = mul nsw i32 %1, %1
%5 = add nuw nsw i32 %4, %3
%6 = tail call double @sqrt(i32 %5)
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ p16e_adc();
int /*<<< orphan*/ p16e_eeprom_2();
int /*<<< orphan*/ p16e_int_pin_2();
int /*<<< orphan*/ p16e_mssp();
int /*<<< orphan*/ p16e_pps_out();
int /*<<< orphan*/ p16e_tmr0_2();
int /*<<< orphan*/ p16e_tmr1();
int /*<<< orphan*/ p16e_tmr2();
int /*<<< orphan*/ p16e_wdt_3();
int /*<<< orphan*/ serial(int /*<<< orphan*/);
void PIC16F18324_periferic(void) {
  p16e_pps_out();
  p16e_mssp();
  p16e_adc();
  p16e_int_pin_2();
  p16e_tmr0_2();
  p16e_wdt_3();
  p16e_eeprom_2();
  p16e_tmr1();
  p16e_tmr2();
  serial(0);
}


x86 assembly (clang, -O0):
<PIC16F18324_periferic>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   10a0 <p16e_pps_out@plt>
mov    $0x0,%al
call   1040 <p16e_mssp@plt>
mov    $0x0,%al
call   1060 <p16e_adc@plt>
mov    $0x0,%al
call   1090 <p16e_int_pin_2@plt>
mov    $0x0,%al
call   1030 <p16e_tmr0_2@plt>
mov    $0x0,%al
call   10b0 <p16e_wdt_3@plt>
mov    $0x0,%al
call   1080 <p16e_eeprom_2@plt>
mov    $0x0,%al
call   10c0 <p16e_tmr1@plt>
mov    $0x0,%al
call   1070 <p16e_tmr2@plt>
xor    %edi,%edi
call   1050 <serial@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<PIC16F18324_periferic>:
push   %rax
xor    %eax,%eax
call   10a0 <p16e_pps_out@plt>
xor    %eax,%eax
call   1040 <p16e_mssp@plt>
xor    %eax,%eax
call   1060 <p16e_adc@plt>
xor    %eax,%eax
call   1090 <p16e_int_pin_2@plt>
xor    %eax,%eax
call   1030 <p16e_tmr0_2@plt>
xor    %eax,%eax
call   10b0 <p16e_wdt_3@plt>
xor    %eax,%eax
call   1080 <p16e_eeprom_2@plt>
xor    %eax,%eax
call   10c0 <p16e_tmr1@plt>
xor    %eax,%eax
call   1070 <p16e_tmr2@plt>
xor    %edi,%edi
pop    %rax
jmp    1050 <serial@plt>

LLVM IR (-O0):
define void @PIC16F18324_periferic() {
%1 = call i32 (...) @p16e_pps_out()
%2 = call i32 (...) @p16e_mssp()
%3 = call i32 (...) @p16e_adc()
%4 = call i32 (...) @p16e_int_pin_2()
%5 = call i32 (...) @p16e_tmr0_2()
%6 = call i32 (...) @p16e_wdt_3()
%7 = call i32 (...) @p16e_eeprom_2()
%8 = call i32 (...) @p16e_tmr1()
%9 = call i32 (...) @p16e_tmr2()
%10 = call i32 @serial(i32 0)
ret void
}

LLVM IR (-O2):
define void @PIC16F18324_periferic() {
%1 = tail call i32 (...) @p16e_pps_out()
%2 = tail call i32 (...) @p16e_mssp()
%3 = tail call i32 (...) @p16e_adc()
%4 = tail call i32 (...) @p16e_int_pin_2()
%5 = tail call i32 (...) @p16e_tmr0_2()
%6 = tail call i32 (...) @p16e_wdt_3()
%7 = tail call i32 (...) @p16e_eeprom_2()
%8 = tail call i32 (...) @p16e_tmr1()
%9 = tail call i32 (...) @p16e_tmr2()
%10 = tail call i32 @serial(i32 0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int fputs(char const *, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int Fputs(const char *s, FILE *stream) {
  int result;
  result = fputs(s, stream);
  if (result == EOF) {
    perror("(stdout)");
  }
  return (result);
}


x86 assembly (clang, -O0):
<Fputs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <fputs@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e9e(%rip),%rcx
cmp    (%rcx),%eax
jne    115e <Fputs+0x3e>
lea    0xea7(%rip),%rdi
call   1040 <perror@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fputs>:
push   %rbx
call   1030 <fputs@plt>
mov    %eax,%ebx
mov    0x2eb9(%rip),%rax
cmp    (%rax),%ebx
je     1137 <Fputs+0x17>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xec2(%rip),%rdi
call   1040 <perror@plt>
jmp    1133 <Fputs+0x13>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [9 x i8] c"(stdout)\00"
define i32 @Fputs(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
%6 = load i8*, i8** %3
%7 = load i32*, i32** %4
%8 = call i32 @fputs(i8* %6, i32* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = load i32, i32* @EOF
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %2
%15 = load i32, i32* %5
ret i32 %15
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [9 x i8] c"(stdout)\00"
define i32 @Fputs(i8* nocapture %0, i32* nocapture %1) {
%3 = tail call i32 @fputs(i8* %0, i32* %1)
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
scalar_t__ wMalloc(int);
scalar_t__ wPopNumber();
int /*<<< orphan*/ wPushString(char *);
void wBasHex() {
  int i;
  char *buffer = (char *)wMalloc(16);
  i = (int)wPopNumber();
  sprintf(buffer, "%x", i);
  wPushString(buffer);
}


x86 assembly (clang, -O0):
<wBasHex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x10,%edi
call   1040 <wMalloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <wPopNumber@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe92(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <wPushString@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wBasHex>:
push   %rbx
mov    $0x10,%edi
call   1040 <wMalloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <wPopNumber@plt>
lea    0xea4(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
call   1060 <sprintf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <wPushString@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%x\00"
define void @wBasHex() {
%1 = alloca i32
%2 = alloca i8*
%3 = call i64 @wMalloc(i32 16)
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %2
%5 = call i64 (...) @wPopNumber()
%6 = trunc i64 %5 to i32
store i32 %6, i32* %1
%7 = load i8*, i8** %2
%8 = load i32, i32* %1
%9 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i8*, i8** %2
%11 = call i32 @wPushString(i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%x\00"
define void @wBasHex() {
%1 = tail call i64 @wMalloc(i32 16)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i64 (...) @wPopNumber()
%4 = trunc i64 %3 to i32
%5 = tail call i32 @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call i32 @wPushString(i8* %2)
ret void
}
void wifi_rsp_hardware_io_port_write(
    const struct wifi_msg_hardware_io_port_write_rsp_t *msg) {}


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

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

LLVM IR (-O0):
%struct.wifi_msg_hardware_io_port_write_rsp_t = type opaque
define void @wifi_rsp_hardware_io_port_write(%struct.wifi_msg_hardware_io_port_write_rsp_t* %0) {
%2 = alloca %struct.wifi_msg_hardware_io_port_write_rsp_t*
store %struct.wifi_msg_hardware_io_port_write_rsp_t* %0, %struct.wifi_msg_hardware_io_port_write_rsp_t** %2
ret void
}

LLVM IR (-O2):
%struct.wifi_msg_hardware_io_port_write_rsp_t = type opaque
define void @wifi_rsp_hardware_io_port_write(%struct.wifi_msg_hardware_io_port_write_rsp_t* nocapture %0) {
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
void sprint_orl_to_direct(char *str, uint8_t direct) {
  sprintf(str,
          "ORL   "
          "0x%02X"
          ", A                   ",
          direct);
}


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

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

LLVM IR (-O0):
@.str = [35 x i8] c"ORL 0x%02X, A \00"
define void @sprint_orl_to_direct(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"ORL 0x%02X, A \00"
define void @sprint_orl_to_direct(i8* nocapture writeonly %0, i32 %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
const char *plugin_api_info_charset_internal_cb(const void *pointer, void *data,
                                                const char *info_name,
                                                const char *arguments) {
  (void)pointer;
  (void)data;
  (void)info_name;
  (void)arguments;
  return "UTF-8";
}


x86 assembly (clang, -O0):
<plugin_api_info_charset_internal_cb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    0xee5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<plugin_api_info_charset_internal_cb>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"UTF-8\00"
define i8* @plugin_api_info_charset_internal_cb(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i8*, i8** %7
%12 = load i8*, i8** %8
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"UTF-8\00"
define i8* @plugin_api_info_charset_internal_cb(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* nocapture readnone %3) {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
unsigned int sleep(delay)
unsigned int delay;
{ return (unsigned int)0; }


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

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

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

LLVM IR (-O2):
define i32 @sleep(i32 %0) {
ret i32 0
}
void dummy_open_window(int id, long x0, long y0, long width, long height,
                       char *title, long flag) {
  id = id;
  x0 = x0;
  y0 = y0;
  width = width;
  height = height;
  title = title;
  flag = flag;
}


x86 assembly (clang, -O0):
<dummy_open_window>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    0x10(%rbp),%rax
mov    %rax,0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @dummy_open_window(i32 %0, i64 %1, i64 %2, i64 %3, i64 %4, i8* %5, i64 %6) {
%8 = alloca i32
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i8*
%14 = alloca i64
store i32 %0, i32* %8
store i64 %1, i64* %9
store i64 %2, i64* %10
store i64 %3, i64* %11
store i64 %4, i64* %12
store i8* %5, i8** %13
store i64 %6, i64* %14
%15 = load i32, i32* %8
store i32 %15, i32* %8
%16 = load i64, i64* %9
store i64 %16, i64* %9
%17 = load i64, i64* %10
store i64 %17, i64* %10
%18 = load i64, i64* %11
store i64 %18, i64* %11
%19 = load i64, i64* %12
store i64 %19, i64* %12
%20 = load i8*, i8** %13
store i8* %20, i8** %13
%21 = load i64, i64* %14
store i64 %21, i64* %14
ret void
}

LLVM IR (-O2):
define void @dummy_open_window(i32 %0, i64 %1, i64 %2, i64 %3, i64 %4, i8* nocapture %5, i64 %6) {
ret void
}
double sum2(double *args) { return args[1] + args[0]; }


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

x86 assembly (clang, -O2):
<sum2>:
movsd  0x8(%rdi),%xmm0
addsd  (%rdi),%xmm0
ret

LLVM IR (-O0):
define double @sum2(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 1
%5 = load double, double* %4
%6 = load double*, double** %2
%7 = getelementptr inbounds double, double* %6, i64 0
%8 = load double, double* %7
%9 = fadd double %5, %8
ret double %9
}

LLVM IR (-O2):
define double @sum2(double* nocapture %0) {
%2 = getelementptr inbounds double, double* %0, i64 1
%3 = load double, double* %2
%4 = load double, double* %0
%5 = fadd double %3, %4
ret double %5
}
void func1(int a, int *b, char c) { *b = 100; }


x86 assembly (clang, -O0):
<func1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x64,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<func1>:
movl   $0x64,(%rsi)
ret

LLVM IR (-O0):
define void @func1(i32 %0, i32* %1, i8 signext %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i8
store i32 %0, i32* %4
store i32* %1, i32** %5
store i8 %2, i8* %6
%7 = load i32*, i32** %5
store i32 100, i32* %7
ret void
}

LLVM IR (-O2):
define void @func1(i32 %0, i32* nocapture writeonly %1, i8 signext %2) {
store i32 100, i32* %1
ret void
}
/* Variables and functions */
scalar_t__ cos(double);
float my_cosf(float x) { return (float)cos((double)x); }


x86 assembly (clang, -O0):
<my_cosf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <cos@plt>
cvtsi2ss %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_cosf>:
push   %rax
cvtss2sd %xmm0,%xmm0
call   1030 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @my_cosf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = call i64 @cos(double %4)
%6 = sitofp i64 %5 to float
ret float %6
}

LLVM IR (-O2):
define float @my_cosf(float %0) {
%2 = fpext float %0 to double
%3 = tail call i64 @cos(double %2)
%4 = sitofp i64 %3 to float
ret float %4
}
int isprint(int c) { return ' ' <= c && c <= '~'; }


x86 assembly (clang, -O0):
<isprint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    $0x20,%ecx
cmp    -0x4(%rbp),%ecx
mov    %al,-0x5(%rbp)
jg     1124 <isprint+0x24>
cmpl   $0x7e,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isprint>:
add    $0xffffffe0,%edi
xor    %eax,%eax
cmp    $0x5f,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @isprint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 32, %3
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 126
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @isprint(i32 %0) {
%2 = add i32 %0, -32
%3 = icmp ult i32 %2, 95
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ swab(unsigned char *, unsigned char *, int);
void yuv2yuy2(unsigned char *src, unsigned char *dest, int NumPixels) {
  swab(src, dest, NumPixels << 1);
}


x86 assembly (clang, -O0):
<yuv2yuy2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
shl    $0x1,%edx
call   1030 <swab@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yuv2yuy2>:
add    %edx,%edx
jmp    1030 <swab@plt>

LLVM IR (-O0):
define void @yuv2yuy2(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = shl i32 %9, 1
%11 = call i32 @swab(i8* %7, i8* %8, i32 %10)
ret void
}

LLVM IR (-O2):
define void @yuv2yuy2(i8* %0, i8* %1, i32 %2) {
%4 = shl i32 %2, 1
%5 = tail call i32 @swab(i8* %0, i8* %1, i32 %4)
ret void
}
void inetipForwarding(char *ipAddress, int family) { return; }


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

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

LLVM IR (-O0):
define void @inetipForwarding(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @inetipForwarding(i8* nocapture %0, i32 %1) {
ret void
}
/* Type definitions */
struct Stack {
  int dummy;
};
struct Integer {
  int dummy;
};

/* Variables and functions */
struct Integer *integer_copy(struct Stack *, struct Integer *);
int /*<<< orphan*/ integer_halve_in_place(struct Integer *);
struct Integer *integer_halve(struct Stack *output_stack, struct Integer *a) {
  struct Integer *out = integer_copy(output_stack, a);
  integer_halve_in_place(out);
  return out;
}


x86 assembly (clang, -O0):
<integer_halve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <integer_copy@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <integer_halve_in_place@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<integer_halve>:
push   %rbx
call   1040 <integer_copy@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <integer_halve_in_place@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.Stack = type { i32 }
%struct.Integer = type { i32 }
define %struct.Integer* @integer_halve(%struct.Stack* %0, %struct.Integer* %1) {
%3 = alloca %struct.Stack*
%4 = alloca %struct.Integer*
%5 = alloca %struct.Integer*
store %struct.Stack* %0, %struct.Stack** %3
store %struct.Integer* %1, %struct.Integer** %4
%6 = load %struct.Stack*, %struct.Stack** %3
%7 = load %struct.Integer*, %struct.Integer** %4
%8 = call %struct.Integer* @integer_copy(%struct.Stack* %6, %struct.Integer* %7)
store %struct.Integer* %8, %struct.Integer** %5
%9 = load %struct.Integer*, %struct.Integer** %5
%10 = call i32 @integer_halve_in_place(%struct.Integer* %9)
%11 = load %struct.Integer*, %struct.Integer** %5
ret %struct.Integer* %11
}

LLVM IR (-O2):
%struct.Stack = type { i32 }
%struct.Integer = type { i32 }
define %struct.Integer* @integer_halve(%struct.Stack* %0, %struct.Integer* %1) {
%3 = tail call %struct.Integer* @integer_copy(%struct.Stack* %0, %struct.Integer* %1)
%4 = tail call i32 @integer_halve_in_place(%struct.Integer* %3)
ret %struct.Integer* %3
}
/* Variables and functions */
float sqrtf(float);
float barf(float x) { return sqrtf(1.0f / x); }


x86 assembly (clang, -O0):
<barf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xedb(%rip),%xmm0
divss  -0x4(%rbp),%xmm0
call   1030 <sqrtf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<barf>:
movaps %xmm0,%xmm1
movss  0xee5(%rip),%xmm0
divss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     112c <barf+0x1c>
sqrtss %xmm0,%xmm0
ret
jmp    1030 <sqrtf@plt>

LLVM IR (-O0):
define float @barf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fdiv float 1.000000e+00, %3
%5 = call float @sqrtf(float %4)
ret float %5
}

LLVM IR (-O2):
define float @barf(float %0) {
%2 = fdiv float 1.000000e+00, %0
%3 = tail call float @sqrtf(float %2)
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ arm_memio_immdh_op();
int /*<<< orphan*/ arm_memio_ldrsb(int /*<<< orphan*/);
void arm_ldrsb_imm() { arm_memio_ldrsb(arm_memio_immdh_op()); }


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

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

LLVM IR (-O0):
define void @arm_ldrsb_imm() {
%1 = call i32 (...) @arm_memio_immdh_op()
%2 = call i32 @arm_memio_ldrsb(i32 %1)
ret void
}

LLVM IR (-O2):
define void @arm_ldrsb_imm() {
%1 = tail call i32 (...) @arm_memio_immdh_op()
%2 = tail call i32 @arm_memio_ldrsb(i32 %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ food;

/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int main() {
  char food[5];
  printf("Enter favorite food: ");
  fgets(food, sizeof(food), stdin);
  printf("Favorite food: %s\n", food);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x9(%rbp),%rdi
mov    0x2ea0(%rip),%rax
mov    (%rax),%edx
mov    $0x5,%esi
call   1040 <fgets@plt>
lea    -0x9(%rbp),%rsi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2eae(%rip),%rax
mov    (%rax),%edx
lea    0xb(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <fgets@plt>
lea    0xec1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Enter favorite food: \00"
@stdin = global i32 0
@.str.1 = [19 x i8] c"Favorite food: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %4, i32 5, i32 %5)
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Enter favorite food: \00"
@stdin = global i32 0
@.str.1 = [19 x i8] c"Favorite food: %s\0A\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %2, i32 5, i32 %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 0
}
int main(void) {
  int i;
  while (1) {
    i++;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    %eax,-0x8(%rbp)
jmp    110b <main+0xb>

x86 assembly (clang, -O2):
<main>:
jmp    1100 <main>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %0, %3
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1
store i32 %5, i32* %2
br label %3
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
br label %1
}
int fun426() { return 426; }


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

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

LLVM IR (-O0):
define i32 @fun426() {
ret i32 426
}

LLVM IR (-O2):
define i32 @fun426() {
ret i32 426
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void trc_2() { fprintf(stderr, "trc_2\n"); }


x86 assembly (clang, -O0):
<trc_2>:
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):
<trc_2>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [7 x i8] c"trc_2\0A\00"
define void @trc_2() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [7 x i8] c"trc_2\0A\00"
define void @trc_2() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_passing();
int main() {
  test_passing();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_passing()
ret i32 0
}
/* Type definitions */
struct ir_remote {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ clear_rec_buffer();
char *decode_all(struct ir_remote *);
int /*<<< orphan*/ default_deinit();
char *default_rec(struct ir_remote *remotes) {
  if (!clear_rec_buffer()) {
    default_deinit();
    return NULL;
  }
  return (decode_all(remotes));
}


x86 assembly (clang, -O0):
<default_rec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <clear_rec_buffer@plt>
cmp    $0x0,%eax
jne    1160 <default_rec+0x30>
mov    $0x0,%al
call   1040 <default_deinit@plt>
movq   $0x0,-0x8(%rbp)
jmp    116d <default_rec+0x3d>
mov    -0x10(%rbp),%rdi
call   1050 <decode_all@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<default_rec>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <clear_rec_buffer@plt>
test   %eax,%eax
je     1148 <default_rec+0x18>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <decode_all@plt>
xor    %eax,%eax
call   1040 <default_deinit@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.ir_remote = type { i32 }
define i8* @default_rec(%struct.ir_remote* %0) {
%2 = alloca i8*
%3 = alloca %struct.ir_remote*
store %struct.ir_remote* %0, %struct.ir_remote** %3
%4 = call i32 (...) @clear_rec_buffer()
%5 = icmp ne i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i32 (...) @default_deinit()
store i8* null, i8** %2
br label %11
8: ; preds = %1
%9 = load %struct.ir_remote*, %struct.ir_remote** %3
%10 = call i8* @decode_all(%struct.ir_remote* %9)
store i8* %10, i8** %2
br label %11
11: ; preds = %8, %6
%12 = load i8*, i8** %2
ret i8* %12
}

LLVM IR (-O2):
%struct.ir_remote = type { i32 }
define i8* @default_rec(%struct.ir_remote* %0) {
%2 = tail call i32 (...) @clear_rec_buffer()
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @default_deinit()
br label %8
6: ; preds = %1
%7 = tail call i8* @decode_all(%struct.ir_remote* %0)
br label %8
8: ; preds = %6, %4
%9 = phi i8* [ %7, %6 ], [ null, %4 ]
ret i8* %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned char);
int main() {
  unsigned char c = 31;
  printf("c: %u\n", c);
  c = c & ~0x7;
  printf("c: %u\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x1f,-0x5(%rbp)
lea    0xed6(%rip),%rdi
movzbl -0x5(%rbp),%esi
call   1030 <printf@plt>
movzbl -0x5(%rbp),%eax
and    $0xfffffff8,%eax
mov    %al,-0x5(%rbp)
lea    0xebc(%rip),%rdi
movzbl -0x5(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1f,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x18,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"c: %u\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 zeroext 31)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 zeroext 24)
ret i32 0
}
int snd_pcm_hw_constraint_list(struct snd_pcm_runtime *run, int var1, int var2,
                               const void *ptr) {
  return 0;
}


x86 assembly (clang, -O0):
<snd_pcm_hw_constraint_list>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.snd_pcm_runtime = type opaque
define i32 @snd_pcm_hw_constraint_list(%struct.snd_pcm_runtime* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca %struct.snd_pcm_runtime*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store %struct.snd_pcm_runtime* %0, %struct.snd_pcm_runtime** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
ret i32 0
}

LLVM IR (-O2):
%struct.snd_pcm_runtime = type opaque
define i32 @snd_pcm_hw_constraint_list(%struct.snd_pcm_runtime* nocapture readnone %0, i32 %1, i32 %2, i8* nocapture readnone %3) {
ret i32 0
}
int MAX(int x, int y) { return x < y ? y : x; }


x86 assembly (clang, -O0):
<MAX>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1121 <MAX+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <MAX+0x27>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @MAX(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 = icmp slt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %4
br label %12
10: ; preds = %2
%11 = load i32, i32* %3
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @MAX(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}