xunge/DecIR huggingface dataset:
A0RX1(r0, r1, x0, x1, p0, p1) signed char r0, r1;
signed char *p0, *p1;
{
  if ((*((signed char *)10000000)) <= (p1[x1]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<A0RX1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %dil,%sil
mov    %sil,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    $0x989680,%eax
movsbl (%rax),%eax
mov    -0x20(%rbp),%rcx
movslq -0x10(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jg     1146 <A0RX1+0x46>
movl   $0x1,-0x4(%rbp)
jmp    114d <A0RX1+0x4d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<A0RX1>:
mov    0x989680,%dl
movslq %ecx,%rcx
xor    %eax,%eax
cmp    (%r9,%rcx,1),%dl
setle  %al
ret

LLVM IR (-O0):
define i32 @A0RX1(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4, i8* %5) {
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
%14 = trunc i32 %0 to i8
%15 = trunc i32 %1 to i8
store i8 %14, i8* %8
store i8 %15, i8* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i8* %4, i8** %12
store i8* %5, i8** %13
%16 = load i8, i8* inttoptr (i64 10000000 to i8*)
%17 = sext i8 %16 to i32
%18 = load i8*, i8** %13
%19 = load i32, i32* %11
%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 = icmp sle i32 %17, %23
br i1 %24, label %25, label %26
25: ; preds = %6
store i32 1, i32* %7
br label %27
26: ; preds = %6
store i32 0, i32* %7
br label %27
27: ; preds = %26, %25
%28 = load i32, i32* %7
ret i32 %28
}

LLVM IR (-O2):
define i32 @A0RX1(i32 %0, i32 %1, i32 %2, i32 %3, i8* nocapture readnone %4, i8* nocapture %5) {
%7 = load i8, i8* inttoptr (i64 10000000 to i8*)
%8 = sext i32 %3 to i64
%9 = getelementptr inbounds i8, i8* %5, i64 %8
%10 = load i8, i8* %9
%11 = icmp sle i8 %7, %10
%12 = zext i1 %11 to i32
ret i32 %12
}
int test_imm_41uint16_reg(unsigned short val) {
  return ((val) & (-0x41 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_41uint16_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, -65
%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_41uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -65
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ print_cmd_args(int, char **);
int main(int argc, char *argv[]) {
  print_cmd_args(argc, argv);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @print_cmd_args(i32 %0, i8** %1)
ret i32 0
}
/* Variables and functions */
scalar_t__ alpha(char);
int numeric(char);
int an(char c) {
  if (alpha(c))
    return 1;
  return numeric(c);
}


x86 assembly (clang, -O0):
<an>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%edi
call   1040 <alpha@plt>
cmp    $0x0,%rax
je     114d <an+0x2d>
movl   $0x1,-0x4(%rbp)
jmp    1159 <an+0x39>
movsbl -0x5(%rbp),%edi
call   1030 <numeric@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<an>:
push   %rbx
mov    %edi,%ebx
call   1040 <alpha@plt>
test   %rax,%rax
je     1134 <an+0x14>
mov    $0x1,%eax
pop    %rbx
ret
movsbl %bl,%edi
pop    %rbx
jmp    1030 <numeric@plt>

LLVM IR (-O0):
define i32 @an(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = call i64 @alpha(i8 signext %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %2
br label %11
8: ; preds = %1
%9 = load i8, i8* %3
%10 = call i32 @numeric(i8 signext %9)
store i32 %10, i32* %2
br label %11
11: ; preds = %8, %7
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @an(i8 signext %0) {
%2 = tail call i64 @alpha(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @numeric(i8 signext %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ 1, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ DAC0_DriverIRQHandler();
__attribute__((weak, section(".after_vectors"))) void DAC0_IRQHandler(void) {
  DAC0_DriverIRQHandler();
}


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

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

LLVM IR (-O0):
define weak void @DAC0_IRQHandler() section ".after_vectors" {
%1 = call i32 (...) @DAC0_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @DAC0_IRQHandler() section ".after_vectors" {
%1 = tail call i32 (...) @DAC0_DriverIRQHandler()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char const *, char *);
void generateStreamUrl(char *url, const char *ip) {
  sprintf(url, "http://%s:%s", ip, "8090");
}


x86 assembly (clang, -O0):
<generateStreamUrl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xed1(%rip),%rsi
lea    0xed7(%rip),%rcx
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generateStreamUrl>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
lea    0xeec(%rip),%rcx
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"http://%s:%s\00"
@.str.1 = [5 x i8] c"8090\00"
define void @generateStreamUrl(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 @sprintf(i8* %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"http://%s:%s\00"
@.str.1 = [5 x i8] c"8090\00"
define void @generateStreamUrl(i8* nocapture writeonly %0, i8* %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int cmp(const void *a, const void *b) { return ((*(int *)a) - (*(int *)b)); }


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

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 = 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 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @cmp(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 = sub nsw i32 %4, %6
ret i32 %7
}
int delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk) {
  return 0;
}


x86 assembly (clang, -O0):
<delayacct_add_tsk>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.taskstats = type opaque
%struct.task_struct = type opaque
define i32 @delayacct_add_tsk(%struct.taskstats* %0, %struct.task_struct* %1) {
%3 = alloca %struct.taskstats*
%4 = alloca %struct.task_struct*
store %struct.taskstats* %0, %struct.taskstats** %3
store %struct.task_struct* %1, %struct.task_struct** %4
ret i32 0
}

LLVM IR (-O2):
%struct.taskstats = type opaque
%struct.task_struct = type opaque
define i32 @delayacct_add_tsk(%struct.taskstats* nocapture readnone %0, %struct.task_struct* nocapture readnone %1) {
ret i32 0
}
void usage(char *exe) {}


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

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

LLVM IR (-O0):
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret void
}

LLVM IR (-O2):
define void @usage(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
void *sock_write(void *arg) {
  int fd = *(int *)arg;
  write(fd, "This should be message #5", sizeof("This should be message #5"));
  return (NULL);
}


x86 assembly (clang, -O0):
<sock_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    0xed1(%rip),%rsi
mov    $0x1a,%edx
call   1030 <write@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sock_write>:
push   %rax
mov    (%rdi),%edi
lea    0xee6(%rip),%rsi
mov    $0x1a,%edx
call   1030 <write@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"This should be message\00"
define i8* @sock_write(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @write(i32 %7, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 26)
ret i8* null
}

LLVM IR (-O2):
@.str = [26 x i8] c"This should be message\00"
define noalias i8* @sock_write(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @write(i32 %3, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 26)
ret i8* null
}
unsigned char ioread8(unsigned short port) {
  unsigned char v;
  __asm__ __volatile__("inb %1, %0" : "=a"(v) : "dN"(port));
  return v;
}


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

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

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

LLVM IR (-O2):
define zeroext i8 @ioread8(i16 zeroext %0) {
%2 = tail call i8 asm sideeffect "inb $1, $0", "={ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ appendlist(int);
int lenlist();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ printlist();
int /*<<< orphan*/ remlist(int);
int main() {
  int leng;
  printlist();
  appendlist(12);
  appendlist(24);
  appendlist(05);
  printlist();
  printf("\nlength of list is:%d", lenlist());
  remlist(5);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <printlist@plt>
mov    $0xc,%edi
call   1040 <appendlist@plt>
mov    $0x18,%edi
call   1040 <appendlist@plt>
mov    $0x5,%edi
call   1040 <appendlist@plt>
mov    $0x0,%al
call   1070 <printlist@plt>
mov    $0x0,%al
call   1030 <lenlist@plt>
mov    %eax,%esi
lea    0xe65(%rip),%rdi
call   1050 <printf@plt>
mov    $0x5,%edi
call   1060 <remlist@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1070 <printlist@plt>
mov    $0xc,%edi
call   1040 <appendlist@plt>
mov    $0x18,%edi
call   1040 <appendlist@plt>
mov    $0x5,%edi
call   1040 <appendlist@plt>
xor    %eax,%eax
call   1070 <printlist@plt>
xor    %eax,%eax
call   1030 <lenlist@plt>
lea    0xe75(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x5,%edi
call   1060 <remlist@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"\0Alength of list is:%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @printlist()
%4 = call i32 @appendlist(i32 12)
%5 = call i32 @appendlist(i32 24)
%6 = call i32 @appendlist(i32 5)
%7 = call i32 (...) @printlist()
%8 = call i32 (...) @lenlist()
%9 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @remlist(i32 5)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"\0Alength of list is:%d\00"
define i32 @main() {
%1 = tail call i32 (...) @printlist()
%2 = tail call i32 @appendlist(i32 12)
%3 = tail call i32 @appendlist(i32 24)
%4 = tail call i32 @appendlist(i32 5)
%5 = tail call i32 (...) @printlist()
%6 = tail call i32 (...) @lenlist()
%7 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = tail call i32 @remlist(i32 5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ bcm2835_spi_begin();
void ope_spi_begin(void) { bcm2835_spi_begin(); }


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

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

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

LLVM IR (-O2):
define void @ope_spi_begin() {
%1 = tail call i32 (...) @bcm2835_spi_begin()
ret void
}
int main(void) {
  int i, a[4];
  0 [a] = a[1] = *(a + 2) = *(3 + a) = 7;
  for (i = 0; i < 4; i++)
    printf("a[%d] = %d\n", i, a[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7,-0x14(%rbp)
movl   $0x7,-0x18(%rbp)
movl   $0x7,-0x1c(%rbp)
movl   $0x7,-0x20(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    1173 <main+0x63>
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edx
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <main+0x32>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x7,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x7,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x7,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x7,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"a[%d] = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [4 x i32]
store i32 0, i32* %1
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%5 = getelementptr inbounds i32, i32* %4, i64 3
store i32 7, i32* %5
%6 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%7 = getelementptr inbounds i32, i32* %6, i64 2
store i32 7, i32* %7
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 1
store i32 7, i32* %8
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
store i32 7, i32* %9
store i32 0, i32* %2
br label %10
10: ; preds = %20, %0
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 4
br i1 %12, label %13, label %23
13: ; preds = %10
%14 = load i32, i32* %2
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %18)
br label %20
20: ; preds = %13
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
br label %10
23: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"a[%d] = %d\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 0, i32 7)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 1, i32 7)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 2, i32 7)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 3, i32 7)
ret i32 0
}
void foo(int *a, char *b, char *c) { __builtin_memmove(c, b, a[c[0]]); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbq (%rcx),%rcx
movslq (%rax,%rcx,4),%rdx
call   1030 <memmove@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %rdx,%rax
movsbq (%rdx),%rcx
movslq (%rdi,%rcx,4),%rdx
mov    %rax,%rdi
jmp    1030 <memmove@plt>

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

LLVM IR (-O2):
define void @foo(i32* nocapture %0, i8* nocapture %1, i8* nocapture %2) {
%4 = load i8, i8* %2
%5 = sext i8 %4 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = load i32, i32* %6
%8 = sext i32 %7 to i64
tail call void @llvm.memmove.p0i8.p0i8.i64(i8* align 1 %2, i8* align 1 %1, i64 %8, i1 false)
ret void
}
lintyp(t) {
  switch (t) {
  case 0:
  case 1:
    return (0);
  case 2:
  case 3:
    return (1);
  case 6:
    return (2);
  default:
    return (3);
  }
}


x86 assembly (clang, -O0):
<lintyp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x2,%eax
jb     1140 <lintyp+0x40>
jmp    111b <lintyp+0x1b>
mov    -0xc(%rbp),%eax
add    $0xfffffffe,%eax
sub    $0x2,%eax
jb     114c <lintyp+0x4c>
jmp    112f <lintyp+0x2f>
mov    -0xc(%rbp),%eax
sub    $0x6,%eax
je     1158 <lintyp+0x58>
jmp    1164 <lintyp+0x64>
movl   $0x0,-0x4(%rbp)
jmp    116b <lintyp+0x6b>
movl   $0x1,-0x4(%rbp)
jmp    116b <lintyp+0x6b>
movl   $0x2,-0x4(%rbp)
jmp    116b <lintyp+0x6b>
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lintyp>:
mov    $0x3,%eax
cmp    $0x6,%edi
ja     1117 <lintyp+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

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

LLVM IR (-O2):
@switch.table.lintyp = [7 x i32] [i32 0, i32 0, i32 1, i32 1, i32 3, i32 3, i32 2]
define i32 @lintyp(i32 %0) {
%2 = icmp ult i32 %0, 7
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds [7 x i32], [7 x i32]* @switch.table.lintyp, i64 0, i64 %4
%6 = load i32, i32* %5
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 3, %1 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("ls\n");
  printf("echo hello\n");
}


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

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

LLVM IR (-O2):
@str = [3 x i8] c"ls\00"
@str.2 = [11 x i8] c"echo hello\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
void errquit(char *str) {
  perror(str);
  exit(0);
}


x86 assembly (clang, -O0):
<errquit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<errquit>:
push   %rax
call   1030 <perror@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @errquit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @errquit(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int faca(int);
int facb(int z) {
  int r;
  if (z <= 0) {
    r = 1;
  } else {
    r = faca(z - 1);
    r = z * r;
  }
  return r;
}


x86 assembly (clang, -O0):
<facb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     1131 <facb+0x21>
movl   $0x1,-0x8(%rbp)
jmp    1149 <facb+0x39>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1030 <faca@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<facb>:
test   %edi,%edi
jle    1124 <facb+0x14>
push   %rbx
mov    %edi,%ebx
lea    -0x1(%rbx),%edi
call   1030 <faca@plt>
imul   %ebx,%eax
pop    %rbx
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @facb(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp sle i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %3
br label %14
7: ; preds = %1
%8 = load i32, i32* %2
%9 = sub nsw i32 %8, 1
%10 = call i32 @faca(i32 %9)
store i32 %10, i32* %3
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = mul nsw i32 %11, %12
store i32 %13, i32* %3
br label %14
14: ; preds = %7, %6
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @facb(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = add nsw i32 %0, -1
%5 = tail call i32 @faca(i32 %4)
%6 = mul nsw i32 %5, %0
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 1, %1 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ decrement_access(int *, int);
int /*<<< orphan*/ increment_access(int *, int);
int /*<<< orphan*/ increment_pointer(int *, int *);
void main() {
  int buf[100];
  decrement_access(buf, 100);
  increment_access(buf, 100);
  increment_pointer(buf, &buf[100]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
lea    -0x190(%rbp),%rdi
mov    $0x64,%esi
call   1040 <decrement_access@plt>
lea    -0x190(%rbp),%rdi
mov    $0x64,%esi
call   1030 <increment_access@plt>
lea    -0x190(%rbp),%rdi
lea    -0x190(%rbp),%rsi
add    $0x190,%rsi
call   1050 <increment_pointer@plt>
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x190,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1040 <decrement_access@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1030 <increment_access@plt>
lea    0x190(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <increment_pointer@plt>
add    $0x190,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @main() {
%1 = alloca [100 x i32]
%2 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%3 = call i32 @decrement_access(i32* %2, i32 100)
%4 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%5 = call i32 @increment_access(i32* %4, i32 100)
%6 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%7 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 100
%8 = call i32 @increment_pointer(i32* %6, i32* %7)
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = alloca [100 x i32]
%2 = bitcast [100 x i32]* %1 to i8*
%3 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%4 = call i32 @decrement_access(i32* %3, i32 100)
%5 = call i32 @increment_access(i32* %3, i32 100)
%6 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 100
%7 = call i32 @increment_pointer(i32* %3, i32* %6)
ret void
}
void g_hash_table_insert() {}


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

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

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

LLVM IR (-O2):
define void @g_hash_table_insert() {
ret void
}
int test_imm_F1int32_reg(int val) { return ((val) & (0xF1 << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_F1int32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xf1,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_F1int32_reg(i32 %0) {
%2 = and i32 %0, 241
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ m_write(int, int, char *, scalar_t__);
int s_strlen(int);
scalar_t__ strlen(char *);
int s_app1(int m, char *s) {
  int p = s_strlen(m);
  m_write(m, p, s, strlen(s) + 1);
  return m;
}


x86 assembly (clang, -O0):
<s_app1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <s_strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    %rax,%rcx
add    $0x1,%rcx
call   1050 <m_write@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_app1>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
call   1040 <s_strlen@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%rcx
mov    %ebp,%edi
mov    %r14d,%esi
mov    %rbx,%rdx
call   1050 <m_write@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @s_app1(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i32, i32* %3
%7 = call i32 @s_strlen(i32 %6)
store i32 %7, i32* %5
%8 = load i32, i32* %3
%9 = load i32, i32* %5
%10 = load i8*, i8** %4
%11 = load i8*, i8** %4
%12 = call i64 @strlen(i8* %11)
%13 = add nsw i64 %12, 1
%14 = call i32 @m_write(i32 %8, i32 %9, i8* %10, i64 %13)
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @s_app1(i32 returned %0, i8* %1) {
%3 = tail call i32 @s_strlen(i32 %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add nsw i64 %4, 1
%6 = tail call i32 @m_write(i32 %0, i32 %3, i8* %1, i64 %5)
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ atoll(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ tsc_spinticks(int /*<<< orphan*/);
int main(int argc, char **argv) {
  if (argc < 2) {
    fprintf(stderr, "Usage: %s <ticks>\n", argv[0]);
    exit(1);
  }
  tsc_spinticks(atoll(argv[1]));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1186 <main+0x46>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe89(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atoll@plt>
mov    %eax,%edi
call   1050 <tsc_spinticks@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
jle    115a <main+0x1a>
mov    0x8(%rsi),%rdi
call   1030 <atoll@plt>
mov    %eax,%edi
call   1050 <tsc_spinticks@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe93(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"Usage: %s <ticks>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @atoll(i8* %18)
%20 = call i32 @tsc_spinticks(i32 %19)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"Usage: %s <ticks>\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoll(i8* %11)
%13 = tail call i32 @tsc_spinticks(i32 %12)
ret i32 0
}
/* Variables and functions */
int recv(int, char *, size_t, int /*<<< orphan*/);
int sck_recv(int s, char *buffer, size_t size) {
  int rc;
  rc = recv(s, buffer, size, 0);
  if (rc <= 0)
    return -1;
  return rc;
}


x86 assembly (clang, -O0):
<sck_recv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jg     114e <sck_recv+0x3e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1154 <sck_recv+0x44>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sck_recv>:
push   %rax
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
mov    $0xffffffff,%ecx
cmovle %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @sck_recv(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i64 %2, i64* %7
%9 = load i32, i32* %5
%10 = load i8*, i8** %6
%11 = load i64, i64* %7
%12 = call i32 @recv(i32 %9, i8* %10, i64 %11, i32 0)
store i32 %12, i32* %8
%13 = load i32, i32* %8
%14 = icmp sle i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %3
store i32 -1, i32* %4
br label %18
16: ; preds = %3
%17 = load i32, i32* %8
store i32 %17, i32* %4
br label %18
18: ; preds = %16, %15
%19 = load i32, i32* %4
ret i32 %19
}

LLVM IR (-O2):
define i32 @sck_recv(i32 %0, i8* %1, i64 %2) {
%4 = tail call i32 @recv(i32 %0, i8* %1, i64 %2, i32 0)
%5 = icmp slt i32 %4, 1
%6 = select i1 %5, i32 -1, i32 %4
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ write_src(char *);
void logvar_handler(void) { write_src("vid_writef(\"%%d\", POP());\n"); }


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

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

LLVM IR (-O0):
@.str = [27 x i8] c"vid_writef(\22%%d\22, POP());\0A\00"
define void @logvar_handler() {
%1 = call i32 @write_src(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"vid_writef(\22%%d\22, POP());\0A\00"
define void @logvar_handler() {
%1 = tail call i32 @write_src(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int os_snprintf_error(size_t size, int res) {
  return res < 0 || (unsigned int)res >= size;
}


x86 assembly (clang, -O0):
<os_snprintf_error>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0xd(%rbp)
jl     1127 <os_snprintf_error+0x27>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%rax
setae  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_snprintf_error>:
test   %esi,%esi
sets   %al
mov    %esi,%ecx
cmp    %rdi,%rcx
setae  %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @os_snprintf_error(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp slt i32 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = load i32, i32* %4
%9 = zext i32 %8 to i64
%10 = load i64, i64* %3
%11 = icmp uge i64 %9, %10
br label %12
12: ; preds = %7, %2
%13 = phi i1 [ true, %2 ], [ %11, %7 ]
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @os_snprintf_error(i64 %0, i32 %1) {
%3 = icmp slt i32 %1, 0
%4 = zext i32 %1 to i64
%5 = icmp uge i64 %4, %0
%6 = or i1 %3, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
int get_screen_offset(int col, int row) { return (row * 80 + col) * 2; }


x86 assembly (clang, -O0):
<get_screen_offset>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
imul   $0x50,-0x8(%rbp),%eax
add    -0x4(%rbp),%eax
shl    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_screen_offset>:
lea    (%rsi,%rsi,4),%eax
shl    $0x4,%eax
add    %edi,%eax
add    %eax,%eax
ret

LLVM IR (-O0):
define i32 @get_screen_offset(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 = mul nsw i32 %5, 80
%7 = load i32, i32* %3
%8 = add nsw i32 %6, %7
%9 = mul nsw i32 %8, 2
ret i32 %9
}

LLVM IR (-O2):
define i32 @get_screen_offset(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, 80
%4 = add nsw i32 %3, %0
%5 = shl nsw i32 %4, 1
ret i32 %5
}
void clear(struct node *head) {}


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

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

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

LLVM IR (-O2):
%struct.node = type opaque
define void @clear(%struct.node* nocapture %0) {
ret void
}
unsigned long round_up(unsigned long val, unsigned long rounding) {
  return (val + rounding - 1) & ~(rounding - 1);
}


x86 assembly (clang, -O0):
<round_up>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
sub    $0x1,%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
xor    $0xffffffffffffffff,%rcx
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_up>:
lea    (%rdi,%rsi,1),%rax
add    $0xffffffffffffffff,%rax
neg    %rsi
and    %rsi,%rax
ret

LLVM IR (-O0):
define i64 @round_up(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = add i64 %5, %6
%8 = sub i64 %7, 1
%9 = load i64, i64* %4
%10 = sub i64 %9, 1
%11 = xor i64 %10, -1
%12 = and i64 %8, %11
ret i64 %12
}

LLVM IR (-O2):
define i64 @round_up(i64 %0, i64 %1) {
%3 = add i64 %0, -1
%4 = add i64 %3, %1
%5 = sub i64 0, %1
%6 = and i64 %4, %5
ret i64 %6
}
int mylen(const char *s) {
  int index = 0;
  while (s[index] != '\0') {
    index++;
  }
  return index;
}


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

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

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

LLVM IR (-O2):
define i32 @mylen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
scalar_t__ exists(char *);
const char *scan_pm_gsm() {
  if (exists("/sys/class/i2c-adapter/i2c-0/0-0073/neo1973-pm-gsm.0"))
    return "/sys/class/i2c-adapter/i2c-0/0-0073/neo1973-pm-gsm.0";
  return NULL;
}


x86 assembly (clang, -O0):
<scan_pm_gsm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <exists@plt>
cmp    $0x0,%rax
je     113e <scan_pm_gsm+0x2e>
lea    0xecb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1146 <scan_pm_gsm+0x36>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_pm_gsm>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <exists@plt>
test   %rax,%rax
cmovne %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [53 x i8] c"/sys/class/i2c-adapter/i2c-0/0-0073/neo1973-pm-gsm.0\00"
define i8* @scan_pm_gsm() {
%1 = alloca i8*
%2 = call i64 @exists(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
store i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8** %1
br label %6
5: ; preds = %0
store i8* null, i8** %1
br label %6
6: ; preds = %5, %4
%7 = load i8*, i8** %1
ret i8* %7
}

LLVM IR (-O2):
@.str = [53 x i8] c"/sys/class/i2c-adapter/i2c-0/0-0073/neo1973-pm-gsm.0\00"
define i8* @scan_pm_gsm() {
%1 = tail call i64 @exists(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* null, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ FALSE;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ cbreak();
int /*<<< orphan*/ curs_set(int /*<<< orphan*/);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ keypad(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ stdscr;
void init() {
  initscr();
  noecho();
  cbreak();
  keypad(stdscr, TRUE);
  curs_set(FALSE);
}


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <initscr@plt>
mov    $0x0,%al
call   1060 <noecho@plt>
mov    $0x0,%al
call   1030 <cbreak@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
mov    0x2e67(%rip),%rax
mov    (%rax),%esi
call   1040 <keypad@plt>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
call   1070 <curs_set@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init>:
push   %rax
xor    %eax,%eax
call   1050 <initscr@plt>
xor    %eax,%eax
call   1060 <noecho@plt>
xor    %eax,%eax
call   1030 <cbreak@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
mov    0x2e6a(%rip),%rax
mov    (%rax),%esi
call   1040 <keypad@plt>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1070 <curs_set@plt>

LLVM IR (-O0):
@stdscr = global i32 0
@TRUE = global i32 0
@FALSE = global i32 0
define void @init() {
%1 = call i32 (...) @initscr()
%2 = call i32 (...) @noecho()
%3 = call i32 (...) @cbreak()
%4 = load i32, i32* @stdscr
%5 = load i32, i32* @TRUE
%6 = call i32 @keypad(i32 %4, i32 %5)
%7 = load i32, i32* @FALSE
%8 = call i32 @curs_set(i32 %7)
ret void
}

LLVM IR (-O2):
@stdscr = global i32 0
@TRUE = global i32 0
@FALSE = global i32 0
define void @init() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 (...) @noecho()
%3 = tail call i32 (...) @cbreak()
%4 = load i32, i32* @stdscr
%5 = load i32, i32* @TRUE
%6 = tail call i32 @keypad(i32 %4, i32 %5)
%7 = load i32, i32* @FALSE
%8 = tail call i32 @curs_set(i32 %7)
ret void
}
void emit_lambda(struct processor_explicatory_state *process_state,
                 struct modern_stream *stream, void *stream_state,
                 struct modern_vfile *vfile, void *vfile_state) {}


x86 assembly (clang, -O0):
<emit_lambda>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.processor_explicatory_state = type opaque
%struct.modern_stream = type opaque
%struct.modern_vfile = type opaque
define void @emit_lambda(%struct.processor_explicatory_state* %0, %struct.modern_stream* %1, i8* %2, %struct.modern_vfile* %3, i8* %4) {
%6 = alloca %struct.processor_explicatory_state*
%7 = alloca %struct.modern_stream*
%8 = alloca i8*
%9 = alloca %struct.modern_vfile*
%10 = alloca i8*
store %struct.processor_explicatory_state* %0, %struct.processor_explicatory_state** %6
store %struct.modern_stream* %1, %struct.modern_stream** %7
store i8* %2, i8** %8
store %struct.modern_vfile* %3, %struct.modern_vfile** %9
store i8* %4, i8** %10
ret void
}

LLVM IR (-O2):
%struct.processor_explicatory_state = type opaque
%struct.modern_stream = type opaque
%struct.modern_vfile = type opaque
define void @emit_lambda(%struct.processor_explicatory_state* nocapture %0, %struct.modern_stream* nocapture %1, i8* nocapture %2, %struct.modern_vfile* nocapture %3, i8* nocapture %4) {
ret void
}
/* Variables and functions */
int mvm_enable_irq(unsigned int);
int xnarch_end_irq(unsigned irq) { return mvm_enable_irq(irq); }


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

x86 assembly (clang, -O2):
<xnarch_end_irq>:
jmp    1030 <mvm_enable_irq@plt>

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

LLVM IR (-O2):
define i32 @xnarch_end_irq(i32 %0) {
%2 = tail call i32 @mvm_enable_irq(i32 %0)
ret i32 %2
}
int pos_byte2(int num_bloque) { return num_bloque % 1024; }


x86 assembly (clang, -O0):
<pos_byte2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pos_byte2>:
mov    %edi,%eax
lea    0x3ff(%rax),%ecx
test   %edi,%edi
cmovns %edi,%ecx
and    $0xfffffc00,%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @pos_byte2(i32 %0) {
%2 = srem i32 %0, 1024
ret i32 %2
}
/* Type definitions */
struct random {
  int dummy;
};

/* Variables and functions */
int random_int32(struct random *);
int random_d100(struct random *r) {
  if (r == NULL)
    return -1;
  return (random_int32(r) % 100) + 1;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <random_d100+0x23>
movl   $0xffffffff,-0x4(%rbp)
jmp    114a <random_d100+0x3a>
mov    -0x10(%rbp),%rdi
call   1030 <random_int32@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
test   %rdi,%rdi
je     1140 <random_d100+0x30>
push   %rax
call   1030 <random_int32@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
add    $0x8,%rsp
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.random = type { i32 }
define i32 @random_d100(%struct.random* %0) {
%2 = alloca i32
%3 = alloca %struct.random*
store %struct.random* %0, %struct.random** %3
%4 = load %struct.random*, %struct.random** %3
%5 = icmp eq %struct.random* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 -1, i32* %2
br label %12
7: ; preds = %1
%8 = load %struct.random*, %struct.random** %3
%9 = call i32 @random_int32(%struct.random* %8)
%10 = srem i32 %9, 100
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
br label %12
12: ; preds = %7, %6
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
%struct.random = type { i32 }
define i32 @random_d100(%struct.random* %0) {
%2 = icmp eq %struct.random* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i32 @random_int32(%struct.random* %0)
%5 = srem i32 %4, 100
%6 = add nsw i32 %5, 1
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ -1, %1 ]
ret i32 %8
}