xunge/DecIR huggingface dataset:
void fill_int(int *i, char *buf) {
  *i = buf[3] & 0xFF;
  *i = ((*i) << 8) + (buf[2] & 0xFF);
  *i = ((*i) << 8) + (buf[1] & 0xFF);
  *i = ((*i) << 8) + (buf[0] & 0xFF);
}


x86 assembly (clang, -O0):
<fill_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
shl    $0x8,%ecx
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
and    $0xff,%eax
add    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
shl    $0x8,%ecx
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
and    $0xff,%eax
add    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
shl    $0x8,%ecx
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
and    $0xff,%eax
add    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_int>:
movzbl 0x3(%rsi),%eax
mov    %eax,(%rdi)
shl    $0x8,%eax
movzbl 0x2(%rsi),%ecx
or     %eax,%ecx
mov    %ecx,(%rdi)
shl    $0x8,%ecx
movzbl 0x1(%rsi),%eax
or     %ecx,%eax
mov    %eax,(%rdi)
shl    $0x8,%eax
movzbl (%rsi),%ecx
or     %eax,%ecx
mov    %ecx,(%rdi)
ret

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

LLVM IR (-O2):
define void @fill_int(i32* nocapture writeonly %0, i8* nocapture %1) {
%3 = getelementptr inbounds i8, i8* %1, i64 3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
store i32 %5, i32* %0
%6 = shl nuw nsw i32 %5, 8
%7 = getelementptr inbounds i8, i8* %1, i64 2
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = or i32 %6, %9
store i32 %10, i32* %0
%11 = shl nuw nsw i32 %10, 8
%12 = getelementptr inbounds i8, i8* %1, i64 1
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = or i32 %11, %14
store i32 %15, i32* %0
%16 = shl nuw i32 %15, 8
%17 = load i8, i8* %1
%18 = zext i8 %17 to i32
%19 = or i32 %16, %18
store i32 %19, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int socket(int, int, int);
int Socket(int family, int type, int protocol) {
  int des;
  des = socket(family, type, protocol);
  if (des < 0) {
    perror("Error defining socket");
    exit(1);
  }
  return des;
}


x86 assembly (clang, -O0):
<Socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1050 <socket@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    1172 <Socket+0x42>
lea    0xe9d(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Socket>:
push   %rax
call   1050 <socket@plt>
test   %eax,%eax
js     113c <Socket+0xc>
pop    %rcx
ret
lea    0xebd(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Error defining socket\00"
define i32 @Socket(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @socket(i32 %8, i32 %9, i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %3
%15 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %3
%18 = load i32, i32* %7
ret i32 %18
}

LLVM IR (-O2):
@.str = [22 x i8] c"Error defining socket\00"
define i32 @Socket(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @socket(i32 %0, i32 %1, i32 %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %3
ret i32 %4
}
/* Type definitions */
struct page {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __lock_page(struct page *);
int /*<<< orphan*/ trylock_page(struct page *);
__attribute__((always_)) void lock_page(struct page *page) {
  do {
    do {
    } while (0);
  } while (0);
  if (!trylock_page(page))
    __lock_page(page);
}


x86 assembly (clang, -O0):
<lock_page>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
jmp    1131 <lock_page+0x11>
jmp    1136 <lock_page+0x16>
jmp    113b <lock_page+0x1b>
mov    -0x8(%rbp),%rdi
call   1040 <trylock_page@plt>
cmp    $0x0,%eax
jne    1156 <lock_page+0x36>
mov    -0x8(%rbp),%rdi
call   1030 <__lock_page@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lock_page>:
push   %rbx
mov    %rdi,%rbx
call   1040 <trylock_page@plt>
test   %eax,%eax
je     112f <lock_page+0xf>
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <__lock_page@plt>

LLVM IR (-O0):
%struct.page = type { i32 }
define void @lock_page(%struct.page* %0) {
%2 = alloca %struct.page*
store %struct.page* %0, %struct.page** %2
br label %3
3: ; preds = %1
br label %4
4: ; preds = %3
br label %5
5: ; preds = %4
br label %6
6: ; preds = %5
%7 = load %struct.page*, %struct.page** %2
%8 = call i32 @trylock_page(%struct.page* %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = load %struct.page*, %struct.page** %2
%12 = call i32 @__lock_page(%struct.page* %11)
br label %13
13: ; preds = %10, %6
ret void
}

LLVM IR (-O2):
%struct.page = type { i32 }
define void @lock_page(%struct.page* %0) {
%2 = tail call i32 @trylock_page(%struct.page* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @__lock_page(%struct.page* %0)
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int packet_pack_exit_resp(char *, int /*<<< orphan*/);
int /*<<< orphan*/ packet_unpack_exit_req(char *);
int do_exit(char *packet) {
  char explain[1024];
  packet_unpack_exit_req(packet);
  return packet_pack_exit_resp(packet, 0);
}


x86 assembly (clang, -O0):
<do_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <packet_unpack_exit_req@plt>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1040 <packet_pack_exit_resp@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_exit>:
push   %rbx
mov    %rdi,%rbx
call   1030 <packet_unpack_exit_req@plt>
mov    %rbx,%rdi
xor    %esi,%esi
pop    %rbx
jmp    1040 <packet_pack_exit_resp@plt>

LLVM IR (-O0):
define i32 @do_exit(i8* %0) {
%2 = alloca i8*
%3 = alloca [1024 x i8]
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @packet_unpack_exit_req(i8* %4)
%6 = load i8*, i8** %2
%7 = call i32 @packet_pack_exit_resp(i8* %6, i32 0)
ret i32 %7
}

LLVM IR (-O2):
define i32 @do_exit(i8* %0) {
%2 = tail call i32 @packet_unpack_exit_req(i8* %0)
%3 = tail call i32 @packet_pack_exit_resp(i8* %0, i32 0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void usage(const char *progname) {
  printf("Usage: %s [-h] [-d] [-m <mode>] -f configfile\n"
         "\tAvailable modes:\n"
         "\t\t1 - full emulation\n"
         "\t\t2 - half proxy\n"
         "\t\t3 - full proxy\n",
         progname);
}


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

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

LLVM IR (-O0):
@.str = [120 x i8] c"Usage: %s [-h] [-d] [-m <mode>] -f configfile\0A\09Available modes:\0A\09\091 - full emulation\0A\09\092 - half proxy\0A\09\093 - full proxy\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([120 x i8], [120 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [120 x i8] c"Usage: %s [-h] [-d] [-m <mode>] -f configfile\0A\09Available modes:\0A\09\091 - full emulation\0A\09\092 - half proxy\0A\09\093 - full proxy\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([120 x i8], [120 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int strcmp(char const *, char const *);
int cmp(const void *a, const void *b) {
  return strcmp((const char *)a, (const char *)b);
}


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

x86 assembly (clang, -O2):
<cmp>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
char *strcpy(char *a, const char *b) {
  char *p = a;
  while ((*p++ = *b++) != 0)
    ;
  return a;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     1147 <strcpy+0x47>
jmp    1114 <strcpy+0x14>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <strcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %6, %3 ]
%5 = phi i8* [ %0, %2 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = load i8, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %0
}
/* Type definitions */
typedef char *__m128i;

/* Variables and functions */
char *_mm_sub_epi16(char *, char *);
__m128i __attribute__((no, unused)) test(__m128i s1, __m128i s2) {
  __asm("" : "+v"(s1), "+v"(s2));
  return _mm_sub_epi16(s1, s2);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rax
movq   %rcx,%xmm0
movq   %rax,%xmm1
movq   %xmm1,%rax
movq   %xmm0,%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <_mm_sub_epi16@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
movq   %rdi,%xmm0
movq   %rsi,%xmm1
movq   %xmm0,%rdi
movq   %xmm1,%rsi
jmp    1030 <_mm_sub_epi16@plt>

LLVM IR (-O0):
define i8* @test(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 = load i8*, i8** %4
%7 = call { i8*, i8* } asm "", "=v,=v,0,1,~{dirflag},~{fpsr},~{flags}"(i8* %5, i8* %6)
%8 = extractvalue { i8*, i8* } %7, 0
%9 = extractvalue { i8*, i8* } %7, 1
store i8* %8, i8** %3
store i8* %9, i8** %4
%10 = load i8*, i8** %3
%11 = load i8*, i8** %4
%12 = call i8* @_mm_sub_epi16(i8* %10, i8* %11)
ret i8* %12
}

LLVM IR (-O2):
define i8* @test(i8* %0, i8* %1) {
%3 = tail call { i8*, i8* } asm "", "=v,=v,0,1,~{dirflag},~{fpsr},~{flags}"(i8* %0, i8* %1)
%4 = extractvalue { i8*, i8* } %3, 0
%5 = extractvalue { i8*, i8* } %3, 1
%6 = tail call i8* @_mm_sub_epi16(i8* %4, i8* %5)
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("hello SANDO\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%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
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [12 x i8] c"hello SANDO\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int test_imm_E0uint16_reg(unsigned short val) {
  return ((val) & (0xE0 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_E0uint16_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, 224
%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_E0uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 224
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
double asin(double);
double sin(double);
double theta_prime(double theta, double n) {
  double s_theta;
  s_theta = sin(theta);
  if (s_theta < -1.)
    s_theta = -1.;
  else if (s_theta > 1.)
    s_theta = 1.;
  return asin(s_theta / n);
}


x86 assembly (clang, -O0):
<theta_prime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xeb7(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1166 <theta_prime+0x46>
movsd  0xea4(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    118f <theta_prime+0x6f>
movsd  -0x18(%rbp),%xmm0
movsd  0xe95(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    118a <theta_prime+0x6a>
movsd  0xe83(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    118f <theta_prime+0x6f>
movsd  -0x18(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1040 <asin@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<theta_prime>:
push   %rax
movsd  %xmm1,(%rsp)
call   1030 <sin@plt>
movapd %xmm0,%xmm1
movsd  0xec9(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     1153 <theta_prime+0x33>
ucomisd 0xec3(%rip),%xmm1
movapd %xmm1,%xmm0
jbe    1153 <theta_prime+0x33>
movsd  0xeb5(%rip),%xmm0
divsd  (%rsp),%xmm0
pop    %rax
jmp    1040 <asin@plt>

LLVM IR (-O0):
define double @theta_prime(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* %3
%7 = call double @sin(double %6)
store double %7, double* %5
%8 = load double, double* %5
%9 = fcmp olt double %8, -1.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %2
store double -1.000000e+00, double* %5
br label %16
11: ; preds = %2
%12 = load double, double* %5
%13 = fcmp ogt double %12, 1.000000e+00
br i1 %13, label %14, label %15
14: ; preds = %11
store double 1.000000e+00, double* %5
br label %15
15: ; preds = %14, %11
br label %16
16: ; preds = %15, %10
%17 = load double, double* %5
%18 = load double, double* %4
%19 = fdiv double %17, %18
%20 = call double @asin(double %19)
ret double %20
}

LLVM IR (-O2):
define double @theta_prime(double %0, double %1) {
%3 = tail call double @sin(double %0)
%4 = fcmp olt double %3, -1.000000e+00
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = fcmp ogt double %3, 1.000000e+00
br i1 %6, label %7, label %8
7: ; preds = %5
br label %8
8: ; preds = %2, %5, %7
%9 = phi double [ 1.000000e+00, %7 ], [ %3, %5 ], [ -1.000000e+00, %2 ]
%10 = fdiv double %9, %1
%11 = tail call double @asin(double %10)
ret double %11
}
/* Variables and functions */
int /*<<< orphan*/ dup2(int, int);
int main(void) {
  int oldfd = 42;
  int newfd = 43;
  dup2(oldfd, newfd);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2a,%edi
mov    $0x2b,%esi
call   1030 <dup2@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 42, i32* %2
store i32 43, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = call i32 @dup2(i32 %4, i32 %5)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @dup2(i32 42, i32 43)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *);
int main() {
  int a, b;
  printf("请输入数值,格式为 a,b \n");
  scanf("%d,%d,&a,&b");
  printf("数值a大于数值b");
  if (a > b) {
    printf("数值a大于数值b");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
call   1040 <scanf@plt>
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    116b <main+0x4b>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee9(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
call   1050 <scanf@plt>
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E6\95\B0\E5\80\BC,\E6\A0\BC\E5\BC\8F\E4\B8\BA a,b \0A\00"
@.str.1 = [12 x i8] c"%d,%d,&a,&b\00"
@.str.2 = [21 x i8] c"\E6\95\B0\E5\80\BCa\E5\A4\A7\E4\BA\8E\E6\95\B0\E5\80\BCb\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = icmp sgt i32 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %10, %0
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"%d,%d,&a,&b\00"
@.str.2 = [21 x i8] c"\E6\95\B0\E5\80\BCa\E5\A4\A7\E4\BA\8E\E6\95\B0\E5\80\BCb\00"
@str = [31 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E6\95\B0\E5\80\BC,\E6\A0\BC\E5\BC\8F\E4\B8\BA a,b \00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *);
void eat_newlines(void) { scanf("%*[\n]"); }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"%*[\0A]\00"
define void @eat_newlines() {
%1 = tail call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
int gcd(int a, int b) {
  while (b != 0) {
    int t = b;
    b = a % b;
    a = t;
  }
  return a;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112f <gcd+0x2f>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    110a <gcd+0xa>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %edi,%eax
test   %esi,%esi
je     111d <gcd+0x1d>
mov    %esi,%edx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <gcd+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %6, %4 ], [ %0, %2 ]
%6 = phi i32 [ %7, %4 ], [ %1, %2 ]
%7 = srem i32 %5, %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %6, %4 ]
ret i32 %10
}
int zengl_Sym_Hash(void *VM_ARG, char *key) {
  int temp = 0;
  int i = 0;
  while (key[i] != '\0') {
    temp = ((temp << 4) + key[i]) % 211;
    ++i;
  }
  return temp;
}


x86 assembly (clang, -O0):
<zengl_Sym_Hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     115c <zengl_Sym_Hash+0x5c>
mov    -0x14(%rbp),%eax
shl    $0x4,%eax
mov    -0x10(%rbp),%rcx
movslq -0x18(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    $0xd3,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    111a <zengl_Sym_Hash+0x1a>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<zengl_Sym_Hash>:
mov    (%rsi),%cl
test   %cl,%cl
je     1142 <zengl_Sym_Hash+0x42>
add    $0x1,%rsi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
shl    $0x4,%eax
add    %ecx,%eax
cltq
imul   $0x4da637d,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
imul   $0xd3,%ecx,%ecx
sub    %ecx,%eax
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <zengl_Sym_Hash+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @zengl_Sym_Hash(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %15, %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 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %28
15: ; preds = %7
%16 = load i32, i32* %5
%17 = shl i32 %16, 4
%18 = load i8*, i8** %4
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = add nsw i32 %17, %23
%25 = srem i32 %24, 211
store i32 %25, i32* %5
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
store i32 %27, i32* %6
br label %7
28: ; preds = %7
%29 = load i32, i32* %5
ret i32 %29
}

LLVM IR (-O2):
define i32 @zengl_Sym_Hash(i8* nocapture readnone %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %13, %5 ], [ 0, %2 ]
%7 = phi i8 [ %15, %5 ], [ %3, %2 ]
%8 = phi i32 [ %12, %5 ], [ 0, %2 ]
%9 = sext i8 %7 to i32
%10 = shl nsw i32 %8, 4
%11 = add nsw i32 %10, %9
%12 = srem i32 %11, 211
%13 = add nuw nsw i64 %6, 1
%14 = getelementptr inbounds i8, i8* %1, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %5
17: ; preds = %5, %2
%18 = phi i32 [ 0, %2 ], [ %12, %5 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ h(int /*<<< orphan*/, char *);
int main(void) {
  h(0, "foo");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rsi
xor    %edi,%edi
call   1030 <h@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"foo\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @h(i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"foo\00"
define i32 @main() {
%1 = tail call i32 @h(i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int Operand_xt_wbr18_label_ator(unsigned int *valp, unsigned int pc) {
  *valp -= pc;
  return 0;
}


x86 assembly (clang, -O0):
<Operand_xt_wbr18_label_ator>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
sub    %edx,%ecx
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Operand_xt_wbr18_label_ator>:
sub    %esi,(%rdi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @Operand_xt_wbr18_label_ator(i32* nocapture %0, i32 %1) {
%3 = load i32, i32* %0
%4 = sub i32 %3, %1
store i32 %4, i32* %0
ret i32 0
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int bcm2835_read(int);
int32_t mini_uart_getc_noblock(void) {
  if (bcm2835_read((0 + 0x201000 + 0x18)) & (1 << 4)) {
    return -1;
  }
  return (bcm2835_read((0 + 0x201000 + 0x00))) & 0xff;
}


x86 assembly (clang, -O0):
<mini_uart_getc_noblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x201018,%edi
call   1030 <bcm2835_read@plt>
and    $0x10,%eax
cmp    $0x0,%eax
je     113a <mini_uart_getc_noblock+0x2a>
movl   $0xffffffff,-0x4(%rbp)
jmp    114c <mini_uart_getc_noblock+0x3c>
mov    $0x201000,%edi
call   1030 <bcm2835_read@plt>
and    $0xff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mini_uart_getc_noblock>:
push   %rax
mov    $0x201018,%edi
call   1030 <bcm2835_read@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
test   $0x10,%cl
jne    1134 <mini_uart_getc_noblock+0x24>
mov    $0x201000,%edi
call   1030 <bcm2835_read@plt>
movzbl %al,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @mini_uart_getc_noblock() {
%1 = alloca i32
%2 = call i32 @bcm2835_read(i32 2101272)
%3 = and i32 %2, 16
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 -1, i32* %1
br label %9
6: ; preds = %0
%7 = call i32 @bcm2835_read(i32 2101248)
%8 = and i32 %7, 255
store i32 %8, i32* %1
br label %9
9: ; preds = %6, %5
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
define i32 @mini_uart_getc_noblock() {
%1 = tail call i32 @bcm2835_read(i32 2101272)
%2 = and i32 %1, 16
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = tail call i32 @bcm2835_read(i32 2101248)
%6 = and i32 %5, 255
br label %7
7: ; preds = %0, %4
%8 = phi i32 [ %6, %4 ], [ -1, %0 ]
ret i32 %8
}
int PyMPELog_LogEvent(int commID, const int eventID, const char bytebuf[]) {
  int ierr = 0;
  return ierr;
}


x86 assembly (clang, -O0):
<PyMPELog_LogEvent>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @PyMPELog_LogEvent(i32 %0, i32 %1, i8* nocapture readnone %2) {
ret i32 0
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t flag_get(const uint64_t *flag, uint64_t i) {
  size_t a;
  a = i / 64;
  i &= 63;
  return (flag[a] & (1UL << i));
}


x86 assembly (clang, -O0):
<flag_get>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
cltq
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
and    $0x3f,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq (%rax,%rcx,4),%rax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%rdx
mov    %rdx,%rcx
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<flag_get>:
mov    %esi,%ecx
lea    0x3f(%rcx),%edx
test   %esi,%esi
cmovns %esi,%edx
mov    $0x1,%eax
shl    %cl,%rax
sar    $0x6,%edx
movslq %edx,%rcx
and    (%rdi,%rcx,4),%eax
ret

LLVM IR (-O0):
define i32 @flag_get(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i64
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = sdiv i32 %6, 64
%8 = sext i32 %7 to i64
store i64 %8, i64* %5
%9 = load i32, i32* %4
%10 = and i32 %9, 63
store i32 %10, i32* %4
%11 = load i32*, i32** %3
%12 = load i64, i64* %5
%13 = getelementptr inbounds i32, i32* %11, i64 %12
%14 = load i32, i32* %13
%15 = sext i32 %14 to i64
%16 = load i32, i32* %4
%17 = zext i32 %16 to i64
%18 = shl i64 1, %17
%19 = and i64 %15, %18
%20 = trunc i64 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
define i32 @flag_get(i32* nocapture %0, i32 %1) {
%3 = sdiv i32 %1, 64
%4 = sext i32 %3 to i64
%5 = and i32 %1, 63
%6 = getelementptr inbounds i32, i32* %0, i64 %4
%7 = load i32, i32* %6
%8 = zext i32 %5 to i64
%9 = shl nuw i64 1, %8
%10 = trunc i64 %9 to i32
%11 = and i32 %7, %10
ret i32 %11
}
/* Variables and functions */
int CLOCKS_PER_SEC;
int grt_get_clk_tck(void) { return CLOCKS_PER_SEC; }


x86 assembly (clang, -O0):
<grt_get_clk_tck>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<grt_get_clk_tck>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@CLOCKS_PER_SEC = global i32 0
define i32 @grt_get_clk_tck() {
%1 = load i32, i32* @CLOCKS_PER_SEC
ret i32 %1
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global i32 0
define i32 @grt_get_clk_tck() {
%1 = load i32, i32* @CLOCKS_PER_SEC
ret i32 %1
}
void addConversion() {}


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

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

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

LLVM IR (-O2):
define void @addConversion() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ seq_utils_clamp(scalar_t__, int, int);
scalar_t__ song_get_magic_chance();
int /*<<< orphan*/ song_set_magic_chance(int /*<<< orphan*/);
void seq_ctrl_adjust_magic_chance(int change) {
  song_set_magic_chance(
      seq_utils_clamp(song_get_magic_chance() + change, 1, 100));
}


x86 assembly (clang, -O0):
<seq_ctrl_adjust_magic_chance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <song_get_magic_chance@plt>
mov    %rax,%rdi
movslq -0x4(%rbp),%rax
add    %rax,%rdi
mov    $0x1,%esi
mov    $0x64,%edx
call   1050 <seq_utils_clamp@plt>
mov    %eax,%edi
call   1030 <song_set_magic_chance@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seq_ctrl_adjust_magic_chance>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <song_get_magic_chance@plt>
movslq %ebx,%rdi
add    %rax,%rdi
mov    $0x1,%esi
mov    $0x64,%edx
call   1050 <seq_utils_clamp@plt>
mov    %eax,%edi
pop    %rbx
jmp    1030 <song_set_magic_chance@plt>

LLVM IR (-O0):
define void @seq_ctrl_adjust_magic_chance(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i64 (...) @song_get_magic_chance()
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = add nsw i64 %3, %5
%7 = call i32 @seq_utils_clamp(i64 %6, i32 1, i32 100)
%8 = call i32 @song_set_magic_chance(i32 %7)
ret void
}

LLVM IR (-O2):
define void @seq_ctrl_adjust_magic_chance(i32 %0) {
%2 = tail call i64 (...) @song_get_magic_chance()
%3 = sext i32 %0 to i64
%4 = add nsw i64 %2, %3
%5 = tail call i32 @seq_utils_clamp(i64 %4, i32 1, i32 100)
%6 = tail call i32 @song_set_magic_chance(i32 %5)
ret void
}
int div_s64_32(unsigned long long dividend, int divisor) {
  int result = 0;
  int i = 0;
  if (dividend >> 32 == 0)
    result = (unsigned int)dividend / divisor;
  else {
    while ((divisor * (i++) + divisor - 1) < dividend)
      ;
    result = i - 1;
  }
  return result;
}


x86 assembly (clang, -O0):
<div_s64_32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x20,%rax
cmp    $0x0,%rax
jne    113c <div_s64_32+0x3c>
mov    -0x8(%rbp),%rax
xor    %edx,%edx
divl   -0xc(%rbp)
mov    %eax,-0x10(%rbp)
jmp    1172 <div_s64_32+0x72>
jmp    1141 <div_s64_32+0x41>
mov    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
imul   %ecx,%eax
add    -0xc(%rbp),%eax
sub    $0x1,%eax
cltq
cmp    -0x8(%rbp),%rax
jae    1169 <div_s64_32+0x69>
jmp    1141 <div_s64_32+0x41>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<div_s64_32>:
mov    %rdi,%rax
shr    $0x20,%rax
jne    1110 <div_s64_32+0x10>
mov    %edi,%eax
xor    %edx,%edx
div    %esi
ret
lea    -0x1(%rsi),%ecx
mov    $0xffffffff,%eax
nopl   0x0(%rax,%rax,1)
movslq %ecx,%rdx
add    $0x1,%eax
lea    (%rdx,%rsi,1),%ecx
cmp    %rdi,%rdx
jb     1120 <div_s64_32+0x20>
ret

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

LLVM IR (-O2):
define i32 @div_s64_32(i64 %0, i32 %1) {
%3 = icmp ult i64 %0, 4294967296
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = add i32 %1, -1
br label %9
6: ; preds = %2
%7 = trunc i64 %0 to i32
%8 = udiv i32 %7, %1
br label %19
9: ; preds = %4, %9
%10 = phi i64 [ 0, %4 ], [ %11, %9 ]
%11 = add nuw i64 %10, 1
%12 = trunc i64 %10 to i32
%13 = mul i32 %12, %1
%14 = add i32 %5, %13
%15 = sext i32 %14 to i64
%16 = icmp ult i64 %15, %0
br i1 %16, label %9, label %17
17: ; preds = %9
%18 = trunc i64 %10 to i32
br label %19
19: ; preds = %17, %6
%20 = phi i32 [ %8, %6 ], [ %18, %17 ]
ret i32 %20
}
void foo125() {}


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

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

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

LLVM IR (-O2):
define void @foo125() {
ret void
}
/* Type definitions */
struct rusage {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ RUSAGE_SELF;
int /*<<< orphan*/ getrusage(int /*<<< orphan*/, struct rusage *);
void userstart(struct rusage *start) { getrusage(RUSAGE_SELF, start); }


x86 assembly (clang, -O0):
<userstart>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <getrusage@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<userstart>:
mov    %rdi,%rsi
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
jmp    1030 <getrusage@plt>

LLVM IR (-O0):
%struct.rusage = type { i32 }
@RUSAGE_SELF = global i32 0
define void @userstart(%struct.rusage* %0) {
%2 = alloca %struct.rusage*
store %struct.rusage* %0, %struct.rusage** %2
%3 = load i32, i32* @RUSAGE_SELF
%4 = load %struct.rusage*, %struct.rusage** %2
%5 = call i32 @getrusage(i32 %3, %struct.rusage* %4)
ret void
}

LLVM IR (-O2):
%struct.rusage = type { i32 }
@RUSAGE_SELF = global i32 0
define void @userstart(%struct.rusage* %0) {
%2 = load i32, i32* @RUSAGE_SELF
%3 = tail call i32 @getrusage(i32 %2, %struct.rusage* %0)
ret void
}
void comp(unsigned char first[], unsigned char out[]) {
  out[0] = ~first[0];
  out[1] = ~first[1];
  out[2] = ~first[2];
  out[3] = ~first[3];
}


x86 assembly (clang, -O0):
<comp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
xor    $0xffffffff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
xor    $0xffffffff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x8(%rbp),%rax
movzbl 0x2(%rax),%eax
xor    $0xffffffff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x8(%rbp),%rax
movzbl 0x3(%rax),%eax
xor    $0xffffffff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<comp>:
mov    (%rdi),%al
not    %al
mov    %al,(%rsi)
mov    0x1(%rdi),%al
not    %al
mov    %al,0x1(%rsi)
mov    0x2(%rdi),%al
not    %al
mov    %al,0x2(%rsi)
mov    0x3(%rdi),%al
not    %al
mov    %al,0x3(%rsi)
ret

LLVM IR (-O0):
define void @comp(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 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = xor i32 %8, -1
%10 = trunc i32 %9 to i8
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i64 0
store i8 %10, i8* %12
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = xor i32 %16, -1
%18 = trunc i32 %17 to i8
%19 = load i8*, i8** %4
%20 = getelementptr inbounds i8, i8* %19, i64 1
store i8 %18, i8* %20
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i64 2
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = xor i32 %24, -1
%26 = trunc i32 %25 to i8
%27 = load i8*, i8** %4
%28 = getelementptr inbounds i8, i8* %27, i64 2
store i8 %26, i8* %28
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i64 3
%31 = load i8, i8* %30
%32 = zext i8 %31 to i32
%33 = xor i32 %32, -1
%34 = trunc i32 %33 to i8
%35 = load i8*, i8** %4
%36 = getelementptr inbounds i8, i8* %35, i64 3
store i8 %34, i8* %36
ret void
}

LLVM IR (-O2):
define void @comp(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = xor i8 %3, -1
store i8 %4, i8* %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = xor i8 %6, -1
%8 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %7, i8* %8
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = xor i8 %10, -1
%12 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %11, i8* %12
%13 = getelementptr inbounds i8, i8* %0, i64 3
%14 = load i8, i8* %13
%15 = xor i8 %14, -1
%16 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %15, i8* %16
ret void
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int support_size(void) {
  int fail, nbr;
  int *b;
  double *c;
  fail = _ada_use_c2phc(586, &nbr, b, c);
  return nbr;
}


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

x86 assembly (clang, -O2):
<support_size>:
push   %rax
lea    0x4(%rsp),%rsi
mov    $0x24a,%edi
call   1030 <_ada_use_c2phc@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @support_size() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @_ada_use_c2phc(i32 586, i32* %1, i32* undef, double* undef)
%4 = load i32, i32* %1
ret i32 %4
}
void GB_LNOT_f_FP64(double *z, const double *x) { (*z) = !((*x) != 0); }


x86 assembly (clang, -O0):
<GB_LNOT_f_FP64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
cvtsi2sd %eax,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GB_LNOT_f_FP64>:
xorpd  %xmm0,%xmm0
cmpeqsd (%rsi),%xmm0
movsd  0xeef(%rip),%xmm1
andpd  %xmm0,%xmm1
movlpd %xmm1,(%rdi)
ret

LLVM IR (-O0):
define void @GB_LNOT_f_FP64(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %4
%6 = load double, double* %5
%7 = fcmp une double %6, 0.000000e+00
%8 = xor i1 %7, true
%9 = zext i1 %8 to i32
%10 = sitofp i32 %9 to double
%11 = load double*, double** %3
store double %10, double* %11
ret void
}

LLVM IR (-O2):
define void @GB_LNOT_f_FP64(double* nocapture writeonly %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = fcmp oeq double %3, 0.000000e+00
%5 = uitofp i1 %4 to double
store double %5, double* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, char);
void move(char x, char y) { printf("%c-->%c\n", x, y); }


x86 assembly (clang, -O0):
<move>:
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
lea    0xed2(%rip),%rdi
movsbl %al,%esi
movsbl -0x2(%rbp),%edx
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<move>:
mov    %esi,%edx
mov    %edi,%esi
lea    0xee5(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"%c-->%c\0A\00"
define void @move(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* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 signext %5, i8 signext %6)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%c-->%c\0A\00"
define void @move(i8 signext %0, i8 signext %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 signext %0, i8 signext %1)
ret void
}
int get_internal(int *lookup, unsigned int x) {
  if (x >= 0 && x < 128)
    return lookup[x];
  else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<get_internal>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jb     1134 <get_internal+0x34>
cmpl   $0x80,-0x14(%rbp)
jae    1134 <get_internal+0x34>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4(%rbp)
jmp    113b <get_internal+0x3b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_internal>:
mov    $0xffffffff,%eax
cmp    $0x7f,%esi
ja     110f <get_internal+0xf>
mov    %esi,%eax
mov    (%rdi,%rax,4),%eax
ret

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

LLVM IR (-O2):
define i32 @get_internal(i32* nocapture %0, i32 %1) {
%3 = icmp ult i32 %1, 128
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = zext i32 %1 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %2, %4
%9 = phi i32 [ %7, %4 ], [ -1, %2 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *prog) {
  fprintf(stderr, "Usage %s [run|verify] <file>\n", prog);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"Usage %s [run|verify] <file>\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"Usage %s [run|verify] <file>\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}