xunge/DecIR huggingface dataset:
int compare_double(const void *a, const void *b) {
  return (*(const double *)a - *(const double *)b);
}


x86 assembly (clang, -O0):
<compare_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_double>:
movsd  (%rdi),%xmm0
subsd  (%rsi),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @compare_double(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to double*
%7 = load double, double* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to double*
%10 = load double, double* %9
%11 = fsub double %7, %10
%12 = fptosi double %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @compare_double(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fsub double %4, %6
%8 = fptosi double %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char, int);
int fun_call_align_4(int a, char b, int c) {
  printf("a = %d, b = %d, c = %d\n", a, b, c);
  return a + b + c;
}


x86 assembly (clang, -O0):
<fun_call_align_4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x5(%rbp),%al
mov    -0xc(%rbp),%ecx
lea    0xecc(%rip),%rdi
movsbl %al,%edx
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
movsbl -0x5(%rbp),%ecx
add    %ecx,%eax
add    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun_call_align_4>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xede(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
call   1030 <printf@plt>
add    %ebx,%ebp
add    %r14d,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"a = %d, b = %d, c = %d\0A\00"
define i32 @fun_call_align_4(i32 %0, i8 signext %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8
%6 = alloca i32
store i32 %0, i32* %4
store i8 %1, i8* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i8, i8* %5
%9 = load i32, i32* %6
%10 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %7, i8 signext %8, i32 %9)
%11 = load i32, i32* %4
%12 = load i8, i8* %5
%13 = sext i8 %12 to i32
%14 = add nsw i32 %11, %13
%15 = load i32, i32* %6
%16 = add nsw i32 %14, %15
ret i32 %16
}

LLVM IR (-O2):
@.str = [24 x i8] c"a = %d, b = %d, c = %d\0A\00"
define i32 @fun_call_align_4(i32 %0, i8 signext %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %0, i8 signext %1, i32 %2)
%5 = sext i8 %1 to i32
%6 = add nsw i32 %5, %0
%7 = add nsw i32 %6, %2
ret i32 %7
}
/* Variables and functions */
int strcmp(char const *const, char const *const);
int compare_by_string(const void *ap, const void *bp) {
  const char *const *a = ap;
  const char *const *b = bp;
  return strcmp(*a, *b);
}


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

