xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int hostname_setup();
int /*<<< orphan*/ stderr;
char *strerror(int);
int main(int argc, char *argv[]) {
  int r;
  if ((r = hostname_setup()) < 0)
    fprintf(stderr, "hostname: %s\n", strerror(-r));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <hostname_setup@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1181 <main+0x51>
mov    0x2e80(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
xor    %edi,%edi
sub    -0x14(%rbp),%edi
call   1050 <strerror@plt>
mov    -0x18(%rbp),%edi
mov    %rax,%rdx
lea    0xe84(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <hostname_setup@plt>
test   %eax,%eax
jns    115f <main+0x2f>
mov    0x2e9d(%rip),%rcx
mov    (%rcx),%ebx
neg    %eax
mov    %eax,%edi
call   1050 <strerror@plt>
lea    0xeab(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [14 x i8] c"hostname: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @hostname_setup()
store i32 %7, i32* %6
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i32, i32* %6
%12 = sub nsw i32 0, %11
%13 = call i8* @strerror(i32 %12)
%14 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %13)
br label %15
15: ; preds = %9, %2
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [14 x i8] c"hostname: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @hostname_setup()
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = sub nsw i32 0, %3
%8 = tail call i8* @strerror(i32 %7)
%9 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %10
10: ; preds = %5, %2
ret i32 0
}
void co_RestoreConfig(void) {}


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

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

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

LLVM IR (-O2):
define void @co_RestoreConfig() {
ret void
}
void pa_print_kpt(struct page_table_info *pt) { (void)pt; }


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

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

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

LLVM IR (-O2):
%struct.page_table_info = type opaque
define void @pa_print_kpt(%struct.page_table_info* nocapture %0) {
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ y1;
};
typedef TYPE_1__ XSegment;

/* Variables and functions */
short get_XSegment_y1(void *_p) { return (short)((XSegment *)_p)->y1; }


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

x86 assembly (clang, -O2):
<get_XSegment_y1>:
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define signext i16 @get_XSegment_y1(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i16
ret i16 %7
}

LLVM IR (-O2):
define signext i16 @get_XSegment_y1(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i16
ret i16 %4
}
int isPrint(int c) { return c >= ' ' && c < 0x7f; }


x86 assembly (clang, -O0):
<isPrint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <isPrint+0x20>
cmpl   $0x7f,-0x4(%rbp)
setl   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @isPrint(i32 %0) {
%2 = add i32 %0, -32
%3 = icmp ult i32 %2, 95
%4 = zext i1 %3 to i32
ret i32 %4
}
int test_imm_2Cint16_mem(short *val) {
  return ((*val) & (-0x2C << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_2Cint16_mem>:
movzwl (%rdi),%eax
test   $0xffd4,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_2Cint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -44
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ delay(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
const char *httpd_on_recv(const char *req, void *arg_) {
  printf("recv a request, wait 5 sec...\n");
  delay(5, 0, 0);
  printf("%s.\n", req);
  return req;
}


x86 assembly (clang, -O0):
<httpd_on_recv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x5,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1040 <delay@plt>
mov    -0x8(%rbp),%rsi
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<httpd_on_recv>:
push   %rbx
mov    %rdi,%rbx
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
mov    $0x5,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <delay@plt>
lea    0xeab(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"recv a request, wait 5 sec...\0A\00"
@.str.1 = [5 x i8] c"%s.\0A\00"
define i8* @httpd_on_recv(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @delay(i32 5, i32 0, i32 0)
%7 = load i8*, i8** %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = load i8*, i8** %3
ret i8* %9
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%s.\0A\00"
@str = [30 x i8] c"recv a request, wait 5 sec...\00"
define i8* @httpd_on_recv(i8* returned %0, i8* nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @delay(i32 5, i32 0, i32 0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ HandleAnimation(int);
void DoAnimation() { HandleAnimation(1); }


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

x86 assembly (clang, -O2):
<DoAnimation>:
mov    $0x1,%edi
jmp    1030 <HandleAnimation@plt>

LLVM IR (-O0):
define void @DoAnimation() {
%1 = call i32 @HandleAnimation(i32 1)
ret void
}

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

/* Variables and functions */
uint64_t swap64_c(uint64_t x) {
  uint32_t a = x >> 32;
  uint32_t b = (uint32_t)x;
  return ((uint64_t)((((((b)) >> (8)) | (((b)) << (32 - (8)))) & 0xff00ff00L) |
                     (((((b)) << (8)) | (((b)) >> (32 - (8)))) & 0x00ff00ffL))
          << 32) |
         (uint64_t)((((((a)) >> (8)) | (((a)) << (32 - (8)))) & 0xff00ff00L) |
                    (((((a)) << (8)) | (((a)) >> (32 - (8)))) & 0x00ff00ffL));
}


x86 assembly (clang, -O0):
<swap64_c>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
mov    -0xc(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
cltq
movabs $0xff00ff00,%rcx
and    %rcx,%rax
mov    -0xc(%rbp),%ecx
shl    $0x8,%ecx
mov    -0xc(%rbp),%edx
sar    $0x18,%edx
or     %edx,%ecx
movslq %ecx,%rcx
and    $0xff00ff,%rcx
or     %rcx,%rax
mov    $0x20,%ecx
shl    %cl,%eax
mov    -0x8(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x8(%rbp),%edx
shl    $0x18,%edx
or     %edx,%ecx
movslq %ecx,%rcx
movabs $0xff00ff00,%rdx
and    %rdx,%rcx
mov    -0x8(%rbp),%edx
shl    $0x8,%edx
mov    -0x8(%rbp),%esi
sar    $0x18,%esi
or     %esi,%edx
movslq %edx,%rdx
and    $0xff00ff,%rdx
or     %rdx,%rcx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @swap64_c(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = ashr i32 %5, 32
store i32 %6, i32* %3
%7 = load i32, i32* %2
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = ashr i32 %8, 8
%10 = load i32, i32* %4
%11 = shl i32 %10, 24
%12 = or i32 %9, %11
%13 = sext i32 %12 to i64
%14 = and i64 %13, 4278255360
%15 = load i32, i32* %4
%16 = shl i32 %15, 8
%17 = load i32, i32* %4
%18 = ashr i32 %17, 24
%19 = or i32 %16, %18
%20 = sext i32 %19 to i64
%21 = and i64 %20, 16711935
%22 = or i64 %14, %21
%23 = trunc i64 %22 to i32
%24 = shl i32 %23, 32
%25 = load i32, i32* %3
%26 = ashr i32 %25, 8
%27 = load i32, i32* %3
%28 = shl i32 %27, 24
%29 = or i32 %26, %28
%30 = sext i32 %29 to i64
%31 = and i64 %30, 4278255360
%32 = load i32, i32* %3
%33 = shl i32 %32, 8
%34 = load i32, i32* %3
%35 = ashr i32 %34, 24
%36 = or i32 %33, %35
%37 = sext i32 %36 to i64
%38 = and i64 %37, 16711935
%39 = or i64 %31, %38
%40 = trunc i64 %39 to i32
%41 = or i32 %24, %40
ret i32 %41
}

LLVM IR (-O2):
define i32 @swap64_c(i32 %0) {
ret i32 poison
}
int scan_white(c)
int c;
{ return is_white(c); }


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

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

LLVM IR (-O0):
define i32 @scan_white(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i32, ...) bitcast (i32 (...)* @is_white to i32 (i32, ...)*)(i32 %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @scan_white(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @is_white to i32 (i32, ...)*)(i32 %0)
ret i32 %2
}
/* Variables and functions */
int eventfd(int, int);
int main() {
  int fd = eventfd(0, 0);
  fd = eventfd(-1, 0);
  fd = eventfd(4, -1);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
call   1030 <eventfd@plt>
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1030 <eventfd@plt>
mov    $0x4,%edi
mov    $0xffffffff,%esi
call   1030 <eventfd@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 @eventfd(i32 0, i32 0)
store i32 %3, i32* %2
%4 = call i32 @eventfd(i32 -1, i32 0)
store i32 %4, i32* %2
%5 = call i32 @eventfd(i32 4, i32 -1)
store i32 %5, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @eventfd(i32 0, i32 0)
%2 = tail call i32 @eventfd(i32 -1, i32 0)
%3 = tail call i32 @eventfd(i32 4, i32 -1)
ret i32 0
}
int test_imm_4Euint16_reg(unsigned short val) {
  return ((val) & (-0x4E << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_4Euint16_reg>:
test   $0xffb2,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_4Euint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, -78
%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_4Euint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -78
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int end_index(int *, int);
int start_index(int *, int);
int test_ordered() {
  int n[] = {1, 3, 6, 7, 8, 10, 13, 21, 23, 28};
  return -1 == start_index(n, 10) && -1 == end_index(n, 10);
}


x86 assembly (clang, -O0):
<test_ordered>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1040 <start_index@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0xffffffff,%ecx
cmp    %edx,%ecx
mov    %al,-0x31(%rbp)
jne    118c <test_ordered+0x5c>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1030 <end_index@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ordered>:
sub    $0x28,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
call   1040 <start_index@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
je     1162 <test_ordered+0x42>
add    $0x28,%rsp
ret
mov    %rsp,%rdi
mov    $0xa,%esi
call   1030 <end_index@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
sete   %al
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.test_ordered.n = [10 x i32] [i32 1, i32 3, i32 6, i32 7, i32 8, i32 10, i32 13, i32 21, i32 23, i32 28]
define i32 @test_ordered() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @start_index(i32* %3, i32 10)
%5 = icmp eq i32 -1, %4
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%8 = call i32 @end_index(i32* %7, i32 10)
%9 = icmp eq i32 -1, %8
br label %10
10: ; preds = %6, %0
%11 = phi i1 [ false, %0 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
@__const.test_ordered.n = [10 x i32] [i32 1, i32 3, i32 6, i32 7, i32 8, i32 10, i32 13, i32 21, i32 23, i32 28]
define i32 @test_ordered() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @start_index(i32* %3, i32 10)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = call i32 @end_index(i32* %3, i32 10)
%8 = icmp eq i32 %7, -1
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %0
%11 = phi i32 [ 0, %0 ], [ %9, %6 ]
ret i32 %11
}
int df_2dbinary(this_plot)
struct curve_points *this_plot;
{
  int_error("Binary file format for 2d data not yet defined", (-1));
  return 0;
}


x86 assembly (clang, -O0):
<df_2dbinary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0xffffffff,%esi
mov    $0x0,%al
call   1030 <int_error@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<df_2dbinary>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1030 <int_error@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.curve_points = type opaque
@.str = [47 x i8] c"Binary file format for 2d data not yet defined\00"
define i32 @df_2dbinary(%struct.curve_points* %0) {
%2 = alloca %struct.curve_points*
store %struct.curve_points* %0, %struct.curve_points** %2
%3 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @int_error to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 -1)
ret i32 0
}

LLVM IR (-O2):
%struct.curve_points = type opaque
@.str = [47 x i8] c"Binary file format for 2d data not yet defined\00"
define i32 @df_2dbinary(%struct.curve_points* nocapture readnone %0) {
%2 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @int_error to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 -1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ prologue(char *);
void form_basedefs(void) { prologue("form"); }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"form\00"
define void @form_basedefs() {
%1 = tail call i32 @prologue(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void main() { printf("Test main and make sure it works."); }


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

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

LLVM IR (-O0):
@.str = [34 x i8] c"Test main and make sure it works.\00"
define void @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"Test main and make sure it works.\00"
define void @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
ret void
}
int cmp_int(void *a, void *b) { return *(int *)a > *(int *)b; }


x86 assembly (clang, -O0):
<cmp_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_int>:
mov    (%rdi),%ecx
xor    %eax,%eax
cmp    (%rsi),%ecx
setg   %al
ret

LLVM IR (-O0):
define i32 @cmp_int(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = icmp sgt i32 %7, %10
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @cmp_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp sgt i32 %4, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
int ti_mom_start(double const *options) { return (int)options[0]; }


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

x86 assembly (clang, -O2):
<ti_mom_start>:
cvttsd2si (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @ti_mom_start(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 0
%5 = load double, double* %4
%6 = fptosi double %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @ti_mom_start(double* nocapture %0) {
%2 = load double, double* %0
%3 = fptosi double %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ tel_init();
int /*<<< orphan*/ telopt(int, int, int);
void term_init() {
  tel_init();
  telopt(1, 251, 3);
  telopt(1, 253, 3);
  telopt(1, 251, 0);
  telopt(1, 253, 0);
  telopt(1, 251, 1);
  telopt(1, 253, 31);
}


x86 assembly (clang, -O0):
<term_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <tel_init@plt>
mov    $0x1,%edi
mov    $0xfb,%esi
mov    $0x3,%edx
call   1030 <telopt@plt>
mov    $0x1,%edi
mov    $0xfd,%esi
mov    $0x3,%edx
call   1030 <telopt@plt>
mov    $0x1,%edi
mov    $0xfb,%esi
xor    %edx,%edx
call   1030 <telopt@plt>
mov    $0x1,%edi
mov    $0xfd,%esi
xor    %edx,%edx
call   1030 <telopt@plt>
mov    $0x1,%edx
mov    $0xfb,%esi
mov    %edx,%edi
call   1030 <telopt@plt>
mov    $0x1,%edi
mov    $0xfd,%esi
mov    $0x1f,%edx
call   1030 <telopt@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<term_init>:
push   %rax
xor    %eax,%eax
call   1040 <tel_init@plt>
mov    $0x1,%edi
mov    $0xfb,%esi
mov    $0x3,%edx
call   1030 <telopt@plt>
mov    $0x1,%edi
mov    $0xfd,%esi
mov    $0x3,%edx
call   1030 <telopt@plt>
mov    $0x1,%edi
mov    $0xfb,%esi
xor    %edx,%edx
call   1030 <telopt@plt>
mov    $0x1,%edi
mov    $0xfd,%esi
xor    %edx,%edx
call   1030 <telopt@plt>
mov    $0x1,%edi
mov    $0xfb,%esi
mov    $0x1,%edx
call   1030 <telopt@plt>
mov    $0x1,%edi
mov    $0xfd,%esi
mov    $0x1f,%edx
pop    %rax
jmp    1030 <telopt@plt>

LLVM IR (-O0):
define void @term_init() {
%1 = call i32 (...) @tel_init()
%2 = call i32 @telopt(i32 1, i32 251, i32 3)
%3 = call i32 @telopt(i32 1, i32 253, i32 3)
%4 = call i32 @telopt(i32 1, i32 251, i32 0)
%5 = call i32 @telopt(i32 1, i32 253, i32 0)
%6 = call i32 @telopt(i32 1, i32 251, i32 1)
%7 = call i32 @telopt(i32 1, i32 253, i32 31)
ret void
}

LLVM IR (-O2):
define void @term_init() {
%1 = tail call i32 (...) @tel_init()
%2 = tail call i32 @telopt(i32 1, i32 251, i32 3)
%3 = tail call i32 @telopt(i32 1, i32 253, i32 3)
%4 = tail call i32 @telopt(i32 1, i32 251, i32 0)
%5 = tail call i32 @telopt(i32 1, i32 253, i32 0)
%6 = tail call i32 @telopt(i32 1, i32 251, i32 1)
%7 = tail call i32 @telopt(i32 1, i32 253, i32 31)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ log(double);
int sqrt(double);
double tanh(int /*<<< orphan*/);
double f(double t) {
  double val = tanh(log(t));
  return sqrt(1 + val * val) * sqrt(t) / (1 + t * t);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <log@plt>
mov    %eax,%edi
call   1030 <tanh@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe97(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
mov    %eax,-0x14(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe5f(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
call   1040 <log@plt>
mov    %eax,%edi
call   1030 <tanh@plt>
mulsd  %xmm0,%xmm0
addsd  0xead(%rip),%xmm0
call   1050 <sqrt@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1050 <sqrt@plt>
imul   %ebx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm1
addsd  0xe7f(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @f(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call i32 @log(double %4)
%6 = call double @tanh(i32 %5)
store double %6, double* %3
%7 = load double, double* %3
%8 = load double, double* %3
%9 = call double @llvm.fmuladd.f64(double %7, double %8, double 1.000000e+00)
%10 = call i32 @sqrt(double %9)
%11 = load double, double* %2
%12 = call i32 @sqrt(double %11)
%13 = mul nsw i32 %10, %12
%14 = sitofp i32 %13 to double
%15 = load double, double* %2
%16 = load double, double* %2
%17 = call double @llvm.fmuladd.f64(double %15, double %16, double 1.000000e+00)
%18 = fdiv double %14, %17
ret double %18
}

LLVM IR (-O2):
define double @f(double %0) {
%2 = tail call i32 @log(double %0)
%3 = tail call double @tanh(i32 %2)
%4 = tail call double @llvm.fmuladd.f64(double %3, double %3, double 1.000000e+00)
%5 = tail call i32 @sqrt(double %4)
%6 = tail call i32 @sqrt(double %0)
%7 = mul nsw i32 %6, %5
%8 = sitofp i32 %7 to double
%9 = tail call double @llvm.fmuladd.f64(double %0, double %0, double 1.000000e+00)
%10 = fdiv double %8, %9
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ WriteTag(int);
void BeginScene() { WriteTag(0xC8); }


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

x86 assembly (clang, -O2):
<BeginScene>:
mov    $0xc8,%edi
jmp    1030 <WriteTag@plt>

LLVM IR (-O0):
define void @BeginScene() {
%1 = call i32 @WriteTag(i32 200)
ret void
}

LLVM IR (-O2):
define void @BeginScene() {
%1 = tail call i32 @WriteTag(i32 200)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int age = 24;
  int height = 180;
  printf("I am %d years old.\n", age);
  printf("I am %d centimeters tall.\n", height);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x18,-0x8(%rbp)
movl   $0xb4,-0xc(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [20 x i8] c"I am %d years old.\0A\00"
@.str.1 = [27 x i8] c"I am %d centimeters tall.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 24, i32* %2
store i32 180, i32* %3
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"I am %d years old.\0A\00"
@.str.1 = [27 x i8] c"I am %d centimeters tall.\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 24)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 180)
ret i32 0
}
int Quit(int argc, char *argv[]) {}


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

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

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

LLVM IR (-O2):
define i32 @Quit(i32 %0, i8** nocapture readnone %1) {
ret i32 undef
}
int validate_race_input(int input) {
  switch (input) {
  case '1':
    return 0;
  case '2':
    return 1;
  case '3':
    return 2;
  case '4':
    return 3;
  default:
    return -1;
  }
}


x86 assembly (clang, -O0):
<validate_race_input>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffcf,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     1160 <validate_race_input+0x60>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x4(%rbp)
jmp    1167 <validate_race_input+0x67>
movl   $0x1,-0x4(%rbp)
jmp    1167 <validate_race_input+0x67>
movl   $0x2,-0x4(%rbp)
jmp    1167 <validate_race_input+0x67>
movl   $0x3,-0x4(%rbp)
jmp    1167 <validate_race_input+0x67>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_race_input>:
lea    -0x31(%rdi),%ecx
cmp    $0x4,%ecx
mov    $0xffffffff,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @validate_race_input(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %9 [
i32 49, label %5
i32 50, label %6
i32 51, label %7
i32 52, label %8
]
5: ; preds = %1
store i32 0, i32* %2
br label %10
6: ; preds = %1
store i32 1, i32* %2
br label %10
7: ; preds = %1
store i32 2, i32* %2
br label %10
8: ; preds = %1
store i32 3, i32* %2
br label %10
9: ; preds = %1
store i32 -1, i32* %2
br label %10
10: ; preds = %9, %8, %7, %6, %5
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
define i32 @validate_race_input(i32 %0) {
%2 = add i32 %0, -49
%3 = icmp ult i32 %2, 4
%4 = select i1 %3, i32 %2, i32 -1
ret i32 %4
}
/* Type definitions */
typedef size_t uint32_t;

/* Variables and functions */
size_t double_hash(double val) {
  if (sizeof(double) == sizeof(size_t)) {
    union {
      double d;
      size_t i;
    } v = {val};
    return v.i;
  } else {
    union {
      double d;
      uint32_t u[2];
    } v = {val};
    size_t seed = v.u[0];
    size_t hash = v.u[1];
    seed ^= hash + (seed << 6) + (seed >> 2);
    return seed;
  }
}


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

x86 assembly (clang, -O2):
<double_hash>:
movq   %xmm0,%rax
ret

LLVM IR (-O0):
%union.anon = type { double }
define i64 @double_hash(double %0) {
%2 = alloca double
%3 = alloca %union.anon
store double %0, double* %2
%4 = bitcast %union.anon* %3 to double*
%5 = load double, double* %2
store double %5, double* %4
%6 = bitcast %union.anon* %3 to i64*
%7 = load i64, i64* %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @double_hash(double %0) {
%2 = bitcast double %0 to i64
ret i64 %2
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
bool softfloat_le128(uint64_t a64, uint64_t a0, uint64_t b64, uint64_t b0) {
  return (a64 < b64) || ((a64 == b64) && (a0 <= b0));
}


x86 assembly (clang, -O0):
<softfloat_le128>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0x1,%al
cmp    -0x18(%rbp),%rcx
mov    %al,-0x21(%rbp)
jl     114e <softfloat_le128+0x4e>
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmp    -0x18(%rbp),%rcx
mov    %al,-0x22(%rbp)
jne    1148 <softfloat_le128+0x48>
mov    -0x10(%rbp),%rax
cmp    -0x20(%rbp),%rax
setle  %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<softfloat_le128>:
cmp    %rdx,%rdi
setl   %al
sete   %dl
cmp    %rcx,%rsi
setle  %cl
and    %dl,%cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @softfloat_le128(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = load i64, i64* %5
%10 = load i64, i64* %7
%11 = icmp slt i64 %9, %10
br i1 %11, label %22, label %12
12: ; preds = %4
%13 = load i64, i64* %5
%14 = load i64, i64* %7
%15 = icmp eq i64 %13, %14
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i64, i64* %6
%18 = load i64, i64* %8
%19 = icmp sle i64 %17, %18
br label %20
20: ; preds = %16, %12
%21 = phi i1 [ false, %12 ], [ %19, %16 ]
br label %22
22: ; preds = %20, %4
%23 = phi i1 [ true, %4 ], [ %21, %20 ]
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @softfloat_le128(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = icmp slt i64 %0, %2
%6 = icmp eq i64 %0, %2
%7 = icmp sle i64 %1, %3
%8 = and i1 %6, %7
%9 = or i1 %5, %8
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ resetFlag(int);
int /*<<< orphan*/ setFlag(int);
unsigned char inc(unsigned char value) {
  if ((value & 0x0F) == 0x0F)
    setFlag(5);
  else
    resetFlag(5);
  value = value + 1;
  if (value == 0)
    setFlag(7);
  else
    resetFlag(7);
  resetFlag(6);
  return value;
}


x86 assembly (clang, -O0):
<inc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0xf,%eax
cmp    $0xf,%eax
jne    114d <inc+0x2d>
mov    $0x5,%edi
call   1030 <setFlag@plt>
jmp    1157 <inc+0x37>
mov    $0x5,%edi
call   1040 <resetFlag@plt>
movzbl -0x1(%rbp),%eax
add    $0x1,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x0,%eax
jne    117d <inc+0x5d>
mov    $0x7,%edi
call   1030 <setFlag@plt>
jmp    1187 <inc+0x67>
mov    $0x7,%edi
call   1040 <resetFlag@plt>
mov    $0x6,%edi
call   1040 <resetFlag@plt>
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inc>:
push   %rbx
mov    %edi,%ebx
mov    %ebx,%eax
not    %al
mov    $0x5,%edi
test   $0xf,%al
jne    1137 <inc+0x17>
call   1030 <setFlag@plt>
jmp    113c <inc+0x1c>
call   1040 <resetFlag@plt>
mov    $0x7,%edi
inc    %bl
jne    114c <inc+0x2c>
call   1030 <setFlag@plt>
jmp    1151 <inc+0x31>
call   1040 <resetFlag@plt>
mov    $0x6,%edi
call   1040 <resetFlag@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i8 @inc(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 15
%6 = icmp eq i32 %5, 15
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @setFlag(i32 5)
br label %11
9: ; preds = %1
%10 = call i32 @resetFlag(i32 5)
br label %11
11: ; preds = %9, %7
%12 = load i8, i8* %2
%13 = zext i8 %12 to i32
%14 = add nsw i32 %13, 1
%15 = trunc i32 %14 to i8
store i8 %15, i8* %2
%16 = load i8, i8* %2
%17 = zext i8 %16 to i32
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %11
%20 = call i32 @setFlag(i32 7)
br label %23
21: ; preds = %11
%22 = call i32 @resetFlag(i32 7)
br label %23
23: ; preds = %21, %19
%24 = call i32 @resetFlag(i32 6)
%25 = load i8, i8* %2
ret i8 %25
}

LLVM IR (-O2):
define zeroext i8 @inc(i8 zeroext %0) {
%2 = and i8 %0, 15
%3 = icmp eq i8 %2, 15
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @setFlag(i32 5)
br label %8
6: ; preds = %1
%7 = tail call i32 @resetFlag(i32 5)
br label %8
8: ; preds = %6, %4
%9 = add i8 %0, 1
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @setFlag(i32 7)
br label %15
13: ; preds = %8
%14 = tail call i32 @resetFlag(i32 7)
br label %15
15: ; preds = %13, %11
%16 = tail call i32 @resetFlag(i32 6)
ret i8 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int XESetEventToWire() {
  printf("XESetEventToWire called\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<XESetEventToWire>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [24 x i8] c"XESetEventToWire called\00"
define i32 @XESetEventToWire() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ mk_cmd(unsigned char **, int /*<<< orphan*/,
                          int /*<<< orphan*/, int /*<<< orphan*/);
void garbage(unsigned char **buf, int c) {
  int i;
  for (i = 0; i < c; i++)
    mk_cmd(buf, 0, 0, 0);
}


x86 assembly (clang, -O0):
<garbage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    114f <garbage+0x3f>
mov    -0x8(%rbp),%rdi
xor    %ecx,%ecx
mov    %ecx,%esi
mov    %ecx,%edx
call   1030 <mk_cmd@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <garbage+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<garbage>:
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
jle    1133 <garbage+0x23>
mov    %esi,%ebx
mov    %rdi,%r14
nopl   (%rax)
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <mk_cmd@plt>
add    $0xffffffff,%ebx
jne    1120 <garbage+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @garbage(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %13, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = load i8**, i8*** %3
%12 = call i32 @mk_cmd(i8** %11, i32 0, i32 0, i32 0)
br label %13
13: ; preds = %10
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
store i32 %15, i32* %5
br label %6
16: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @garbage(i8** %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %9
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ 0, %2 ]
%6 = tail call i32 @mk_cmd(i8** %0, i32 0, i32 0, i32 0)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %1
br i1 %8, label %9, label %4
9: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef unsigned int uint8_t;

/* Variables and functions */
uint8_t coap_code(unsigned class, unsigned detail) {
  return (class << 5) | detail;
}


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

x86 assembly (clang, -O2):
<coap_code>:
mov    %edi,%eax
shl    $0x5,%eax
or     %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @coap_code(i32 %0, i32 %1) {
%3 = shl i32 %0, 5
%4 = or i32 %3, %1
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ uint32_t;
typedef scalar_t__ uint16_t;

/* Variables and functions */
scalar_t__ UINT16_MAX;
uint16_t __hsail_sat_mul_u16(uint16_t a, uint16_t b) {
  uint32_t c = (uint32_t)a * (uint32_t)b;
  if (c > UINT16_MAX)
    return UINT16_MAX;
  else
    return c;
}


x86 assembly (clang, -O0):
<__hsail_sat_mul_u16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2ebc(%rip),%rcx
cmp    (%rcx),%rax
jle    1140 <__hsail_sat_mul_u16+0x40>
mov    0x2eac(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    1148 <__hsail_sat_mul_u16+0x48>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__hsail_sat_mul_u16>:
imul   %rsi,%rdi
mov    0x2ed5(%rip),%rax
mov    (%rax),%rax
cmp    %rax,%rdi
cmovle %rdi,%rax
ret

LLVM IR (-O0):
@UINT16_MAX = global i64 0
define i64 @__hsail_sat_mul_u16(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = mul nsw i64 %7, %8
store i64 %9, i64* %6
%10 = load i64, i64* %6
%11 = load i64, i64* @UINT16_MAX
%12 = icmp sgt i64 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = load i64, i64* @UINT16_MAX
store i64 %14, i64* %3
br label %17
15: ; preds = %2
%16 = load i64, i64* %6
store i64 %16, i64* %3
br label %17
17: ; preds = %15, %13
%18 = load i64, i64* %3
ret i64 %18
}

LLVM IR (-O2):
@UINT16_MAX = global i64 0
define i64 @__hsail_sat_mul_u16(i64 %0, i64 %1) {
%3 = mul nsw i64 %1, %0
%4 = load i64, i64* @UINT16_MAX
%5 = icmp sgt i64 %3, %4
%6 = select i1 %5, i64 %4, i64 %3
ret i64 %6
}
int evq_add_dirwatch(struct event_queue *evq, struct event *ev,
                     const char *path) {
  (void)evq;
  (void)ev;
  (void)path;
  return -1;
}


x86 assembly (clang, -O0):
<evq_add_dirwatch>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.event_queue = type opaque
%struct.event = type opaque
define i32 @evq_add_dirwatch(%struct.event_queue* %0, %struct.event* %1, i8* %2) {
%4 = alloca %struct.event_queue*
%5 = alloca %struct.event*
%6 = alloca i8*
store %struct.event_queue* %0, %struct.event_queue** %4
store %struct.event* %1, %struct.event** %5
store i8* %2, i8** %6
%7 = load %struct.event_queue*, %struct.event_queue** %4
%8 = load %struct.event*, %struct.event** %5
%9 = load i8*, i8** %6
ret i32 -1
}

LLVM IR (-O2):
%struct.event_queue = type opaque
%struct.event = type opaque
define i32 @evq_add_dirwatch(%struct.event_queue* nocapture readnone %0, %struct.event* nocapture readnone %1, i8* nocapture readnone %2) {
ret i32 -1
}
int FindFirst(const char *a, char b) {
  int pos = 0;
  while (a[pos]) {
    if (a[pos] == b)
      return pos;
    pos++;
  }
  return -1;
}


x86 assembly (clang, -O0):
<FindFirst>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1158 <FindFirst+0x58>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    114a <FindFirst+0x4a>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115f <FindFirst+0x5f>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1115 <FindFirst+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FindFirst>:
mov    (%rdi),%dl
mov    $0xffffffff,%eax
test   %dl,%dl
je     1122 <FindFirst+0x22>
xor    %ecx,%ecx
nopl   (%rax)
cmp    %sil,%dl
je     1123 <FindFirst+0x23>
movzbl 0x1(%rdi,%rcx,1),%edx
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <FindFirst+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @FindFirst(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %9
%6 = phi i64 [ %10, %9 ], [ 0, %2 ]
%7 = phi i8 [ %12, %9 ], [ %3, %2 ]
%8 = icmp eq i8 %7, %1
br i1 %8, label %14, label %9
9: ; preds = %5
%10 = add nuw i64 %6, 1
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %16, label %5
14: ; preds = %5
%15 = trunc i64 %6 to i32
br label %16
16: ; preds = %9, %14, %2
%17 = phi i32 [ -1, %2 ], [ %15, %14 ], [ -1, %9 ]
ret i32 %17
}
char *hmac256base64(bitstr, bitcnt, key, keylen)
unsigned char *bitstr;
unsigned long bitcnt;
unsigned char *key;
unsigned int keylen;
{ return ((char *)hmaccomp(256, 3, bitstr, bitcnt, key, keylen)); }


x86 assembly (clang, -O0):
<hmac256base64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x1c(%rbp),%r9d
mov    $0x100,%edi
mov    $0x3,%esi
mov    $0x0,%al
call   1030 <hmaccomp@plt>
cltq
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hmac256base64>:
push   %rax
mov    %ecx,%r9d
mov    %rdx,%r8
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    $0x100,%edi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <hmaccomp@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i8* @hmac256base64(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i8*, i8** %7
%12 = load i32, i32* %8
%13 = call i32 (i32, i32, i8*, i64, i8*, i32, ...) bitcast (i32 (...)* @hmaccomp to i32 (i32, i32, i8*, i64, i8*, i32, ...)*)(i32 256, i32 3, i8* %9, i64 %10, i8* %11, i32 %12)
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i8*
ret i8* %15
}

LLVM IR (-O2):
define i8* @hmac256base64(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = tail call i32 (i32, i32, i8*, i64, i8*, i32, ...) bitcast (i32 (...)* @hmaccomp to i32 (i32, i32, i8*, i64, i8*, i32, ...)*)(i32 256, i32 3, i8* %0, i64 %1, i8* %2, i32 %3)
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
ret i8* %7
}
void toggle(unsigned char *bm, int ndx) { bm[ndx >> 3] ^= (1 << (ndx & 0x07)); }


x86 assembly (clang, -O0):
<toggle>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
and    $0x7,%ecx
mov    $0x1,%esi
shl    %cl,%esi
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sar    $0x3,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edx
xor    %esi,%edx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<toggle>:
mov    %esi,%ecx
and    $0x7,%cl
mov    $0x1,%eax
shl    %cl,%eax
sar    $0x3,%esi
movslq %esi,%rcx
xor    %al,(%rdi,%rcx,1)
ret

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

LLVM IR (-O2):
define void @toggle(i8* nocapture %0, i32 %1) {
%3 = and i32 %1, 7
%4 = shl nuw nsw i32 1, %3
%5 = ashr i32 %1, 3
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = trunc i32 %4 to i8
%10 = xor i8 %8, %9
store i8 %10, i8* %7
ret void
}