xunge/DecIR huggingface dataset:
fold(c) char c;
{
  if (c < 'A' || c > 'Z')
    return (c);
  return (c | 040);
}


x86 assembly (clang, -O0):
<fold>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1124 <fold+0x24>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jle    1130 <fold+0x30>
movsbl -0x5(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113a <fold+0x3a>
movsbl -0x5(%rbp),%eax
or     $0x20,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fold>:
movsbl %dil,%ecx
shl    $0x18,%edi
add    $0xa5ffffff,%edi
mov    %ecx,%eax
or     $0x20,%eax
cmp    $0xe6ffffff,%edi
cmovb  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @fold(i32 %0) {
%2 = shl i32 %0, 24
%3 = ashr exact i32 %2, 24
%4 = add i32 %2, -1509949441
%5 = icmp ult i32 %4, -419430401
%6 = or i32 %3, 32
%7 = select i1 %5, i32 %3, i32 %6
ret i32 %7
}
int test_imm_59int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x59 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_59int64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x20,%rdx
and    $0x59,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_59int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 382252089344
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int main(int argc, char **argv) {
  __asm__ __volatile__("xchg %bx,%bx");
  ;
  arraytest();
  __asm__ __volatile__("xchg %bx,%bx");
  ;
  arraytest();
  __asm__ __volatile__("xchg %bx,%bx");
  ;
  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)
xchg   %bx,%bx
mov    $0x0,%al
call   1030 <arraytest@plt>
xchg   %bx,%bx
mov    $0x0,%al
call   1030 <arraytest@plt>
xchg   %bx,%bx
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
tail call void asm sideeffect "xchg %bx,%bx", "~{dirflag},~{fpsr},~{flags}"()
%3 = tail call i32 (...) @arraytest()
tail call void asm sideeffect "xchg %bx,%bx", "~{dirflag},~{fpsr},~{flags}"()
%4 = tail call i32 (...) @arraytest()
tail call void asm sideeffect "xchg %bx,%bx", "~{dirflag},~{fpsr},~{flags}"()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(unsigned char *, char *, unsigned char,
                           unsigned char, unsigned char, unsigned char);
char *inet_ntoay(unsigned long addr, unsigned char *ip) {
  unsigned char *p = (unsigned char *)&addr;
  sprintf(ip, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
  return ip;
}


x86 assembly (clang, -O0):
<inet_ntoay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%dl
mov    -0x18(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x18(%rbp),%rax
mov    0x2(%rax),%r8b
mov    -0x18(%rbp),%rax
lea    0xeb4(%rip),%rsi
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl %r8b,%r8d
movzbl 0x3(%rax),%r9d
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inet_ntoay>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %ebx,%eax
shr    $0x18,%eax
movzbl %bl,%edx
movzbl %bh,%ecx
shr    $0x10,%ebx
movzbl %bl,%r8d
lea    0xecd(%rip),%rsi
mov    %r14,%rdi
mov    %eax,%r9d
call   1030 <sprintf@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%d.%d.%d.%d\00"
define i8* @inet_ntoay(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i8*
store i64 %0, i64* %3
store i8* %1, i8** %4
%6 = bitcast i64* %3 to i8*
store i8* %6, i8** %5
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
%14 = load i8*, i8** %5
%15 = getelementptr inbounds i8, i8* %14, i64 2
%16 = load i8, i8* %15
%17 = load i8*, i8** %5
%18 = getelementptr inbounds i8, i8* %17, i64 3
%19 = load i8, i8* %18
%20 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %10, i8 zeroext %13, i8 zeroext %16, i8 zeroext %19)
%21 = load i8*, i8** %4
ret i8* %21
}

LLVM IR (-O2):
@.str = [12 x i8] c"%d.%d.%d.%d\00"
define i8* @inet_ntoay(i64 %0, i8* returned writeonly %1) {
%3 = trunc i64 %0 to i8
%4 = lshr i64 %0, 8
%5 = trunc i64 %4 to i8
%6 = lshr i64 %0, 16
%7 = trunc i64 %6 to i8
%8 = lshr i64 %0, 24
%9 = trunc i64 %8 to i8
%10 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %3, i8 zeroext %5, i8 zeroext %7, i8 zeroext %9)
ret i8* %1
}
int func(int a, int b) {
  a;
  b;
  return a;
}


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

x86 assembly (clang, -O2):
<func>:
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @func(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 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @func(i32 returned %0, i32 %1) {
ret i32 %0
}
int compare_special_a(void const *a, void const *b) {
  int char_a = ((char *)a)[1];
  int char_b = ((char *)b)[1];
  return char_a - char_b;
}


x86 assembly (clang, -O0):
<compare_special_a>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
sub    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_special_a>:
movsbl 0x1(%rdi),%eax
movsbl 0x1(%rsi),%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @compare_special_a(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
store i32 %10, i32* %5
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
store i32 %14, i32* %6
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = sub nsw i32 %15, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @compare_special_a(i8* nocapture %0, i8* nocapture %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = getelementptr inbounds i8, i8* %1, i64 1
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = sub nsw i32 %5, %8
ret i32 %9
}
int ushell_strlen(char *str) {
  unsigned j = 0;
  while (str[j] != '\0') {
    ++j;
  }
  return j;
}


x86 assembly (clang, -O0):
<ushell_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1131 <ushell_strlen+0x31>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <ushell_strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ushell_strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi,%rax,1)
jne    1110 <ushell_strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @ushell_strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 0, %1 ], [ %8, %2 ]
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = add i32 %3, 1
br i1 %7, label %9, label %2
9: ; preds = %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void sleep_short(int milliseconds) { usleep(milliseconds * 1000); }


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

x86 assembly (clang, -O2):
<sleep_short>:
imul   $0x3e8,%edi,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @sleep_short(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 1000
%5 = call i32 @usleep(i32 %4)
ret void
}

LLVM IR (-O2):
define void @sleep_short(i32 %0) {
%2 = mul nsw i32 %0, 1000
%3 = tail call i32 @usleep(i32 %2)
ret void
}
/* Variables and functions */
int baz(int, int);
__attribute__((always_)) int foo(int a, int b) {
  int c = a * 2 + b;
  c = baz(b, c);
  return c;
}


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

x86 assembly (clang, -O2):
<foo>:
mov    %esi,%eax
lea    (%rax,%rdi,2),%esi
mov    %eax,%edi
jmp    1030 <baz@plt>

LLVM IR (-O0):
define i32 @foo(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = mul nsw i32 %6, 2
%8 = load i32, i32* %4
%9 = add nsw i32 %7, %8
store i32 %9, i32* %5
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = call i32 @baz(i32 %10, i32 %11)
store i32 %12, i32* %5
%13 = load i32, i32* %5
ret i32 %13
}

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1) {
%3 = shl nsw i32 %0, 1
%4 = add nsw i32 %3, %1
%5 = tail call i32 @baz(i32 %1, i32 %4)
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile uint16_t;

/* Variables and functions */
void reg16_clear_bits(volatile uint16_t *reg, uint16_t value) {
  *reg &= ~(value);
}


x86 assembly (clang, -O0):
<reg16_clear_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edx
xor    $0xffffffff,%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
and    %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<reg16_clear_bits>:
mov    %esi,-0x4(%rsp)
mov    -0x4(%rsp),%eax
not    %eax
and    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @reg16_clear_bits(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store volatile i32 %1, i32* %4
%5 = load volatile i32, i32* %4
%6 = xor i32 %5, -1
%7 = load i32*, i32** %3
%8 = load volatile i32, i32* %7
%9 = and i32 %8, %6
store volatile i32 %9, i32* %7
ret void
}

LLVM IR (-O2):
define void @reg16_clear_bits(i32* %0, i32 %1) {
%3 = alloca i32
store volatile i32 %1, i32* %3
%4 = load volatile i32, i32* %3
%5 = xor i32 %4, -1
%6 = load volatile i32, i32* %0
%7 = and i32 %6, %5
store volatile i32 %7, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void message2() { printf("\n"); }


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

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

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

LLVM IR (-O2):
define void @message2() {
%1 = tail call i32 @putchar(i32 10)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ SSL_CTX;
typedef int /*<<< orphan*/ SSL;

/* Variables and functions */
int /*<<< orphan*/ SSL_CTX_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ SSL_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ SSL_shutdown(int /*<<< orphan*/ *);
int /*<<< orphan*/ close(int);
int client_disconnect(int s, SSL *ssl, SSL_CTX *ctx) {
  if ((ssl)) {
    SSL_shutdown(ssl);
    SSL_free(ssl);
  };
  if ((ctx))
    SSL_CTX_free(ctx);
  close(s);
  return (0);
}


x86 assembly (clang, -O0):
<client_disconnect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1170 <client_disconnect+0x30>
mov    -0x10(%rbp),%rdi
call   1050 <SSL_shutdown@plt>
mov    -0x10(%rbp),%rdi
call   1030 <SSL_free@plt>
cmpq   $0x0,-0x18(%rbp)
je     1184 <client_disconnect+0x44>
mov    -0x18(%rbp),%rdi
call   1060 <SSL_CTX_free@plt>
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<client_disconnect>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %edi,%r14d
test   %rsi,%rsi
je     1162 <client_disconnect+0x22>
mov    %rsi,%rbp
mov    %rsi,%rdi
call   1050 <SSL_shutdown@plt>
mov    %rbp,%rdi
call   1030 <SSL_free@plt>
test   %rbx,%rbx
je     116f <client_disconnect+0x2f>
mov    %rbx,%rdi
call   1060 <SSL_CTX_free@plt>
mov    %r14d,%edi
call   1040 <close@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @client_disconnect(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %5
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %14
9: ; preds = %3
%10 = load i32*, i32** %5
%11 = call i32 @SSL_shutdown(i32* %10)
%12 = load i32*, i32** %5
%13 = call i32 @SSL_free(i32* %12)
br label %14
14: ; preds = %9, %3
%15 = load i32*, i32** %6
%16 = icmp ne i32* %15, null
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32*, i32** %6
%19 = call i32 @SSL_CTX_free(i32* %18)
br label %20
20: ; preds = %17, %14
%21 = load i32, i32* %4
%22 = call i32 @close(i32 %21)
ret i32 0
}

LLVM IR (-O2):
define i32 @client_disconnect(i32 %0, i32* %1, i32* %2) {
%4 = icmp eq i32* %1, null
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = tail call i32 @SSL_shutdown(i32* %1)
%7 = tail call i32 @SSL_free(i32* %1)
br label %8
8: ; preds = %5, %3
%9 = icmp eq i32* %2, null
br i1 %9, label %12, label %10
10: ; preds = %8
%11 = tail call i32 @SSL_CTX_free(i32* %2)
br label %12
12: ; preds = %10, %8
%13 = tail call i32 @close(i32 %0)
ret i32 0
}
/* Variables and functions */
int send(int, char const *, int, int);
int my_send(int socket, const char *buffer, int max_size, int flags) {
  return send(socket, buffer, max_size, flags);
}


x86 assembly (clang, -O0):
<my_send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1030 <send@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_send>:
jmp    1030 <send@plt>

LLVM IR (-O0):
define i32 @my_send(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @send(i32 %9, i8* %10, i32 %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @my_send(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 @send(i32 %0, i8* %1, i32 %2, i32 %3)
ret i32 %5
}
/* Variables and functions */
float acos(int);
int glmComputeVectorLength4f(float const *);
int glmDotProduct4f(float const *, float const *);
float glmComputeVectorAngle4fRad(const float v1[4], const float v2[4]) {
  return acos(glmDotProduct4f(v1, v2) /
              (glmComputeVectorLength4f(v1) * glmComputeVectorLength4f(v2)));
}


x86 assembly (clang, -O0):
<glmComputeVectorAngle4fRad>:
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 <glmDotProduct4f@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <glmComputeVectorLength4f@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <glmComputeVectorLength4f@plt>
mov    -0x18(%rbp),%ecx
mov    %eax,%edx
mov    -0x14(%rbp),%eax
imul   %edx,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <acos@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmComputeVectorAngle4fRad>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <glmDotProduct4f@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <glmComputeVectorLength4f@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1050 <glmComputeVectorLength4f@plt>
mov    %eax,%ecx
imul   %ebx,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
mov    %eax,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <acos@plt>

LLVM IR (-O0):
define float @glmComputeVectorAngle4fRad(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 @glmDotProduct4f(float* %5, float* %6)
%8 = load float*, float** %3
%9 = call i32 @glmComputeVectorLength4f(float* %8)
%10 = load float*, float** %4
%11 = call i32 @glmComputeVectorLength4f(float* %10)
%12 = mul nsw i32 %9, %11
%13 = sdiv i32 %7, %12
%14 = call float @acos(i32 %13)
ret float %14
}

LLVM IR (-O2):
define float @glmComputeVectorAngle4fRad(float* %0, float* %1) {
%3 = tail call i32 @glmDotProduct4f(float* %0, float* %1)
%4 = tail call i32 @glmComputeVectorLength4f(float* %0)
%5 = tail call i32 @glmComputeVectorLength4f(float* %1)
%6 = mul nsw i32 %5, %4
%7 = sdiv i32 %3, %6
%8 = tail call float @acos(i32 %7)
ret float %8
}
/* Variables and functions */
char getchar();
int /*<<< orphan*/ puts(char *);
int main() {
  char ch;
  puts("Typing program...");
  puts("Type away");
  for (;;) {
    ch = getchar();
    if (ch == 'h' || ch == 'H') {
      break;
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
lea    0xed0(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x68,%eax
je     116b <main+0x4b>
movsbl -0x5(%rbp),%eax
cmp    $0x48,%eax
jne    1170 <main+0x50>
jmp    1175 <main+0x55>
jmp    1147 <main+0x27>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
and    $0xdf,%al
cmp    $0x48,%al
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Typing program...\00"
@.str.1 = [10 x i8] c"Type away\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %15, %0
%6 = call signext i8 (...) @getchar()
store i8 %6, i8* %2
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 104
br i1 %9, label %14, label %10
10: ; preds = %5
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 72
br i1 %13, label %14, label %15
14: ; preds = %10, %5
br label %16
15: ; preds = %10
br label %5
16: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Typing program...\00"
@.str.1 = [10 x i8] c"Type away\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %3
3: ; preds = %3, %0
%4 = tail call signext i8 (...) @getchar()
%5 = and i8 %4, -33
%6 = icmp eq i8 %5, 72
br i1 %6, label %7, label %3
7: ; preds = %3
ret i32 0
}
int execve(const char *filename, char **argv, char **env) {
  int r;
  __asm__ __volatile__("\tint $0x80\n"
                       : "=a"(r)
                       : "a"(11), "b"(filename), "c"(argv), "d"(env)
                       : "memory");
  return set_errno(r);
}


x86 assembly (clang, -O0):
<execve>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x28,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rbx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rdx
mov    $0xb,%eax
int    $0x80
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
mov    $0x0,%al
call   1030 <set_errno@plt>
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<execve>:
push   %rbx
mov    %rsi,%rcx
mov    %rdi,%rbx
mov    $0xb,%eax
int    $0x80
mov    %eax,%edi
xor    %eax,%eax
pop    %rbx
jmp    1030 <set_errno@plt>

LLVM IR (-O0):
define i32 @execve(i8* %0, i8** %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%8 = load i8*, i8** %4
%9 = load i8**, i8*** %5
%10 = load i8**, i8*** %6
%11 = call i32 asm sideeffect "\09int $$0x80\0A", "={ax},{ax},{bx},{cx},{dx},~{memory},~{dirflag},~{fpsr},~{flags}"(i32 11, i8* %8, i8** %9, i8** %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = call i32 (i32, ...) bitcast (i32 (...)* @set_errno to i32 (i32, ...)*)(i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @execve(i8* %0, i8** %1, i8** %2) {
%4 = tail call i32 asm sideeffect "\09int $$0x80\0A", "={ax},{ax},{bx},{cx},{dx},~{memory},~{dirflag},~{fpsr},~{flags}"(i32 11, i8* %0, i8** %1, i8** %2)
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @set_errno to i32 (i32, ...)*)(i32 %4)
ret i32 %5
}
void X509_STORE_CTX_set_default(void) {}


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

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

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

LLVM IR (-O2):
define void @X509_STORE_CTX_set_default() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ register_to_function_list();
void to_init() { register_to_function_list(); }


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

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

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

LLVM IR (-O2):
define void @to_init() {
%1 = tail call i32 (...) @register_to_function_list()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ exit(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int i2c_init() {
  int i2c_file;
  if ((i2c_file = open("/dev/i2c-1", O_RDWR)) < 0) {
    perror("Unable to open i2c control file");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<i2c_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
lea    0xeb8(%rip),%rdi
call   1030 <open@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jge    116f <i2c_init+0x3f>
lea    0xeab(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_init>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
lea    0xebf(%rip),%rdi
call   1030 <open@plt>
test   %eax,%eax
js     114c <i2c_init+0x1c>
pop    %rcx
ret
lea    0xeb8(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"/dev/i2c-1\00"
@O_RDWR = global i32 0
@.str.1 = [32 x i8] c"Unable to open i2c control file\00"
define i32 @i2c_init() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @O_RDWR
%4 = call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %3)
store i32 %4, i32* %2
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @exit(i32 1)
unreachable
9: ; preds = %0
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
@.str = [11 x i8] c"/dev/i2c-1\00"
@O_RDWR = global i32 0
@.str.1 = [32 x i8] c"Unable to open i2c control file\00"
define i32 @i2c_init() {
%1 = load i32, i32* @O_RDWR
%2 = tail call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = tail call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %0
ret i32 undef
}
char L4_KDB_ReadChar(void) {
  char ret;
  __asm__ __volatile__("/* L4_KDB_"
                       "ReadChar"
                       "() */		\n"
                       "	int	$3		\n"
                       "	cmpb	%1, %%al	\n"
                       : "=a"(ret)
                       : "i"(0x08));
  return ret;
}


x86 assembly (clang, -O0):
<L4_KDB_ReadChar>:
push   %rbp
mov    %rsp,%rbp
int3
cmp    $0x8,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<L4_KDB_ReadChar>:
int3
cmp    $0x8,%al
ret

LLVM IR (-O0):
define signext i8 @L4_KDB_ReadChar() {
%1 = alloca i8
%2 = call i8 asm sideeffect "/* L4_KDB_ReadChar() */\09\09\0A\09int\09$$3\09\09\0A\09cmpb\09$1, %al\09\0A", "={ax},i,~{dirflag},~{fpsr},~{flags}"(i32 8)
store i8 %2, i8* %1
%3 = load i8, i8* %1
ret i8 %3
}

LLVM IR (-O2):
define signext i8 @L4_KDB_ReadChar() {
%1 = tail call i8 asm sideeffect "/* L4_KDB_ReadChar() */\09\09\0A\09int\09$$3\09\09\0A\09cmpb\09$1, %al\09\0A", "={ax},i,~{dirflag},~{fpsr},~{flags}"(i32 8)
ret i8 %1
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void free_convert_matrix(double **m, long nrl, long nrh, long ncl, long nch) {
  free((char *)(m + nrl - 1));
}


x86 assembly (clang, -O0):
<free_convert_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_convert_matrix>:
lea    (%rdi,%rsi,8),%rdi
add    $0xfffffffffffffff8,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_convert_matrix(double** %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca double**
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store double** %0, double*** %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i64 %4, i64* %10
%11 = load double**, double*** %6
%12 = load i64, i64* %7
%13 = getelementptr inbounds double*, double** %11, i64 %12
%14 = getelementptr inbounds double*, double** %13, i64 -1
%15 = bitcast double** %14 to i8*
%16 = call i32 @free(i8* %15)
ret void
}

LLVM IR (-O2):
define void @free_convert_matrix(double** nocapture %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = getelementptr inbounds double*, double** %0, i64 %1
%7 = getelementptr inbounds double*, double** %6, i64 -1
%8 = bitcast double** %7 to i8*
%9 = tail call i32 @free(i8* %8)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ cli_putc(int);
int /*<<< orphan*/ cli_putstr(char *);
void nessie_print_setheader(uint8_t set) {
  cli_putstr("\r\n\r\nTest vectors -- set ");
  cli_putc('0' + set % 10);
  cli_putstr("\r\n=====================");
}


x86 assembly (clang, -O0):
<nessie_print_setheader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1040 <cli_putstr@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
call   1030 <cli_putc@plt>
lea    0xec6(%rip),%rdi
call   1040 <cli_putstr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nessie_print_setheader>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
call   1040 <cli_putstr@plt>
movslq %ebx,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x30,%edi
call   1030 <cli_putc@plt>
lea    0xeba(%rip),%rdi
pop    %rbx
jmp    1040 <cli_putstr@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"\0D\0A\0D\0ATest vectors -- set \00"
@.str.1 = [24 x i8] c"\0D\0A=====================\00"
define void @nessie_print_setheader(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @cli_putstr(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = srem i32 %4, 10
%6 = add nsw i32 48, %5
%7 = call i32 @cli_putc(i32 %6)
%8 = call i32 @cli_putstr(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"\0D\0A\0D\0ATest vectors -- set \00"
@.str.1 = [24 x i8] c"\0D\0A=====================\00"
define void @nessie_print_setheader(i32 %0) {
%2 = tail call i32 @cli_putstr(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%3 = srem i32 %0, 10
%4 = add nsw i32 %3, 48
%5 = tail call i32 @cli_putc(i32 %4)
%6 = tail call i32 @cli_putstr(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
ret void
}
unsigned char inbyte(unsigned short port) {
  unsigned char _v;
  __asm__ __volatile__("inb %w1,%b0" : "=a"(_v) : "d"(port));
  return _v;
}


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

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

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

LLVM IR (-O2):
define zeroext i8 @inbyte(i16 zeroext %0) {
%2 = tail call i8 asm sideeffect "inb ${1:w},${0:b}", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i8 %2
}
signed short d_getsw(const unsigned char *ptr) {
  return (((signed short)ptr[0] << 8) | ((unsigned short)ptr[1] << 0));
}


x86 assembly (clang, -O0):
<d_getsw>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cwtl
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
movzwl %cx,%ecx
shl    $0x0,%ecx
or     %ecx,%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_getsw>:
movzwl (%rdi),%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
define signext i16 @d_getsw(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i16
%7 = sext i16 %6 to i32
%8 = shl i32 %7, 8
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = zext i8 %11 to i16
%13 = zext i16 %12 to i32
%14 = shl i32 %13, 0
%15 = or i32 %8, %14
%16 = trunc i32 %15 to i16
ret i16 %16
}

LLVM IR (-O2):
define signext i16 @d_getsw(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i16
%4 = shl nuw i16 %3, 8
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i16
%8 = or i16 %4, %7
ret i16 %8
}
double _COM_CONV64ud(unsigned long long a) { return (double)a; }


x86 assembly (clang, -O0):
<_COM_CONV64ud>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movaps 0xef1(%rip),%xmm1
movq   -0x8(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xef0(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<_COM_CONV64ud>:
movq   %rdi,%xmm1
punpckldq 0xef3(%rip),%xmm1
subpd  0xefb(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @_COM_CONV64ud(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = uitofp i64 %3 to double
ret double %4
}

LLVM IR (-O2):
define double @_COM_CONV64ud(i64 %0) {
%2 = uitofp i64 %0 to double
ret double %2
}
double hide_double(double x) { return x; }


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

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

LLVM IR (-O0):
define double @hide_double(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
ret double %3
}

LLVM IR (-O2):
define double @hide_double(double returned %0) {
ret double %0
}
void MIDI_send_reset(void) {}


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

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

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

LLVM IR (-O2):
define void @MIDI_send_reset() {
ret void
}
void foo527() {}


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

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

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

LLVM IR (-O2):
define void @foo527() {
ret void
}
t(unsigned int a) { return ((((a) > (1)) ? (a) : (1))); }


x86 assembly (clang, -O0):
<t>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jbe    111c <t+0x1c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <t+0x29>
mov    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <t+0x29>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<t>:
test   %edi,%edi
mov    $0x1,%eax
cmovne %edi,%eax
ret

LLVM IR (-O0):
define i32 @t(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ugt i32 %3, 1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load i32, i32* %2
br label %8
7: ; preds = %1
br label %8
8: ; preds = %7, %5
%9 = phi i32 [ %6, %5 ], [ 1, %7 ]
ret i32 %9
}

LLVM IR (-O2):
define i32 @t(i32 %0) {
%2 = icmp ugt i32 %0, 1
%3 = select i1 %2, i32 %0, i32 1
ret i32 %3
}
int bcf_acgt2int(char c) {
  if ((int)c > 96)
    c -= 32;
  if (c == 'A')
    return 0;
  if (c == 'C')
    return 1;
  if (c == 'G')
    return 2;
  if (c == 'T')
    return 3;
  return -1;
}


x86 assembly (clang, -O0):
<bcf_acgt2int>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x60,%eax
jle    1121 <bcf_acgt2int+0x21>
movsbl -0x5(%rbp),%eax
sub    $0x20,%eax
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jne    113a <bcf_acgt2int+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    118c <bcf_acgt2int+0x8c>
movsbl -0x5(%rbp),%eax
cmp    $0x43,%eax
jne    1153 <bcf_acgt2int+0x53>
movl   $0x1,-0x4(%rbp)
jmp    118c <bcf_acgt2int+0x8c>
movsbl -0x5(%rbp),%eax
cmp    $0x47,%eax
jne    116c <bcf_acgt2int+0x6c>
movl   $0x2,-0x4(%rbp)
jmp    118c <bcf_acgt2int+0x8c>
movsbl -0x5(%rbp),%eax
cmp    $0x54,%eax
jne    1185 <bcf_acgt2int+0x85>
movl   $0x3,-0x4(%rbp)
jmp    118c <bcf_acgt2int+0x8c>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bcf_acgt2int>:
lea    -0x20(%rdi),%eax
cmp    $0x61,%dil
movzbl %al,%ecx
cmovl  %edi,%ecx
add    $0xbf,%cl
cmp    $0x13,%cl
ja     1130 <bcf_acgt2int+0x30>
xor    %eax,%eax
movzbl %cl,%ecx
lea    0xedf(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x1,%eax
ret
mov    $0xffffffff,%eax
ret
mov    $0x2,%eax
ret
mov    $0x3,%eax
ret

LLVM IR (-O0):
define i32 @bcf_acgt2int(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sgt i32 %5, 96
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = sub nsw i32 %9, 32
%11 = trunc i32 %10 to i8
store i8 %11, i8* %3
br label %12
12: ; preds = %7, %1
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 65
br i1 %15, label %16, label %17
16: ; preds = %12
store i32 0, i32* %2
br label %33
17: ; preds = %12
%18 = load i8, i8* %3
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 67
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 1, i32* %2
br label %33
22: ; preds = %17
%23 = load i8, i8* %3
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 71
br i1 %25, label %26, label %27
26: ; preds = %22
store i32 2, i32* %2
br label %33
27: ; preds = %22
%28 = load i8, i8* %3
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 84
br i1 %30, label %31, label %32
31: ; preds = %27
store i32 3, i32* %2
br label %33
32: ; preds = %27
store i32 -1, i32* %2
br label %33
33: ; preds = %32, %31, %26, %21, %16
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
define i32 @bcf_acgt2int(i8 signext %0) {
%2 = icmp sgt i8 %0, 96
%3 = add i8 %0, -32
%4 = select i1 %2, i8 %3, i8 %0
switch i8 %4, label %8 [
i8 65, label %9
i8 67, label %5
i8 71, label %6
i8 84, label %7
]
5: ; preds = %1
br label %9
6: ; preds = %1
br label %9
7: ; preds = %1
br label %9
8: ; preds = %1
br label %9
9: ; preds = %1, %8, %7, %6, %5
%10 = phi i32 [ 1, %5 ], [ 2, %6 ], [ 3, %7 ], [ -1, %8 ], [ 0, %1 ]
ret i32 %10
}
int muspcm_load_no(int slot, int no) { return (-1); }


x86 assembly (clang, -O0):
<muspcm_load_no>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @muspcm_load_no(i32 %0, i32 %1) {
ret i32 -1
}
void EC_POINT_make_affine(void) {}


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

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

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

LLVM IR (-O2):
define void @EC_POINT_make_affine() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *xmalloc(scalar_t__);
char *xstrdup(const char *s) {
  char *d = xmalloc(strlen(s) + 1);
  strcpy(d, s);
  return d;
}


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

x86 assembly (clang, -O2):
<xstrdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <xmalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i8* @xmalloc(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8*, i8** %2
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define i8* @xstrdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @xmalloc(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Variables and functions */
char *bar(char *);
int /*<<< orphan*/ foo(int, int, int);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  foo(5, 6, 7);
  printf("%s\n", bar("hello"));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x5,%edi
mov    $0x6,%esi
mov    $0x7,%edx
call   1050 <foo@plt>
lea    0xeaa(%rip),%rdi
call   1030 <bar@plt>
mov    %rax,%rsi
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
mov    $0x6,%esi
mov    $0x7,%edx
call   1050 <foo@plt>
lea    0xeb8(%rip),%rdi
call   1030 <bar@plt>
lea    0xea8(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [6 x i8] c"hello\00"
define i32 @main() {
%1 = tail call i32 @foo(i32 5, i32 6, i32 7)
%2 = tail call i8* @bar(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
unsigned int w5100_readSn_byte(unsigned int, int);
unsigned w5100_readSnRX_RD(unsigned sock) {
  unsigned res = w5100_readSn_byte(sock, 0x0028);
  res = (res << 8) + w5100_readSn_byte(sock, 0x0028 + 1);
  return res;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x28,%esi
call   1030 <w5100_readSn_byte@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x29,%esi
call   1030 <w5100_readSn_byte@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x28,%esi
call   1030 <w5100_readSn_byte@plt>
mov    %eax,%ebp
shl    $0x8,%ebp
mov    %ebx,%edi
mov    $0x29,%esi
call   1030 <w5100_readSn_byte@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @w5100_readSnRX_RD(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @w5100_readSn_byte(i32 %4, i32 40)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = shl i32 %6, 8
%8 = load i32, i32* %2
%9 = call i32 @w5100_readSn_byte(i32 %8, i32 41)
%10 = add i32 %7, %9
store i32 %10, i32* %3
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @w5100_readSnRX_RD(i32 %0) {
%2 = tail call i32 @w5100_readSn_byte(i32 %0, i32 40)
%3 = shl i32 %2, 8
%4 = tail call i32 @w5100_readSn_byte(i32 %0, i32 41)
%5 = add i32 %3, %4
ret i32 %5
}
int hash(int vect_size) { return (vect_size); }


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

x86 assembly (clang, -O2):
<hash>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
struct fastbuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ bputw_le(struct fastbuf *, int);
void bputw(struct fastbuf *f, int x) { bputw_le(f, x); }


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

x86 assembly (clang, -O2):
<bputw>:
jmp    1030 <bputw_le@plt>

LLVM IR (-O0):
%struct.fastbuf = type { i32 }
define void @bputw(%struct.fastbuf* %0, i32 %1) {
%3 = alloca %struct.fastbuf*
%4 = alloca i32
store %struct.fastbuf* %0, %struct.fastbuf** %3
store i32 %1, i32* %4
%5 = load %struct.fastbuf*, %struct.fastbuf** %3
%6 = load i32, i32* %4
%7 = call i32 @bputw_le(%struct.fastbuf* %5, i32 %6)
ret void
}

LLVM IR (-O2):
%struct.fastbuf = type { i32 }
define void @bputw(%struct.fastbuf* %0, i32 %1) {
%3 = tail call i32 @bputw_le(%struct.fastbuf* %0, i32 %1)
ret void
}
/* Variables and functions */
float sqr(double);
float qlerp(float a, float b, float t) { return sqr(1.0 - t) * a + t * b; }


x86 assembly (clang, -O0):
<qlerp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xec8(%rip),%xmm0
subsd  %xmm1,%xmm0
call   1030 <sqr@plt>
movss  -0x4(%rbp),%xmm2
movss  -0xc(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qlerp>:
sub    $0x18,%rsp
movss  %xmm2,0xc(%rsp)
movss  %xmm1,0x10(%rsp)
movss  %xmm0,0x14(%rsp)
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
movsd  0xecb(%rip),%xmm0
subsd  %xmm1,%xmm0
call   1030 <sqr@plt>
movss  0x10(%rsp),%xmm1
mulss  0xc(%rsp),%xmm1
mulss  0x14(%rsp),%xmm0
addss  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @qlerp(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %6
%8 = fpext float %7 to double
%9 = fsub double 1.000000e+00, %8
%10 = call float @sqr(double %9)
%11 = load float, float* %4
%12 = load float, float* %6
%13 = load float, float* %5
%14 = fmul float %12, %13
%15 = call float @llvm.fmuladd.f32(float %10, float %11, float %14)
ret float %15
}

LLVM IR (-O2):
define float @qlerp(float %0, float %1, float %2) {
%4 = fpext float %2 to double
%5 = fsub double 1.000000e+00, %4
%6 = tail call float @sqr(double %5)
%7 = fmul float %1, %2
%8 = tail call float @llvm.fmuladd.f32(float %6, float %0, float %7)
ret float %8
}