x86 assembly (clang, -O2):
<compare_by_string>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @compare_by_string(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i8**
store i8** %8, i8*** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i8**
store i8** %10, i8*** %6
%11 = load i8**, i8*** %5
%12 = load i8*, i8** %11
%13 = load i8**, i8*** %6
%14 = load i8*, i8** %13
%15 = call i32 @strcmp(i8* %12, i8* %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @compare_by_string(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = bitcast i8* %1 to i8**
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(1) %6)
ret i32 %7
}
int endian(void) {
  int i = 1;
  char *p = (char *)&i;
  if (p[0] == 1)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<endian>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x1,%eax
jne    112f <endian+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    1136 <endian+0x36>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @endian() {
ret i32 0
}
int _is_multiop(c)
int c;
{
  switch (c) {
  case 1:
  case 2:
  case 3:
  case 4:
  case 7:
  case 8:
  case 9:
  case 10:
  case 11:
  case 12:
  case 13:
  case 14:
  case 15:
  case 16:
  case 17:
    return 1;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<_is_multiop>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xffffffff,%eax
sub    $0x4,%eax
jb     1132 <_is_multiop+0x32>
jmp    111e <_is_multiop+0x1e>
mov    -0xc(%rbp),%eax
add    $0xfffffff9,%eax
sub    $0xa,%eax
ja     113e <_is_multiop+0x3e>
jmp    1132 <_is_multiop+0x32>
movl   $0x1,-0x4(%rbp)
jmp    1145 <_is_multiop+0x45>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_is_multiop>:
add    $0xffffffff,%edi
xor    %eax,%eax
cmp    $0x10,%edi
ja     1117 <_is_multiop+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @_is_multiop(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 1, label %5
i32 2, label %5
i32 3, label %5
i32 4, label %5
i32 7, label %5
i32 8, label %5
i32 9, label %5
i32 10, label %5
i32 11, label %5
i32 12, label %5
i32 13, label %5
i32 14, label %5
i32 15, label %5
i32 16, label %5
i32 17, label %5
]
5: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
store i32 1, i32* %2
br label %7
6: ; preds = %1
store i32 0, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
@switch.table._is_multiop = [17 x i32] [i32 1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1]
define i32 @_is_multiop(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 17
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [17 x i32], [17 x i32]* @switch.table._is_multiop, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ 0, %1 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ foo(int);
int main(void) {
  if (foo(0))
    abort();
  if (foo(0x7c0000000000UL))
    abort();
  if (!foo(0xfc0000000000UL))
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1040 <foo@plt>
cmp    $0x0,%rax
je     1147 <main+0x27>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1040 <foo@plt>
cmp    $0x0,%rax
je     115f <main+0x3f>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1040 <foo@plt>
cmp    $0x0,%rax
jne    1177 <main+0x57>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1040 <foo@plt>
test   %rax,%rax
jne    1149 <main+0x29>
xor    %edi,%edi
call   1040 <foo@plt>
test   %rax,%rax
jne    1149 <main+0x29>
xor    %edi,%edi
call   1040 <foo@plt>
test   %rax,%rax
je     1149 <main+0x29>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @foo(i32 0)
%2 = icmp eq i64 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i64 @foo(i32 0)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %5
%11 = tail call i64 @foo(i32 0)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 (...) @abort()
unreachable
15: ; preds = %10
ret i32 0
}
/* Variables and functions */
int fcntl(int, int, long);
int fcntl_with_arg(int fd, int cmd, long arg) { return fcntl(fd, cmd, arg); }


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

x86 assembly (clang, -O2):
<fcntl_with_arg>:
jmp    1030 <fcntl@plt>

LLVM IR (-O0):
define i32 @fcntl_with_arg(i32 %0, i32 %1, i64 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
store i32 %0, i32* %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i64, i64* %6
%10 = call i32 @fcntl(i32 %7, i32 %8, i64 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @fcntl_with_arg(i32 %0, i32 %1, i64 %2) {
%4 = tail call i32 @fcntl(i32 %0, i32 %1, i64 %2)
ret i32 %4
}
void moo() {}


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

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

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

LLVM IR (-O2):
define void @moo() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
void default_irq_handler(void) { print("Unhandled IRQ.\n"); }


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"Unhandled IRQ.\0A\00"
define void @default_irq_handler() {
%1 = call i32 @print(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"Unhandled IRQ.\0A\00"
define void @default_irq_handler() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}
int nullPointerFunctionTest(void (*foo)()) {
  if (foo == 0) {
    return 42;
  } else {
    return 84;
  }
}


x86 assembly (clang, -O0):
<nullPointerFunctionTest>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    111f <nullPointerFunctionTest+0x1f>
movl   $0x2a,-0x4(%rbp)
jmp    1126 <nullPointerFunctionTest+0x26>
movl   $0x54,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nullPointerFunctionTest>:
test   %rdi,%rdi
mov    $0x2a,%ecx
mov    $0x54,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @nullPointerFunctionTest(void (...)* %0) {
%2 = alloca i32
%3 = alloca void (...)*
store void (...)* %0, void (...)** %3
%4 = load void (...)*, void (...)** %3
%5 = icmp eq void (...)* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 42, i32* %2
br label %8
7: ; preds = %1
store i32 84, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @nullPointerFunctionTest(void (...)* readnone %0) {
%2 = icmp eq void (...)* %0, null
%3 = select i1 %2, i32 42, i32 84
ret i32 %3
}
int pci_uevent(struct device *dev, char **envp, int num_envp, char *buffer,
               int buffer_size) {
  int a;
  return a;
}


x86 assembly (clang, -O0):
<pci_uevent>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x28(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.device = type opaque
define i32 @pci_uevent(%struct.device* %0, i8** %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca %struct.device*
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
store %struct.device* %0, %struct.device** %6
store i8** %1, i8*** %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%12 = load i32, i32* %11
ret i32 %12
}

LLVM IR (-O2):
%struct.device = type opaque
define i32 @pci_uevent(%struct.device* nocapture readnone %0, i8** nocapture readnone %1, i32 %2, i8* nocapture readnone %3, i32 %4) {
ret i32 undef
}
/* Variables and functions */
int rand();
int randint(int lo, int hi) { return lo + (rand() % (hi + 1 - lo)); }


x86 assembly (clang, -O0):
<randint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
sub    -0x4(%rbp),%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%eax
add    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randint>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
sub    %ebp,%ebx
add    $0x1,%ebx
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @randint(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 = call i32 (...) @rand()
%7 = load i32, i32* %4
%8 = add nsw i32 %7, 1
%9 = load i32, i32* %3
%10 = sub nsw i32 %8, %9
%11 = srem i32 %6, %10
%12 = add nsw i32 %5, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @randint(i32 %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = sub i32 1, %0
%5 = add i32 %4, %1
%6 = srem i32 %3, %5
%7 = add nsw i32 %6, %0
ret i32 %7
}
/* Variables and functions */
int strlen(char *s) {
  char *p = s;
  while (*p != '\0')
    p++;
  return s - p;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1131 <strlen+0x31>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <strlen+0x10>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpb   $0x0,(%rdi,%rcx,1)
lea    0x1(%rcx),%rcx
jne    1110 <strlen+0x10>
mov    $0x1,%eax
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %0 to i64
%9 = ptrtoint i8* %3 to i64
%10 = sub i64 %8, %9
%11 = trunc i64 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ tolower_arg1(char *);
int /*<<< orphan*/ tolower_stdin();
int main(int argc, char **argv) {
  if (argc > 1) {
    tolower_arg1(argv[1]);
  } else {
    tolower_stdin();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1152 <main+0x32>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <tolower_arg1@plt>
jmp    1159 <main+0x39>
mov    $0x0,%al
call   1030 <tolower_stdin@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jl     1131 <main+0x11>
mov    0x8(%rsi),%rdi
call   1040 <tolower_arg1@plt>
jmp    1138 <main+0x18>
xor    %eax,%eax
call   1030 <tolower_stdin@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @tolower_arg1(i8* %11)
br label %15
13: ; preds = %2
%14 = call i32 (...) @tolower_stdin()
br label %15
15: ; preds = %13, %8
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @tolower_arg1(i8* %6)
br label %10
8: ; preds = %2
%9 = tail call i32 (...) @tolower_stdin()
br label %10
10: ; preds = %8, %4
ret i32 0
}
const char *find_extension(const char *in) {
  const char *last_dot = in;
  const char *p = in;
  while (*p != '\0') {
    if (*p == '.')
      last_dot = p;
    p++;
  }
  return last_dot;
}


x86 assembly (clang, -O0):
<find_extension>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1151 <find_extension+0x51>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    1140 <find_extension+0x40>
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1118 <find_extension+0x18>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_extension>:
mov    %rdi,%rax
mov    %rdi,%rcx
jmp    1117 <find_extension+0x17>
nopl   0x0(%rax,%rax,1)
mov    %rcx,%rax
add    $0x1,%rcx
movzbl (%rcx),%edx
cmp    $0x2e,%dl
je     1110 <find_extension+0x10>
test   %dl,%dl
jne    1113 <find_extension+0x13>
ret

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

LLVM IR (-O2):
define i8* @find_extension(i8* %0) {
br label %2
2: ; preds = %7, %1
%3 = phi i8* [ %0, %1 ], [ %8, %7 ]
%4 = phi i8* [ %0, %1 ], [ %9, %7 ]
%5 = load i8, i8* %4
switch i8 %5, label %7 [
i8 0, label %10
i8 46, label %6
]
6: ; preds = %2
br label %7
7: ; preds = %2, %6
%8 = phi i8* [ %4, %6 ], [ %3, %2 ]
%9 = getelementptr inbounds i8, i8* %4, i64 1
br label %2
10: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ gethostname(char *, int);
scalar_t__ *strchr(char *, char);
char *strdup(char *);
char *hostname() {
  char s[1000];
  gethostname(s, 999);
  if (strchr(s, '.')) {
    *strchr(s, '.') = 0;
  }
  return strdup(s);
}


x86 assembly (clang, -O0):
<hostname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
lea    -0x3f0(%rbp),%rdi
mov    $0x3e7,%esi
call   1040 <gethostname@plt>
lea    -0x3f0(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     117f <hostname+0x4f>
lea    -0x3f0(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strchr@plt>
movq   $0x0,(%rax)
lea    -0x3f0(%rbp),%rdi
call   1050 <strdup@plt>
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hostname>:
push   %rbx
sub    $0x3f0,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x3e7,%esi
call   1040 <gethostname@plt>
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     116e <hostname+0x3e>
mov    %rsp,%rdi
mov    $0x2e,%esi
call   1030 <strchr@plt>
movq   $0x0,(%rax)
mov    %rsp,%rdi
call   1050 <strdup@plt>
add    $0x3f0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i8* @hostname() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = call i32 @gethostname(i8* %2, i32 999)
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%5 = call i64* @strchr(i8* %4, i8 signext 46)
%6 = icmp ne i64* %5, null
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%9 = call i64* @strchr(i8* %8, i8 signext 46)
store i64 0, i64* %9
br label %10
10: ; preds = %7, %0
%11 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%12 = call i8* @strdup(i8* %11)
ret i8* %12
}

LLVM IR (-O2):
define noalias i8* @hostname() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = call i32 @gethostname(i8* %2, i32 999)
%4 = call i64* @strchr(i8* %2, i8 signext 46)
%5 = icmp eq i64* %4, null
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i64* @strchr(i8* %2, i8 signext 46)
store i64 0, i64* %7
br label %8
8: ; preds = %6, %0
%9 = call i8* @strdup(i8* %2)
ret i8* %9
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fwrite(char const *, int, int, int /*<<< orphan*/ *);
void outputStartOfFile(FILE *o, const char *text, int len) {
  fwrite(text, len, 1, o);
}


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

x86 assembly (clang, -O2):
<outputStartOfFile>:
mov    %rdi,%rcx
mov    %rsi,%rdi
mov    %edx,%esi
mov    $0x1,%edx
jmp    1030 <fwrite@plt>

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

LLVM IR (-O2):
define void @outputStartOfFile(i32* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @fwrite(i8* %1, i32 %2, i32 1, i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ERANGE;
unsigned long ULONG_MAX;
int /*<<< orphan*/ errno;
unsigned long strtoull(char const *, char **, int);
unsigned long strtoul(const char *str, char **str_end, int base) {
  unsigned long out = strtoull(str, str_end, base);
  if (out > ULONG_MAX) {
    errno = ERANGE;
    return ULONG_MAX;
  };
  return out;
}


x86 assembly (clang, -O0):
<strtoul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <strtoull@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    0x2e86(%rip),%rcx
cmp    (%rcx),%rax
jbe    1170 <strtoul+0x60>
mov    0x2e96(%rip),%rax
mov    (%rax),%ecx
mov    0x2e7d(%rip),%rax
mov    %ecx,(%rax)
mov    0x2e64(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <strtoul+0x68>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtoul>:
push   %rax
call   1030 <strtoull@plt>
mov    0x2eab(%rip),%rcx
mov    (%rcx),%rcx
cmp    %rcx,%rax
jbe    113a <strtoul+0x2a>
mov    0x2ebc(%rip),%rax
mov    (%rax),%eax
mov    0x2ea3(%rip),%rdx
mov    %eax,(%rdx)
mov    %rcx,%rax
pop    %rcx
ret

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

LLVM IR (-O2):
@ULONG_MAX = global i64 0
@ERANGE = global i32 0
@errno = global i32 0
define i64 @strtoul(i8* %0, i8** nocapture %1, i32 %2) {
%4 = tail call i64 @strtoull(i8* %0, i8** %1, i32 %2)
%5 = load i64, i64* @ULONG_MAX
%6 = icmp ugt i64 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = load i32, i32* @ERANGE
store i32 %8, i32* @errno
br label %9
9: ; preds = %3, %7
%10 = phi i64 [ %5, %7 ], [ %4, %3 ]
ret i64 %10
}
/* Variables and functions */
int strlen(char *);
void ipify(char *ip) {
  int max = strlen(ip);
  int i;
  for (i = max - 1; i >= 0; i--) {
    if (ip[i] == '.') {
      ip[i] = '\0';
      return;
    }
  }
}


x86 assembly (clang, -O0):
<ipify>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     1174 <ipify+0x64>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    1161 <ipify+0x51>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1174 <ipify+0x64>
jmp    1166 <ipify+0x56>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1131 <ipify+0x21>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipify>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%eax
nopl   0x0(%rax,%rax,1)
test   %eax,%eax
jle    1138 <ipify+0x28>
lea    -0x1(%rax),%rcx
cmpb   $0x2e,-0x1(%rbx,%rax,1)
mov    %rcx,%rax
jne    1120 <ipify+0x10>
mov    %ecx,%eax
movb   $0x0,(%rbx,%rax,1)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @ipify(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = zext i32 %2 to i64
br label %4
4: ; preds = %9, %1
%5 = phi i64 [ %6, %9 ], [ %3, %1 ]
%6 = add nsw i64 %5, -1
%7 = trunc i64 %5 to i32
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %0, i64 %6
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 46
br i1 %12, label %13, label %4
13: ; preds = %9
%14 = and i64 %6, 4294967295
%15 = getelementptr inbounds i8, i8* %0, i64 %14
store i8 0, i8* %15
br label %16
16: ; preds = %4, %13
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AES_CMAC(unsigned char const *, unsigned char const *, int,
                            unsigned char *);
int memcmp(unsigned char const *, unsigned char *, int);
int AES_CMAC_CHECK(const unsigned char *key, const unsigned char *input,
                   int length, const unsigned char *mac) {
  unsigned char T[16];
  AES_CMAC(key, input, length, T);
  return memcmp(mac, T, 16);
}


x86 assembly (clang, -O0):
<AES_CMAC_CHECK>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    -0x30(%rbp),%rcx
call   1040 <AES_CMAC@plt>
mov    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x10,%edx
call   1030 <memcmp@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AES_CMAC_CHECK>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%rbx
mov    %rsp,%r14
mov    %r14,%rcx
call   1040 <AES_CMAC@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x10,%edx
call   1030 <memcmp@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @AES_CMAC_CHECK(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca [16 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = load i32, i32* %7
%13 = getelementptr inbounds [16 x i8], [16 x i8]* %9, i64 0, i64 0
%14 = call i32 @AES_CMAC(i8* %10, i8* %11, i32 %12, i8* %13)
%15 = load i8*, i8** %8
%16 = getelementptr inbounds [16 x i8], [16 x i8]* %9, i64 0, i64 0
%17 = call i32 @memcmp(i8* %15, i8* %16, i32 16)
ret i32 %17
}

LLVM IR (-O2):
define i32 @AES_CMAC_CHECK(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca [16 x i8]
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%7 = call i32 @AES_CMAC(i8* %0, i8* %1, i32 %2, i8* %6)
%8 = call i32 @memcmp(i8* %3, i8* %6, i32 16)
ret i32 %8
}
int is_number_odd(long int num) { return !is_number_odd(num); }


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

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

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

LLVM IR (-O2):
define i32 @is_number_odd(i64 %0) {
%2 = tail call i32 @is_number_odd(i64 %0)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ glutMainLoop();
void runPolo() { glutMainLoop(); }


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

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

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

LLVM IR (-O2):
define void @runPolo() {
%1 = tail call i32 (...) @glutMainLoop()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ set_io_bit(int, int);
void TOSH_SET_I2C_BUS1_SCL_PIN() { set_io_bit(0x34, 4); }


x86 assembly (clang, -O0):
<TOSH_SET_I2C_BUS1_SCL_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0x34,%edi
mov    $0x4,%esi
call   1030 <set_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_SET_I2C_BUS1_SCL_PIN>:
mov    $0x34,%edi
mov    $0x4,%esi
jmp    1030 <set_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_SET_I2C_BUS1_SCL_PIN() {
%1 = call i32 @set_io_bit(i32 52, i32 4)
ret void
}

LLVM IR (-O2):
define void @TOSH_SET_I2C_BUS1_SCL_PIN() {
%1 = tail call i32 @set_io_bit(i32 52, i32 4)
ret void
}
/* Type definitions */
typedef long long uint64_t;
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
long long ubits(unsigned char *, unsigned int, unsigned int);
int64_t sbits(signed char buf[], unsigned int start, unsigned int width) {
  uint64_t fld = ubits((unsigned char *)buf, start, width);
  if (fld & (1LL << (width - 1))) {
    fld |= (-1LL << (width - 1));
  }
  return (int64_t)fld;
}


x86 assembly (clang, -O0):
<sbits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <ubits@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
mov    $0x1,%edx
shl    %cl,%rdx
mov    %rdx,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
je     1175 <sbits+0x65>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    $0xffffffffffffffff,%rax
shl    %cl,%rax
or     -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sbits>:
push   %rbx
mov    %edx,%ebx
call   1030 <ubits@plt>
add    $0xff,%bl
movzbl %bl,%ecx
mov    $0xffffffffffffffff,%rdx
shl    %cl,%rdx
xor    %esi,%esi
bt     %rcx,%rax
cmovae %esi,%edx
or     %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @sbits(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i64 @ubits(i8* %8, i32 %9, i32 %10)
store i64 %11, i64* %7
%12 = load i64, i64* %7
%13 = load i32, i32* %6
%14 = sub i32 %13, 1
%15 = zext i32 %14 to i64
%16 = shl i64 1, %15
%17 = and i64 %12, %16
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %26
19: ; preds = %3
%20 = load i32, i32* %6
%21 = sub i32 %20, 1
%22 = zext i32 %21 to i64
%23 = shl i64 -1, %22
%24 = load i64, i64* %7
%25 = or i64 %24, %23
store i64 %25, i64* %7
br label %26
26: ; preds = %19, %3
%27 = load i64, i64* %7
%28 = trunc i64 %27 to i32
ret i32 %28
}

LLVM IR (-O2):
define i32 @sbits(i8* %0, i32 %1, i32 %2) {
%4 = tail call i64 @ubits(i8* %0, i32 %1, i32 %2)
%5 = add i32 %2, -1
%6 = zext i32 %5 to i64
%7 = shl nuw i64 1, %6
%8 = and i64 %4, %7
%9 = icmp eq i64 %8, 0
%10 = shl nsw i64 -1, %6
%11 = select i1 %9, i64 0, i64 %10
%12 = or i64 %11, %4
%13 = trunc i64 %12 to i32
ret i32 %13
}
struct hostent *gethostent() {
  anvil_syslog(0, "%s unimplemented\n", __FUNCTION__);
  while (1)
    ;
  return 0;
}


x86 assembly (clang, -O0):
<gethostent>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
lea    0xeee(%rip),%rdx
mov    $0x0,%al
call   1030 <anvil_syslog@plt>
jmp    112b <gethostent+0x1b>

x86 assembly (clang, -O2):
<gethostent>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0xef3(%rip),%rdx
xor    %edi,%edi
xor    %eax,%eax
call   1030 <anvil_syslog@plt>
nopl   0x0(%rax,%rax,1)
jmp    1130 <gethostent+0x20>

LLVM IR (-O0):
%struct.hostent = type opaque
@.str = [18 x i8] c"%s unimplemented\0A\00"
@__FUNCTION__.gethostent = [11 x i8] c"gethostent\00"
define %struct.hostent* @gethostent() {
%1 = call i32 (i32, i8*, i8*, ...) bitcast (i32 (...)* @anvil_syslog to i32 (i32, i8*, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__FUNCTION__.gethostent, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
%struct.hostent = type opaque
@.str = [18 x i8] c"%s unimplemented\0A\00"
@__FUNCTION__.gethostent = [11 x i8] c"gethostent\00"
define %struct.hostent* @gethostent() {
%1 = tail call i32 (i32, i8*, i8*, ...) bitcast (i32 (...)* @anvil_syslog to i32 (i32, i8*, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__FUNCTION__.gethostent, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
br label %2
}
void outb(unsigned short _port, unsigned char _data) {
  __asm__ __volatile__("outb %1, %0" : : "dN"(_port), "a"(_data));
}


x86 assembly (clang, -O0):
<outb>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    -0x2(%rbp),%dx
mov    -0x3(%rbp),%al
out    %al,(%dx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outb>:
mov    %esi,%eax
mov    %edi,%edx
out    %al,(%dx)
ret

LLVM IR (-O0):
define void @outb(i16 zeroext %0, i8 zeroext %1) {
%3 = alloca i16
%4 = alloca i8
store i16 %0, i16* %3
store i8 %1, i8* %4
%5 = load i16, i16* %3
%6 = load i8, i8* %4
ret void
}

LLVM IR (-O2):
define void @outb(i16 zeroext %0, i8 zeroext %1) {
tail call void asm sideeffect "outb $1, $0", "{dx}N,{ax},~{dirflag},~{fpsr},~{flags}"(i16 %0, i8 %1)
ret void
}
unsigned xrop3_196_0_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = ~D;
  stk2 = T | stk3;
  stk1 = S & stk2;
  return (stk1 & S) | (stk1 & (~T)) | (T & (~S) & D);
}


x86 assembly (clang, -O0):
<xrop3_196_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
and    -0x8(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_196_0_1>:
mov    %edi,%ecx
shl    $0x8,%ecx
or     %edi,%ecx
lea    0xff00(%rsi),%eax
xor    %esi,%eax
and    %ecx,%eax
xor    %esi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_196_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %5
%24 = xor i32 %23, -1
store i32 %24, i32* %10
%25 = load i32, i32* %7
%26 = load i32, i32* %10
%27 = or i32 %25, %26
store i32 %27, i32* %9
%28 = load i32, i32* %6
%29 = load i32, i32* %9
%30 = and i32 %28, %29
store i32 %30, i32* %8
%31 = load i32, i32* %8
%32 = load i32, i32* %6
%33 = and i32 %31, %32
%34 = load i32, i32* %8
%35 = load i32, i32* %7
%36 = xor i32 %35, -1
%37 = and i32 %34, %36
%38 = or i32 %33, %37
%39 = load i32, i32* %7
%40 = load i32, i32* %6
%41 = xor i32 %40, -1
%42 = and i32 %39, %41
%43 = load i32, i32* %5
%44 = and i32 %42, %43
%45 = or i32 %38, %44
ret i32 %45
}

LLVM IR (-O2):
define i32 @xrop3_196_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = or i32 %5, -256
%7 = and i32 %4, %6
%8 = xor i32 %4, -1
%9 = and i32 %8, %5
%10 = or i32 %7, %9
ret i32 %10
}
/* Variables and functions */
unsigned long REPEAT_BYTE(int);
unsigned long has_zero(unsigned long a) {
  return ((a - REPEAT_BYTE(0x01)) & ~a) & REPEAT_BYTE(0x80);
}


x86 assembly (clang, -O0):
<has_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x1,%edi
call   1030 <REPEAT_BYTE@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
sub    %rcx,%rax
mov    -0x8(%rbp),%rcx
xor    $0xffffffffffffffff,%rcx
and    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    $0x80,%edi
call   1030 <REPEAT_BYTE@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
and    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<has_zero>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x1,%edi
call   1030 <REPEAT_BYTE@plt>
mov    %rbx,%r14
sub    %rax,%r14
not    %rbx
mov    $0x80,%edi
call   1030 <REPEAT_BYTE@plt>
and    %rbx,%rax
and    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @has_zero(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 @REPEAT_BYTE(i32 1)
%5 = sub i64 %3, %4
%6 = load i64, i64* %2
%7 = xor i64 %6, -1
%8 = and i64 %5, %7
%9 = call i64 @REPEAT_BYTE(i32 128)
%10 = and i64 %8, %9
ret i64 %10
}

LLVM IR (-O2):
define i64 @has_zero(i64 %0) {
%2 = tail call i64 @REPEAT_BYTE(i32 1)
%3 = sub i64 %0, %2
%4 = xor i64 %0, -1
%5 = and i64 %3, %4
%6 = tail call i64 @REPEAT_BYTE(i32 128)
%7 = and i64 %5, %6
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ wprintf(char *);
void printer(void) { wprintf(L"你好世界 !\n"); }


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

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

LLVM IR (-O0):
@.str = [8 x i32] [i32 20320, i32 22909, i32 19990, i32 30028, i32 32, i32 33, i32 10, i32 0]
define void @printer() {
%1 = call i32 @wprintf(i8* bitcast ([8 x i32]* @.str to i8*))
ret void
}

LLVM IR (-O2):
@.str = [8 x i32] [i32 20320, i32 22909, i32 19990, i32 30028, i32 32, i32 33, i32 10, i32 0]
define void @printer() {
%1 = tail call i32 @wprintf(i8* bitcast ([8 x i32]* @.str to i8*))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_set1_epi8(char);
__m128i foo(char x) { return _mm_set1_epi8(x); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <_mm_set1_epi8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
jmp    1030 <_mm_set1_epi8@plt>

LLVM IR (-O0):
define i32 @foo(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @_mm_set1_epi8(i8 signext %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @foo(i8 signext %0) {
%2 = tail call i32 @_mm_set1_epi8(i8 signext %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
int /*<<< orphan*/ setegid(int /*<<< orphan*/);
int /*<<< orphan*/ seteuid(int /*<<< orphan*/);
int mtnd_guid_set(uid_t uid, gid_t gid) {
  seteuid(uid);
  setegid(gid);
  return (0);
}


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

x86 assembly (clang, -O2):
<mtnd_guid_set>:
push   %rbx
mov    %esi,%ebx
call   1040 <seteuid@plt>
mov    %ebx,%edi
call   1030 <setegid@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @mtnd_guid_set(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 = call i32 @seteuid(i32 %5)
%7 = load i32, i32* %4
%8 = call i32 @setegid(i32 %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @mtnd_guid_set(i32 %0, i32 %1) {
%3 = tail call i32 @seteuid(i32 %0)
%4 = tail call i32 @setegid(i32 %1)
ret i32 0
}
void wx11mv(x, y) float *x, *y;
{ wx11im(x, y); }


x86 assembly (clang, -O0):
<wx11mv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <wx11im@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @wx11mv(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %3
%6 = load float*, float** %4
%7 = call i32 (float*, float*, ...) bitcast (i32 (...)* @wx11im to i32 (float*, float*, ...)*)(float* %5, float* %6)
ret void
}

LLVM IR (-O2):
define void @wx11mv(float* %0, float* %1) {
%3 = tail call i32 (float*, float*, ...) bitcast (i32 (...)* @wx11im to i32 (float*, float*, ...)*)(float* %0, float* %1)
ret void
}