xunge/DecIR huggingface dataset:
void swap(int x, int y) {
  int temp = x;
  x = y;
  y = temp;
}


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

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

LLVM IR (-O0):
define void @swap(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
store i32 %6, i32* %5
%7 = load i32, i32* %4
store i32 %7, i32* %3
%8 = load i32, i32* %5
store i32 %8, i32* %4
ret void
}

LLVM IR (-O2):
define void @swap(i32 %0, i32 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __u32;

/* Variables and functions */
int /*<<< orphan*/ __put_unaligned_le32(int /*<<< orphan*/, void *);
void put_unaligned_le32(__u32 val, void *p) { __put_unaligned_le32(val, p); }


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

x86 assembly (clang, -O2):
<put_unaligned_le32>:
jmp    1030 <__put_unaligned_le32@plt>

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

LLVM IR (-O2):
define void @put_unaligned_le32(i32 %0, i8* %1) {
%3 = tail call i32 @__put_unaligned_le32(i32 %0, i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outb(int, int);
void remove_cursor() {
  outb(0x3D4, 14);
  outb(0x3D5, 0x07);
  outb(0x3D4, 15);
  outb(0x3D5, 0xD0);
}


x86 assembly (clang, -O0):
<remove_cursor>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3d4,%edi
mov    $0xe,%esi
call   1030 <outb@plt>
mov    $0x3d5,%edi
mov    $0x7,%esi
call   1030 <outb@plt>
mov    $0x3d4,%edi
mov    $0xf,%esi
call   1030 <outb@plt>
mov    $0x3d5,%edi
mov    $0xd0,%esi
call   1030 <outb@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_cursor>:
push   %rax
mov    $0x3d4,%edi
mov    $0xe,%esi
call   1030 <outb@plt>
mov    $0x3d5,%edi
mov    $0x7,%esi
call   1030 <outb@plt>
mov    $0x3d4,%edi
mov    $0xf,%esi
call   1030 <outb@plt>
mov    $0x3d5,%edi
mov    $0xd0,%esi
pop    %rax
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @remove_cursor() {
%1 = call i32 @outb(i32 980, i32 14)
%2 = call i32 @outb(i32 981, i32 7)
%3 = call i32 @outb(i32 980, i32 15)
%4 = call i32 @outb(i32 981, i32 208)
ret void
}

LLVM IR (-O2):
define void @remove_cursor() {
%1 = tail call i32 @outb(i32 980, i32 14)
%2 = tail call i32 @outb(i32 981, i32 7)
%3 = tail call i32 @outb(i32 980, i32 15)
%4 = tail call i32 @outb(i32 981, i32 208)
ret void
}
/* Type definitions */
struct sockaddr {
  int /*<<< orphan*/ member_0;
};
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
int SOCK_CLOEXEC;
int SOCK_NONBLOCK;
int accept4(int, struct sockaddr *, int /*<<< orphan*/ *, int);
int main(void) {
  int fd = -1;
  struct sockaddr addr = {0};
  socklen_t addrlen = 0;
  return accept4(fd, &addr, &addrlen, SOCK_NONBLOCK | SOCK_CLOEXEC);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2e81(%rip),%rax
mov    (%rax),%ecx
mov    0x2e90(%rip),%rax
or     (%rax),%ecx
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <accept4@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,(%rsp)
movl   $0x0,0x4(%rsp)
mov    0x2eb1(%rip),%rax
mov    0x2ec2(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
mov    $0xffffffff,%edi
call   1030 <accept4@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
@SOCK_NONBLOCK = global i32 0
@SOCK_CLOEXEC = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.sockaddr
%4 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %2
%5 = bitcast %struct.sockaddr* %3 to i8*
store i32 0, i32* %4
%6 = load i32, i32* %2
%7 = load i32, i32* @SOCK_NONBLOCK
%8 = load i32, i32* @SOCK_CLOEXEC
%9 = or i32 %7, %8
%10 = call i32 @accept4(i32 %6, %struct.sockaddr* %3, i32* %4, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@SOCK_NONBLOCK = global i32 0
@SOCK_CLOEXEC = global i32 0
define i32 @main() {
%1 = alloca %struct.sockaddr
%2 = alloca i32
%3 = bitcast %struct.sockaddr* %1 to i8*
%4 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %1, i64 0, i32 0
store i32 0, i32* %4
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = load i32, i32* @SOCK_NONBLOCK
%7 = load i32, i32* @SOCK_CLOEXEC
%8 = or i32 %7, %6
%9 = call i32 @accept4(i32 -1, %struct.sockaddr* %1, i32* %2, i32 %8)
ret i32 %9
}
void kinetis_halt_core() {}


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

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

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

LLVM IR (-O2):
define void @kinetis_halt_core() {
ret void
}
unsigned int calc_luma(unsigned char *pixel) {
  return (unsigned int)(pixel[0] * 30 + pixel[1] * 59 + pixel[2] * 11);
}


x86 assembly (clang, -O0):
<calc_luma>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
imul   $0x1e,%eax,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
imul   $0x3b,%ecx,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
imul   $0xb,%ecx,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_luma>:
movzbl (%rdi),%eax
mov    %eax,%ecx
shl    $0x5,%ecx
sub    %eax,%ecx
sub    %eax,%ecx
movzbl 0x1(%rdi),%eax
imul   $0x3b,%eax,%edx
add    %ecx,%edx
movzbl 0x2(%rdi),%eax
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,2),%eax
add    %edx,%eax
ret

LLVM IR (-O0):
define i32 @calc_luma(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 i32
%7 = mul nsw i32 %6, 30
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = mul nsw i32 %11, 59
%13 = add nsw i32 %7, %12
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 2
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = mul nsw i32 %17, 11
%19 = add nsw i32 %13, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @calc_luma(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = mul nuw nsw i32 %3, 30
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = mul nuw nsw i32 %7, 59
%9 = add nuw nsw i32 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = mul nuw nsw i32 %12, 11
%14 = add nuw nsw i32 %9, %13
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void version(void) {
  fprintf(stderr,
          "grpar, v."
          "0.2"
          ", (c) 2010 - Ganael LAPLANCHE, http://contribs.martymac.org\n");
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [73 x i8] c"grpar, v.0.2, (c) 2010 - Ganael LAPLANCHE, http://contribs.martymac.org\0A\00"
define void @version() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [73 x i8] c"grpar, v.0.2, (c) 2010 - Ganael LAPLANCHE, http://contribs.martymac.org\0A\00"
define void @version() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *xmalloc(size_t sz) {
  void *ret = malloc(sz);
  if (!ret) {
    fprintf(stderr, "Memory exhausted");
    abort();
  }
  return ret;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1170 <xmalloc+0x40>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rax
call   1050 <malloc@plt>
test   %rax,%rax
je     113d <xmalloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [17 x i8] c"Memory exhausted\00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"Memory exhausted\00"
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int quaddobl_witness_set_to_system_container(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc(667, a, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<quaddobl_witness_set_to_system_container>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x29b,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quaddobl_witness_set_to_system_container>:
mov    $0x29b,%edi
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @quaddobl_witness_set_to_system_container() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc(i32 667, i32* %5, i32* %6, double* %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @quaddobl_witness_set_to_system_container() {
%1 = tail call i32 @_ada_use_c2phc(i32 667, i32* undef, i32* undef, double* undef)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ htsmsg_add_dbl(void *, char const *, double);
void add_double(void *opaque, void *parent, const char *name, double v) {
  htsmsg_add_dbl(parent, name, v);
}


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

x86 assembly (clang, -O2):
<add_double>:
mov    %rsi,%rdi
mov    %rdx,%rsi
jmp    1030 <htsmsg_add_dbl@plt>

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

LLVM IR (-O2):
define void @add_double(i8* nocapture readnone %0, i8* %1, i8* %2, double %3) {
%5 = tail call i32 @htsmsg_add_dbl(i8* %1, i8* %2, double %3)
ret void
}
/* Variables and functions */
int strlen(char *);
int /*<<< orphan*/ strtcpy(char *, char *, int);
void strtcat(char *dest, char *src, size_t dest_size) {
  if (dest_size > 0) {
    int len = strlen(dest);
    int remaining = dest_size - len;
    strtcpy(dest + len, src, remaining);
  }
}


x86 assembly (clang, -O0):
<strtcat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jbe    1170 <strtcat+0x50>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1040 <strtcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtcat>:
test   %rdx,%rdx
je     1151 <strtcat+0x31>
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strlen@plt>
cltq
sub    %eax,%ebx
add    %rax,%r15
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <strtcpy@plt>
ret

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

LLVM IR (-O2):
define void @strtcat(i8* %0, i8* %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %12, label %5
5: ; preds = %3
%6 = tail call i32 @strlen(i8* %0)
%7 = sext i32 %6 to i64
%8 = trunc i64 %2 to i32
%9 = sub i32 %8, %6
%10 = getelementptr inbounds i8, i8* %0, i64 %7
%11 = tail call i32 @strtcpy(i8* %10, i8* %1, i32 %9)
br label %12
12: ; preds = %5, %3
ret void
}
int fn1(int p1, int p2) {
  int a, b;
  a = p1 >> 3 & p2;
  b = p1 & 072;
  a |= a >> 5;
  a |= b >> 5;
  return a;
}


x86 assembly (clang, -O0):
<fn1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x3,%eax
and    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    $0x3a,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x5,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
sar    $0x5,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn1>:
mov    %edi,%eax
sar    $0x3,%eax
and    %esi,%eax
shr    $0x5,%edi
and    $0x1,%edi
or     %eax,%edi
sar    $0x5,%eax
or     %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @fn1(i32 %0, i32 %1) {
%3 = ashr i32 %0, 3
%4 = and i32 %3, %1
%5 = ashr i32 %4, 5
%6 = lshr i32 %0, 5
%7 = and i32 %6, 1
%8 = or i32 %7, %4
%9 = or i32 %8, %5
ret i32 %9
}
double calculate_angle(double hh, double mm) {
  double angle;
  angle = mm * (360 / 60) - (hh + mm / 60) * (360 / 12);
  if (angle < 0)
    angle += 360;
  if (angle > 180)
    angle = 360 - angle;
  return angle;
}


x86 assembly (clang, -O0):
<calculate_angle>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
movsd  0xeeb(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
movsd  0xed3(%rip),%xmm2
mulsd  %xmm2,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xea8(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1185 <calculate_angle+0x85>
movsd  0xe9d(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe8e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11ae <calculate_angle+0xae>
movsd  0xe74(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_angle>:
movapd %xmm1,%xmm2
divsd  0xef4(%rip),%xmm2
addsd  %xmm0,%xmm2
mulsd  0xef0(%rip),%xmm2
mulsd  0xef0(%rip),%xmm1
addsd  %xmm2,%xmm1
movsd  0xeec(%rip),%xmm2
movapd %xmm1,%xmm0
addsd  %xmm2,%xmm0
xorpd  %xmm3,%xmm3
movapd %xmm1,%xmm4
cmpltsd %xmm3,%xmm4
andpd  %xmm4,%xmm0
andnpd %xmm1,%xmm4
orpd   %xmm0,%xmm4
subsd  %xmm4,%xmm2
movsd  0xec7(%rip),%xmm0
cmpltsd %xmm4,%xmm0
andpd  %xmm0,%xmm2
andnpd %xmm4,%xmm0
orpd   %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @calculate_angle(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %4
%7 = load double, double* %3
%8 = load double, double* %4
%9 = fdiv double %8, 6.000000e+01
%10 = fadd double %7, %9
%11 = fmul double %10, 3.000000e+01
%12 = fneg double %11
%13 = call double @llvm.fmuladd.f64(double %6, double 6.000000e+00, double %12)
store double %13, double* %5
%14 = load double, double* %5
%15 = fcmp olt double %14, 0.000000e+00
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = load double, double* %5
%18 = fadd double %17, 3.600000e+02
store double %18, double* %5
br label %19
19: ; preds = %16, %2
%20 = load double, double* %5
%21 = fcmp ogt double %20, 1.800000e+02
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load double, double* %5
%24 = fsub double 3.600000e+02, %23
store double %24, double* %5
br label %25
25: ; preds = %22, %19
%26 = load double, double* %5
ret double %26
}

LLVM IR (-O2):
define double @calculate_angle(double %0, double %1) {
%3 = fdiv double %1, 6.000000e+01
%4 = fadd double %3, %0
%5 = fmul double %4, -3.000000e+01
%6 = tail call double @llvm.fmuladd.f64(double %1, double 6.000000e+00, double %5)
%7 = fcmp olt double %6, 0.000000e+00
%8 = fadd double %6, 3.600000e+02
%9 = select i1 %7, double %8, double %6
%10 = fcmp ogt double %9, 1.800000e+02
%11 = fsub double 3.600000e+02, %9
%12 = select i1 %10, double %11, double %9
ret double %12
}
/* Variables and functions */
void *malloc(int);
void test3(int b) { void *w = malloc(b * sizeof(int)); }


x86 assembly (clang, -O0):
<test3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test3(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = mul i64 %5, 4
%7 = trunc i64 %6 to i32
%8 = call i8* @malloc(i32 %7)
store i8* %8, i8** %3
ret void
}

LLVM IR (-O2):
define void @test3(i32 %0) {
ret void
}
/* Variables and functions */
char MFRC522_Rd(char);
int /*<<< orphan*/ MFRC522_Wr(char, char);
void MFRC522_Clear_Bit(char addr, char mask) {
  MFRC522_Wr(addr, MFRC522_Rd(addr) & (~mask));
}


x86 assembly (clang, -O0):
<MFRC522_Clear_Bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    -0x1(%rbp),%al
mov    %al,-0x3(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <MFRC522_Rd@plt>
mov    -0x3(%rbp),%cl
movsbl %al,%eax
movsbl -0x2(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%eax
movsbl %cl,%edi
movsbl %al,%esi
call   1030 <MFRC522_Wr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MFRC522_Clear_Bit>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1040 <MFRC522_Rd@plt>
not    %bl
and    %al,%bl
movsbl %bl,%esi
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <MFRC522_Wr@plt>

LLVM IR (-O0):
define void @MFRC522_Clear_Bit(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = load i8, i8* %3
%7 = call signext i8 @MFRC522_Rd(i8 signext %6)
%8 = sext i8 %7 to i32
%9 = load i8, i8* %4
%10 = sext i8 %9 to i32
%11 = xor i32 %10, -1
%12 = and i32 %8, %11
%13 = trunc i32 %12 to i8
%14 = call i32 @MFRC522_Wr(i8 signext %5, i8 signext %13)
ret void
}

LLVM IR (-O2):
define void @MFRC522_Clear_Bit(i8 signext %0, i8 signext %1) {
%3 = tail call signext i8 @MFRC522_Rd(i8 signext %0)
%4 = xor i8 %1, -1
%5 = and i8 %3, %4
%6 = tail call i32 @MFRC522_Wr(i8 signext %0, i8 signext %5)
ret void
}
_Complex int dfn_rci(void) {
  return ({
    _Complex int x;
    __real__(x) = (5), __imag__(x) == (6);
    x;
  });
}


x86 assembly (clang, -O0):
<dfn_rci>:
push   %rbp
mov    %rsp,%rbp
movl   $0x5,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%eax
mov    %ecx,-0x18(%rbp)
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%eax
mov    %ecx,-0x8(%rbp)
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @dfn_rci() {
%1 = alloca { i32, i32 }
%2 = alloca { i32, i32 }
%3 = alloca { i32, i32 }
%4 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %2, i32 0, i32 0
store i32 5, i32* %4
%5 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %2, i32 0, i32 1
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 6
%8 = zext i1 %7 to i32
%9 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %2, i32 0, i32 0
%10 = load i32, i32* %9
%11 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %2, i32 0, i32 1
%12 = load i32, i32* %11
%13 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %3, i32 0, i32 0
%14 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %3, i32 0, i32 1
store i32 %10, i32* %13
store i32 %12, i32* %14
%15 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %3, i32 0, i32 0
%16 = load i32, i32* %15
%17 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %3, i32 0, i32 1
%18 = load i32, i32* %17
%19 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %1, i32 0, i32 0
%20 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %1, i32 0, i32 1
store i32 %16, i32* %19
store i32 %18, i32* %20
%21 = bitcast { i32, i32 }* %1 to i64*
%22 = load i64, i64* %21
ret i64 %22
}

LLVM IR (-O2):
define i64 @dfn_rci() {
ret i64 5
}
/* Variables and functions */
int /*<<< orphan*/ *strstr(char *, char *);
isHTTP(char *req) {
  if (strstr(req, "HTTP") != NULL)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isHTTP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strstr@plt>
cmp    $0x0,%rax
je     1142 <isHTTP+0x32>
movl   $0x1,-0x4(%rbp)
jmp    1149 <isHTTP+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isHTTP>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <strstr@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"HTTP\00"
define i32 @isHTTP(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32* @strstr(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i32* %5, null
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %2
br label %9
8: ; preds = %1
store i32 0, i32* %2
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
@.str = [5 x i8] c"HTTP\00"
define i32 @isHTTP(i8* %0) {
%2 = tail call i32* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp ne i32* %2, null
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int sub1();
int main(void) {
  int ignored = sub1();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @sub1()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ luaI_addchar(int /*<<< orphan*/);
int /*<<< orphan*/ luaI_addquoted(int /*<<< orphan*/);
int /*<<< orphan*/ lua_check_string(int, char *);
int write_string(int /*<<< orphan*/, int, int);
int write_quoted(int just, int m) {
  luaI_addchar(0);
  luaI_addquoted(lua_check_string(1, "write"));
  return write_string(luaI_addchar(0), just, m);
}


x86 assembly (clang, -O0):
<write_quoted>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %edi,%edi
call   1050 <luaI_addchar@plt>
mov    $0x1,%edi
lea    0xe9f(%rip),%rsi
call   1030 <lua_check_string@plt>
mov    %eax,%edi
call   1060 <luaI_addquoted@plt>
xor    %edi,%edi
call   1050 <luaI_addchar@plt>
mov    %eax,%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1040 <write_string@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_quoted>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
call   1050 <luaI_addchar@plt>
lea    0xeab(%rip),%rsi
mov    $0x1,%edi
call   1030 <lua_check_string@plt>
mov    %eax,%edi
call   1060 <luaI_addquoted@plt>
xor    %edi,%edi
call   1050 <luaI_addchar@plt>
mov    %eax,%edi
mov    %ebp,%esi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <write_string@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"write\00"
define i32 @write_quoted(i32 %0, i32 %1) {
%3 = tail call i32 @luaI_addchar(i32 0)
%4 = tail call i32 @lua_check_string(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @luaI_addquoted(i32 %4)
%6 = tail call i32 @luaI_addchar(i32 0)
%7 = tail call i32 @write_string(i32 %6, i32 %0, i32 %1)
ret i32 %7
}
int f_blg_mm2(float *a1, float *a2) {
  return !(__builtin_islessgreater(*a1, *a2));
}


x86 assembly (clang, -O0):
<f_blg_mm2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomiss (%rax),%xmm0
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_blg_mm2>:
movss  (%rdi),%xmm0
xor    %eax,%eax
ucomiss (%rsi),%xmm0
sete   %al
ret

LLVM IR (-O0):
define i32 @f_blg_mm2(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* %5
%7 = load float*, float** %4
%8 = load float, float* %7
%9 = fcmp one float %6, %8
%10 = xor i1 %9, true
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @f_blg_mm2(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = load float, float* %1
%5 = fcmp ueq float %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
extern int f(int a) { return a; }


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

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

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

LLVM IR (-O2):
define i32 @f(i32 returned %0) {
ret i32 %0
}
double PrimeAngle(x)
double x;
{
  x = x - 360.0 * floor(x / 360.0);
  return x;
}


x86 assembly (clang, -O0):
<PrimeAngle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed4(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <floor@plt>
movsd  -0x10(%rbp),%xmm1
movsd  0xeb6(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrimeAngle>:
push   %rax
movsd  %xmm0,(%rsp)
divsd  0xee2(%rip),%xmm0
call   1030 <floor@plt>
mulsd  0xedd(%rip),%xmm0
addsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @PrimeAngle(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fdiv double %4, 3.600000e+02
%6 = call double @llvm.floor.f64(double %5)
%7 = call double @llvm.fmuladd.f64(double -3.600000e+02, double %6, double %3)
store double %7, double* %2
%8 = load double, double* %2
ret double %8
}

LLVM IR (-O2):
define double @PrimeAngle(double %0) {
%2 = fdiv double %0, 3.600000e+02
%3 = tail call double @llvm.floor.f64(double %2)
%4 = tail call double @llvm.fmuladd.f64(double %3, double -3.600000e+02, double %0)
ret double %4
}
/* Variables and functions */
int write(int, char *, int);
int write_pipe(int s, char *buf, int len) { return write(s, buf, len); }


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

x86 assembly (clang, -O2):
<write_pipe>:
jmp    1030 <write@plt>

LLVM IR (-O0):
define i32 @write_pipe(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 i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @write(i32 %7, i8* %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @write_pipe(i32 %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
void pnstr(char *s, int c) {
  char string[132 + 1];
  if (c > 132)
    c = 132;
  strncpy(string, s, c);
  string[c] = '\0';
  printf("%s", string);
}


x86 assembly (clang, -O0):
<pnstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x84,-0xc(%rbp)
jle    1146 <pnstr+0x26>
movl   $0x84,-0xc(%rbp)
lea    -0xa0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
movslq -0xc(%rbp),%rax
movb   $0x0,-0xa0(%rbp,%rax,1)
lea    -0xa0(%rbp),%rsi
lea    0xe8d(%rip),%rdi
call   1040 <printf@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pnstr>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rdi,%rax
cmp    $0x84,%esi
mov    $0x84,%ebx
cmovl  %esi,%ebx
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rax,%rsi
mov    %ebx,%edx
call   1030 <strncpy@plt>
movslq %ebx,%rax
movb   $0x0,(%rsp,%rax,1)
lea    0xea7(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @pnstr(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [133 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 132
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 132, i32* %4
br label %9
9: ; preds = %8, %2
%10 = getelementptr inbounds [133 x i8], [133 x i8]* %5, i64 0, i64 0
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = call i32 @strncpy(i8* %10, i8* %11, i32 %12)
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [133 x i8], [133 x i8]* %5, i64 0, i64 %15
store i8 0, i8* %16
%17 = getelementptr inbounds [133 x i8], [133 x i8]* %5, i64 0, i64 0
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %17)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @pnstr(i8* %0, i32 %1) {
%3 = alloca [133 x i8]
%4 = getelementptr inbounds [133 x i8], [133 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %1, 132
%6 = select i1 %5, i32 %1, i32 132
%7 = call i32 @strncpy(i8* %4, i8* %0, i32 %6)
%8 = sext i32 %6 to i64
%9 = getelementptr inbounds [133 x i8], [133 x i8]* %3, i64 0, i64 %8
store i8 0, i8* %9
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}
int supported_arch(void) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @supported_arch() {
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128d;

/* Variables and functions */
int /*<<< orphan*/ _mm_load_sd(void *);
__m128d test_load_sd(void *y) { return _mm_load_sd(y); }


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

x86 assembly (clang, -O2):
<test_load_sd>:
jmp    1030 <_mm_load_sd@plt>

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

LLVM IR (-O2):
define i32 @test_load_sd(i8* %0) {
%2 = tail call i32 @_mm_load_sd(i8* %0)
ret i32 %2
}
/* Type definitions */
typedef scalar_t__ volatile uint32_t;

/* Variables and functions */
uint32_t ADCComparatorIntStatus(uint32_t ui32Base) {
  ;
  return ((*((volatile uint32_t *)(ui32Base + 0x00000034))));
}


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

x86 assembly (clang, -O2):
<ADCComparatorIntStatus>:
mov    %rdi,-0x8(%rsp)
mov    -0x8(%rsp),%rax
mov    0x34(%rax),%rax
ret

LLVM IR (-O0):
define i64 @ADCComparatorIntStatus(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* %2
%4 = add nsw i64 %3, 52
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @ADCComparatorIntStatus(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* %2
%4 = add nsw i64 %3, 52
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
ret i64 %6
}
const char *ajAsseminTypeGetFields(void) { return "id acc"; }


x86 assembly (clang, -O0):
<ajAsseminTypeGetFields>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [7 x i8] c"id acc\00"
define i8* @ajAsseminTypeGetFields() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [7 x i8] c"id acc\00"
define i8* @ajAsseminTypeGetFields() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}
unsigned int hash_function(const char *str, unsigned htab_size) {
  unsigned int h = 0;
  const unsigned char *p;
  for (p = (const unsigned char *)str; *p != '\0'; p++)
    h = 65599 * h + *p;
  return h % htab_size;
}


x86 assembly (clang, -O0):
<hash_function>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
je     114e <hash_function+0x4e>
imul   $0x1003f,-0x10(%rbp),%eax
mov    -0x18(%rbp),%rcx
movzbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    111a <hash_function+0x1a>
mov    -0x10(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_function>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <hash_function+0x28>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movzbl %cl,%ecx
imul   $0x1003f,%eax,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash_function+0x10>
jmp    112a <hash_function+0x2a>
xor    %eax,%eax
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @hash_function(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i8* [ %12, %5 ], [ %0, %2 ]
%8 = phi i32 [ %11, %5 ], [ 0, %2 ]
%9 = zext i8 %6 to i32
%10 = mul i32 %8, 65599
%11 = add i32 %10, %9
%12 = getelementptr inbounds i8, i8* %7, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i32 [ 0, %2 ], [ %11, %5 ]
%17 = urem i32 %16, %1
ret i32 %17
}
/* Variables and functions */
long update_lcd(long);
long update_graphics(long cycles) { return update_lcd(cycles); }


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

x86 assembly (clang, -O2):
<update_graphics>:
jmp    1030 <update_lcd@plt>

LLVM IR (-O0):
define i64 @update_graphics(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 @update_lcd(i64 %3)
ret i64 %4
}

LLVM IR (-O2):
define i64 @update_graphics(i64 %0) {
%2 = tail call i64 @update_lcd(i64 %0)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void minuscconlys(unsigned short a, unsigned short b) {
  unsigned short difference = a - b;
  if (difference > a)
    abort();
}


x86 assembly (clang, -O0):
<minuscconlys>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movzwl -0x2(%rbp),%eax
movzwl -0x4(%rbp),%ecx
sub    %ecx,%eax
mov    %ax,-0x6(%rbp)
movzwl -0x6(%rbp),%eax
movzwl -0x2(%rbp),%ecx
cmp    %ecx,%eax
jle    114b <minuscconlys+0x3b>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<minuscconlys>:
cmp    %di,%si
ja     1116 <minuscconlys+0x6>
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @minuscconlys(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
%5 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%6 = load i16, i16* %3
%7 = zext i16 %6 to i32
%8 = load i16, i16* %4
%9 = zext i16 %8 to i32
%10 = sub nsw i32 %7, %9
%11 = trunc i32 %10 to i16
store i16 %11, i16* %5
%12 = load i16, i16* %5
%13 = zext i16 %12 to i32
%14 = load i16, i16* %3
%15 = zext i16 %14 to i32
%16 = icmp sgt i32 %13, %15
br i1 %16, label %17, label %19
17: ; preds = %2
%18 = call i32 (...) @abort()
unreachable
19: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @minuscconlys(i16 zeroext %0, i16 zeroext %1) {
%3 = icmp ugt i16 %1, %0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @abort()
unreachable
6: ; preds = %2
ret void
}
SORU_9_PROTOTYPE() {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<SORU_9_PROTOTYPE>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <SORU_9_PROTOTYPE+0x9>
jmp    1109 <SORU_9_PROTOTYPE+0x9>

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

LLVM IR (-O0):
define i32 @SORU_9_PROTOTYPE() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define i32 @SORU_9_PROTOTYPE() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ OutputPpt(unsigned int);
void JTAG_SET(unsigned int value) { OutputPpt(value); }


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

x86 assembly (clang, -O2):
<JTAG_SET>:
jmp    1030 <OutputPpt@plt>

LLVM IR (-O0):
define void @JTAG_SET(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @OutputPpt(i32 %3)
ret void
}

LLVM IR (-O2):
define void @JTAG_SET(i32 %0) {
%2 = tail call i32 @OutputPpt(i32 %0)
ret void
}
int test_imm_B6int16_reg(short val) {
  return ((val) & (0xB6 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_B6int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xb6,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_B6int16_reg>:
test   $0xb6,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_B6int16_reg(i16 signext %0) {
%2 = and i16 %0, 182
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
void *count(void *arg) {
  int i = 1;
  while (1) {
    sleep(1);
    printf("sec: %d\n", i++);
  }
}


x86 assembly (clang, -O0):
<count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    -0xc(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    %eax,-0xc(%rbp)
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
jmp    1133 <count+0x13>

x86 assembly (clang, -O2):
<count>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%ebx
lea    0xed0(%rip),%r14
mov    $0x1,%edi
call   1040 <sleep@plt>
lea    0x1(%rbx),%ebp
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebp,%ebx
jmp    1130 <count+0x10>

LLVM IR (-O0):
@.str = [9 x i8] c"sec: %d\0A\00"
define i8* @count(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 1, i32* %3
br label %4
4: ; preds = %1, %4
%5 = call i32 @sleep(i32 1)
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 1
store i32 %7, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %4
}

LLVM IR (-O2):
@.str = [9 x i8] c"sec: %d\0A\00"
define noalias i8* @count(i8* nocapture readnone %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 1, %1 ], [ %5, %2 ]
%4 = tail call i32 @sleep(i32 1)
%5 = add nuw nsw i32 %3, 1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %3)
br label %2
}
double getFirstElement(double *vector) { return *vector; }


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

x86 assembly (clang, -O2):
<getFirstElement>:
movsd  (%rdi),%xmm0
ret

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

LLVM IR (-O2):
define double @getFirstElement(double* nocapture %0) {
%2 = load double, double* %0
ret double %2
}
void p0(void) { char b[1025]; }


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

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

LLVM IR (-O0):
define void @p0() {
%1 = alloca [1025 x i8]
ret void
}

LLVM IR (-O2):
define void @p0() {
ret void
}
int fun908() { return 908; }


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

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

LLVM IR (-O0):
define i32 @fun908() {
ret i32 908
}

LLVM IR (-O2):
define i32 @fun908() {
ret i32 908
}
int places(int num) {
  int i = 0;
  while (num > 10) {
    num = num / 10;
    i++;
  }
  return i;
}


x86 assembly (clang, -O0):
<places>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x4(%rbp)
jle    1134 <places+0x34>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <places+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<places>:
xor    %eax,%eax
cmp    $0xb,%edi
jl     1124 <places+0x24>
xor    %eax,%eax
mov    $0xcccccccd,%ecx
xchg   %ax,%ax
mov    %edi,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
add    $0x1,%eax
cmp    $0x6d,%edi
mov    %edx,%edi
ja     1110 <places+0x10>
ret

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

LLVM IR (-O2):
define i32 @places(i32 %0) {
%2 = icmp sgt i32 %0, 10
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = udiv i32 %5, 10
%7 = add nuw nsw i32 %4, 1
%8 = icmp ugt i32 %5, 109
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %10
}