xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ is_a_prime_or_not(int, int);
main(void) {
  is_a_prime_or_not(50, 13);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @is_a_prime_or_not(i32 50, i32 13)
ret i32 0
}
void __attribute__((nomicromips)) nofoo(void) {}


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

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

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

LLVM IR (-O2):
define void @nofoo() {
ret void
}
int arch_restore_syscall(struct ptrace_child *child) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.ptrace_child = type opaque
define i32 @arch_restore_syscall(%struct.ptrace_child* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ clear32(int, int);
void HW_184(void) { clear32(0xD800184, 0x438E); }


x86 assembly (clang, -O0):
<HW_184>:
push   %rbp
mov    %rsp,%rbp
mov    $0xd800184,%edi
mov    $0x438e,%esi
call   1030 <clear32@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<HW_184>:
mov    $0xd800184,%edi
mov    $0x438e,%esi
jmp    1030 <clear32@plt>

LLVM IR (-O0):
define void @HW_184() {
%1 = call i32 @clear32(i32 226492804, i32 17294)
ret void
}

LLVM IR (-O2):
define void @HW_184() {
%1 = tail call i32 @clear32(i32 226492804, i32 17294)
ret void
}
long int quatro() { return -1; }


x86 assembly (clang, -O0):
<quatro>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffffffffffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<quatro>:
mov    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
define i64 @quatro() {
ret i64 -1
}

LLVM IR (-O2):
define i64 @quatro() {
ret i64 -1
}
/* Variables and functions */
int /*<<< orphan*/ finalizesurfgen_();
void FinalizeSurfgen() { finalizesurfgen_(); }


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

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

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

LLVM IR (-O2):
define void @FinalizeSurfgen() {
%1 = tail call i32 (...) @finalizesurfgen_()
ret void
}
void NEOMOTE_1_UART_MOTE_RestoreConfig(void) {}


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

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

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

LLVM IR (-O2):
define void @NEOMOTE_1_UART_MOTE_RestoreConfig() {
ret void
}
int f4(int a, int b) { return 2 * a + 6 * b; }


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

x86 assembly (clang, -O2):
<f4>:
add    %edi,%edi
lea    (%rsi,%rsi,2),%eax
lea    (%rdi,%rax,2),%eax
ret

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

LLVM IR (-O2):
define i32 @f4(i32 %0, i32 %1) {
%3 = shl nsw i32 %0, 1
%4 = mul nsw i32 %1, 6
%5 = add nsw i32 %4, %3
ret i32 %5
}
/* Variables and functions */
void *__real_malloc(size_t);
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void *__wrap_malloc(size_t size) {
  void *ret = __real_malloc(size);
  if (size && !ret) {
    fputs("Out of memory!\n", stderr);
    abort();
  }
  return ret;
}


x86 assembly (clang, -O0):
<__wrap_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <__real_malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     117b <__wrap_malloc+0x4b>
cmpq   $0x0,-0x10(%rbp)
jne    117b <__wrap_malloc+0x4b>
mov    0x2e7a(%rip),%rax
mov    (%rax),%esi
lea    0xe91(%rip),%rdi
call   1040 <fputs@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__wrap_malloc>:
push   %rbx
mov    %rdi,%rbx
call   1050 <__real_malloc@plt>
test   %rbx,%rbx
je     1143 <__wrap_malloc+0x13>
test   %rax,%rax
je     1145 <__wrap_malloc+0x15>
pop    %rbx
ret
mov    0x2e94(%rip),%rax
mov    (%rax),%esi
lea    0xeab(%rip),%rdi
call   1040 <fputs@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"Out of memory!\0A\00"
@stderr = global i32 0
define i8* @__wrap_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @__real_malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i64, i64* %2
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = icmp ne i8* %9, null
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = load i32, i32* @stderr
%13 = call i32 @fputs(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = call i32 (...) @abort()
unreachable
15: ; preds = %8, %1
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
@.str = [16 x i8] c"Out of memory!\0A\00"
@stderr = global i32 0
define i8* @__wrap_malloc(i64 %0) {
%2 = tail call i8* @__real_malloc(i64 %0)
%3 = icmp eq i64 %0, 0
%4 = icmp ne i8* %2, null
%5 = select i1 %3, i1 true, i1 %4
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = tail call i32 @fputs(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ SendIpcFlag(unsigned long);
void SendIpcCommand(unsigned long int command, unsigned long int address,
                    unsigned long int data, unsigned long int flag) {
  (*((volatile unsigned long *)(0x400FB700 + 0x000000030))) = command;
  (*((volatile unsigned long *)(0x400FB700 + 0x000000034))) = address;
  (*((volatile unsigned long *)(0x400FB700 + 0x000000038))) = data;
  if (flag != 0x00000000) {
    SendIpcFlag(flag);
  }
}


x86 assembly (clang, -O0):
<SendIpcCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0x400fb730,%eax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rcx
mov    $0x400fb734,%eax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rcx
mov    $0x400fb738,%eax
mov    %rcx,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     1160 <SendIpcCommand+0x50>
mov    -0x20(%rbp),%rdi
call   1030 <SendIpcFlag@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SendIpcCommand>:
mov    %rdi,0x400fb730
40
mov    %rsi,0x400fb734
40
mov    %rdx,0x400fb738
40
test   %rcx,%rcx
je     1135 <SendIpcCommand+0x25>
mov    %rcx,%rdi
jmp    1030 <SendIpcFlag@plt>
ret

LLVM IR (-O0):
define void @SendIpcCommand(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = load i64, i64* %5
store volatile i64 %9, i64* inttoptr (i64 1074771760 to i64*)
%10 = load i64, i64* %6
store volatile i64 %10, i64* inttoptr (i64 1074771764 to i64*)
%11 = load i64, i64* %7
store volatile i64 %11, i64* inttoptr (i64 1074771768 to i64*)
%12 = load i64, i64* %8
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %4
%15 = load i64, i64* %8
%16 = call i32 @SendIpcFlag(i64 %15)
br label %17
17: ; preds = %14, %4
ret void
}

LLVM IR (-O2):
define void @SendIpcCommand(i64 %0, i64 %1, i64 %2, i64 %3) {
store volatile i64 %0, i64* inttoptr (i64 1074771760 to i64*)
store volatile i64 %1, i64* inttoptr (i64 1074771764 to i64*)
store volatile i64 %2, i64* inttoptr (i64 1074771768 to i64*)
%5 = icmp eq i64 %3, 0
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 @SendIpcFlag(i64 %3)
br label %8
8: ; preds = %6, %4
ret void
}
void testSyscall() {}


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

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

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

LLVM IR (-O2):
define void @testSyscall() {
ret void
}
unsigned int arikkei_memory_equal(const void *l, const void *r,
                                  unsigned int size) {
  unsigned int i;
  for (i = 0; i < size; i++) {
    if (*((const char *)l + i) != *((const char *)r + i))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<arikkei_memory_equal>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jae    115f <arikkei_memory_equal+0x5f>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%edx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     114c <arikkei_memory_equal+0x4c>
movl   $0x0,-0x4(%rbp)
jmp    1166 <arikkei_memory_equal+0x66>
jmp    1151 <arikkei_memory_equal+0x51>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1116 <arikkei_memory_equal+0x16>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<arikkei_memory_equal>:
mov    $0x1,%eax
test   %edx,%edx
je     1122 <arikkei_memory_equal+0x22>
mov    %edx,%r8d
xor    %edx,%edx
xchg   %ax,%ax
movzbl (%rdi,%rdx,1),%ecx
cmp    (%rsi,%rdx,1),%cl
jne    1123 <arikkei_memory_equal+0x23>
add    $0x1,%rdx
cmp    %rdx,%r8
jne    1110 <arikkei_memory_equal+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @arikkei_memory_equal(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %17, label %5
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %16, %6
br i1 %8, label %17, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %16, %7 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %1, i64 %10
%14 = load i8, i8* %13
%15 = icmp eq i8 %12, %14
%16 = add nuw nsw i64 %10, 1
br i1 %15, label %7, label %17
17: ; preds = %9, %7, %3
%18 = phi i32 [ 1, %3 ], [ 1, %7 ], [ 0, %9 ]
ret i32 %18
}
/* Variables and functions */
int atoi(char *);
int getfield(int, char *, char *, int, char);
int getfldint(int fldno, char *str, int *dst, char sep) {
  char tmp[21];
  int ret;
  *dst = 0;
  ret = getfield(fldno, str, tmp, 20, sep);
  if (ret)
    *dst = atoi(tmp);
  return (ret);
}


x86 assembly (clang, -O0):
<getfldint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %cl,%al
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %al,-0x19(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x30(%rbp),%rdx
mov    $0x14,%ecx
movsbl -0x19(%rbp),%r8d
call   1030 <getfield@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     117a <getfldint+0x5a>
lea    -0x30(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x34(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getfldint>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%r8d
mov    %rdx,%rbx
movl   $0x0,(%rdx)
mov    %rsp,%rdx
mov    $0x14,%ecx
call   1030 <getfield@plt>
mov    %eax,%ebp
test   %eax,%eax
je     114f <getfldint+0x2f>
mov    %rsp,%rdi
call   1040 <atoi@plt>
mov    %eax,(%rbx)
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @getfldint(i32 %0, i8* %1, i32* %2, i8 signext %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i8
%9 = alloca [21 x i8]
%10 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32* %2, i32** %7
store i8 %3, i8* %8
%11 = load i32*, i32** %7
store i32 0, i32* %11
%12 = load i32, i32* %5
%13 = load i8*, i8** %6
%14 = getelementptr inbounds [21 x i8], [21 x i8]* %9, i64 0, i64 0
%15 = load i8, i8* %8
%16 = call i32 @getfield(i32 %12, i8* %13, i8* %14, i32 20, i8 signext %15)
store i32 %16, i32* %10
%17 = load i32, i32* %10
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %4
%20 = getelementptr inbounds [21 x i8], [21 x i8]* %9, i64 0, i64 0
%21 = call i32 @atoi(i8* %20)
%22 = load i32*, i32** %7
store i32 %21, i32* %22
br label %23
23: ; preds = %19, %4
%24 = load i32, i32* %10
ret i32 %24
}

LLVM IR (-O2):
define i32 @getfldint(i32 %0, i8* %1, i32* nocapture writeonly %2, i8 signext %3) {
%5 = alloca [21 x i8]
%6 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 0, i64 0
store i32 0, i32* %2
%7 = call i32 @getfield(i32 %0, i8* %1, i8* %6, i32 20, i8 signext %3)
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %4
%10 = call i32 @atoi(i8* %6)
store i32 %10, i32* %2
br label %11
11: ; preds = %9, %4
ret i32 %7
}
int autoStack(int stackCount) { return stackCount++; }


x86 assembly (clang, -O0):
<autoStack>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @autoStack(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
store i32 %4, i32* %2
ret i32 %3
}

LLVM IR (-O2):
define i32 @autoStack(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ wait(int /*<<< orphan*/);
void process_join(int nproc, int id) {
  int i;
  if (id == 0) {
    for (i = 1; i < nproc; i++)
      wait(0);
  } else
    exit(0);
}


x86 assembly (clang, -O0):
<process_join>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1165 <process_join+0x45>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1160 <process_join+0x40>
xor    %edi,%edi
call   1040 <wait@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113f <process_join+0x1f>
jmp    116c <process_join+0x4c>
xor    %edi,%edi
call   1030 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_join>:
push   %rbx
test   %esi,%esi
jne    113e <process_join+0x1e>
mov    %edi,%ebx
cmp    $0x2,%edi
jl     113c <process_join+0x1c>
add    $0xffffffff,%ebx
nop
xor    %edi,%edi
call   1040 <wait@plt>
add    $0xffffffff,%ebx
jne    1130 <process_join+0x10>
pop    %rbx
ret
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @process_join(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %19
8: ; preds = %2
store i32 1, i32* %5
br label %9
9: ; preds = %15, %8
%10 = load i32, i32* %5
%11 = load i32, i32* %3
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %18
13: ; preds = %9
%14 = call i32 @wait(i32 0)
br label %15
15: ; preds = %13
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
store i32 %17, i32* %5
br label %9
18: ; preds = %9
br label %21
19: ; preds = %2
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %18
ret void
}

LLVM IR (-O2):
define void @process_join(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %13
6: ; preds = %4, %6
%7 = phi i32 [ %9, %6 ], [ 1, %4 ]
%8 = tail call i32 @wait(i32 0)
%9 = add nuw nsw i32 %7, 1
%10 = icmp eq i32 %9, %0
br i1 %10, label %13, label %6
11: ; preds = %2
%12 = tail call i32 @exit(i32 0)
unreachable
13: ; preds = %6, %4
ret void
}
int HTextWidth(char *str) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @HTextWidth(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ configure_server();
int /*<<< orphan*/ server_main_process();
int start_server(void) {
  configure_server();
  server_main_process();
  return 1;
}


x86 assembly (clang, -O0):
<start_server>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <configure_server@plt>
mov    $0x0,%al
call   1040 <server_main_process@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_server>:
push   %rax
xor    %eax,%eax
call   1030 <configure_server@plt>
xor    %eax,%eax
call   1040 <server_main_process@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @start_server() {
%1 = call i32 (...) @configure_server()
%2 = call i32 (...) @server_main_process()
ret i32 1
}

LLVM IR (-O2):
define i32 @start_server() {
%1 = tail call i32 (...) @configure_server()
%2 = tail call i32 (...) @server_main_process()
ret i32 1
}
int control(long v) { return 1; }


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

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

LLVM IR (-O0):
define i32 @control(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
ret i32 1
}

LLVM IR (-O2):
define i32 @control(i64 %0) {
ret i32 1
}
int increment(int n) { return n + 1; }


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

x86 assembly (clang, -O2):
<increment>:
lea    0x1(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @increment(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
ret i32 %4
}

LLVM IR (-O2):
define i32 @increment(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
/* Type definitions */
typedef long int32_t;

/* Variables and functions */
long jpl_get_long(const void *ephem, const int value) {
  return (*(int32_t *)((char *)ephem + value));
}


x86 assembly (clang, -O0):
<jpl_get_long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<jpl_get_long>:
movslq %esi,%rax
mov    (%rdi,%rax,1),%rax
ret

LLVM IR (-O0):
define i64 @jpl_get_long(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = bitcast i8* %8 to i64*
%10 = load i64, i64* %9
ret i64 %10
}

LLVM IR (-O2):
define i64 @jpl_get_long(i8* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = bitcast i8* %4 to i64*
%6 = load i64, i64* %5
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ ee24_write_sequential(char, short, char *, int);
void ee24_write_byte(char device_address, short data_address, char byte) {
  ee24_write_sequential(device_address, data_address, &byte, 1);
}


x86 assembly (clang, -O0):
<ee24_write_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %si,%cx
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %cx,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    -0x1(%rbp),%al
lea    -0x5(%rbp),%rdx
mov    $0x1,%ecx
movsbl %al,%edi
movswl -0x4(%rbp),%esi
call   1030 <ee24_write_sequential@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ee24_write_byte>:
push   %rax
mov    %dl,0x7(%rsp)
lea    0x7(%rsp),%rdx
mov    $0x1,%ecx
call   1030 <ee24_write_sequential@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @ee24_write_byte(i8 signext %0, i16 signext %1, i8 signext %2) {
%4 = alloca i8
%5 = alloca i16
%6 = alloca i8
store i8 %0, i8* %4
store i16 %1, i16* %5
store i8 %2, i8* %6
%7 = load i8, i8* %4
%8 = load i16, i16* %5
%9 = call i32 @ee24_write_sequential(i8 signext %7, i16 signext %8, i8* %6, i32 1)
ret void
}

LLVM IR (-O2):
define void @ee24_write_byte(i8 signext %0, i16 signext %1, i8 signext %2) {
%4 = alloca i8
store i8 %2, i8* %4
%5 = call i32 @ee24_write_sequential(i8 signext %0, i16 signext %1, i8* %4, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("MBEDTLS_CTR_DRBG_C and/or MBEDTLS_ENTROPY_C and/or "
         "MBEDTLS_NET_C and/or MBEDTLS_SSL_CLI_C and/or UNIX "
         "not defined.\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 = [116 x i8] c"MBEDTLS_CTR_DRBG_C and/or MBEDTLS_ENTROPY_C and/or MBEDTLS_NET_C and/or MBEDTLS_SSL_CLI_C and/or UNIX not defined.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([116 x i8], [116 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [115 x i8] c"MBEDTLS_CTR_DRBG_C and/or MBEDTLS_ENTROPY_C and/or MBEDTLS_NET_C and/or MBEDTLS_SSL_CLI_C and/or UNIX not defined.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([115 x i8], [115 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ test_fn(int, char **);
int /*<<< orphan*/ test_init(int, char **);
int main(int argc, char **argv) {
  test_init(argc, argv);
  test_fn(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 <test_init@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <test_fn@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
call   1030 <test_init@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <test_fn@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
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 @test_init(i32 %6, i8** %7)
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @test_fn(i32 %9, i8** %10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @test_init(i32 %0, i8** %1)
%4 = tail call i32 @test_fn(i32 %0, i8** %1)
ret i32 0
}
int bitcount(unsigned x) {
  int n;
  n = 0;
  while (x) {
    x &= (x - 1);
    n++;
  }
  return n;
}


x86 assembly (clang, -O0):
<bitcount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1132 <bitcount+0x32>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <bitcount+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitcount>:
xor    %eax,%eax
test   %edi,%edi
je     111c <bitcount+0x1c>
cs nopw 0x0(%rax,%rax,1)
lea    -0x1(%rdi),%ecx
add    $0x1,%eax
and    %edi,%ecx
mov    %ecx,%edi
jne    1110 <bitcount+0x10>
ret

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

LLVM IR (-O2):
define i32 @bitcount(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = phi i32 [ %7, %3 ], [ %0, %1 ]
%6 = add i32 %5, -1
%7 = and i32 %6, %5
%8 = add nuw nsw i32 %4, 1
%9 = icmp eq i32 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %11
}
/* Variables and functions */
scalar_t__ strchr(char const *, int);
int _i_set_member(const char *set, int c) { return strchr(set, c) ? 1 : 0; }


x86 assembly (clang, -O0):
<_i_set_member>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_i_set_member>:
push   %rax
call   1030 <strchr@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @_i_set_member(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i64 @strchr(i8* %5, i32 %6)
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 1, i32 0
ret i32 %10
}

LLVM IR (-O2):
define i32 @_i_set_member(i8* %0, i32 %1) {
%3 = tail call i64 @strchr(i8* %0, i32 %1)
%4 = icmp ne i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ dcc_create_kids(int);
int /*<<< orphan*/ dcc_reap_kids(int /*<<< orphan*/);
void dcc_manage_kids(int listen_fd) {
  dcc_reap_kids(0);
  dcc_create_kids(listen_fd);
}


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

x86 assembly (clang, -O2):
<dcc_manage_kids>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
call   1030 <dcc_reap_kids@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <dcc_create_kids@plt>

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

LLVM IR (-O2):
define void @dcc_manage_kids(i32 %0) {
%2 = tail call i32 @dcc_reap_kids(i32 0)
%3 = tail call i32 @dcc_create_kids(i32 %0)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
bool bitIsSet(uint32_t bits, int bit) {
  assert(bit >= 0 && bit < (1 + 'z' - 'a'));
  return bits & (1 << bit);
}


x86 assembly (clang, -O0):
<bitIsSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jl     1137 <bitIsSet+0x27>
cmpl   $0x1a,-0x8(%rbp)
setl   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitIsSet>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x1a,%esi
setb   %dil
call   1030 <assert@plt>
mov    $0x1,%eax
mov    %ebx,%ecx
shl    %cl,%eax
and    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @bitIsSet(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 = icmp sge i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 26
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ false, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = shl i32 1, %15
%17 = and i32 %14, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @bitIsSet(i32 %0, i32 %1) {
%3 = icmp ult i32 %1, 26
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = shl nuw i32 1, %1
%7 = and i32 %6, %0
ret i32 %7
}
int test_imm_ECint8_mem(signed char *val) {
  return ((*val) & (-0xEC << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_ECint8_mem>:
movsbl (%rdi),%eax
test   $0xffffff14,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_ECint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = and i32 %3, -236
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -40, i32 -20
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ link(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ symlink(char *, char *);
int main() {
  link("./ejercicio5", "./enlaceDuro.hard");
  printf("Creado enlace duro.\n");
  symlink("./ejercicio5", "./enlaceSym.sym");
  printf("Creado enlace simbólico.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    0xec0(%rip),%rsi
call   1050 <link@plt>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9b(%rip),%rdi
lea    0xec8(%rip),%rsi
call   1040 <symlink@plt>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rbx
lea    0xece(%rip),%rsi
mov    %rbx,%rdi
call   1050 <link@plt>
lea    0xee1(%rip),%rdi
call   1030 <puts@plt>
lea    0xec5(%rip),%rsi
mov    %rbx,%rdi
call   1040 <symlink@plt>
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"./ejercicio5\00"
@.str.1 = [18 x i8] c"./enlaceDuro.hard\00"
@.str.2 = [21 x i8] c"Creado enlace duro.\0A\00"
@.str.3 = [16 x i8] c"./enlaceSym.sym\00"
@.str.4 = [27 x i8] c"Creado enlace simb\C3\B3lico.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @link(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @symlink(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"./ejercicio5\00"
@.str.1 = [18 x i8] c"./enlaceDuro.hard\00"
@.str.3 = [16 x i8] c"./enlaceSym.sym\00"
@str = [20 x i8] c"Creado enlace duro.\00"
@str.5 = [26 x i8] c"Creado enlace simb\C3\B3lico.\00"
define i32 @main() {
%1 = tail call i32 @link(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @symlink(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
void print_char(void *char_val) { printf("%c", *(char *)char_val); }


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

x86 assembly (clang, -O2):
<print_char>:
movsbl (%rdi),%esi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define void @print_char(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %4)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @print_char(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %2)
ret void
}
int ft_isblank(int c) {
  if (c == 9 || c == 11 || c == 32)
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<ft_isblank>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x9,-0x8(%rbp)
je     1125 <ft_isblank+0x25>
cmpl   $0xb,-0x8(%rbp)
je     1125 <ft_isblank+0x25>
cmpl   $0x20,-0x8(%rbp)
jne    1131 <ft_isblank+0x31>
movl   $0x1,-0x4(%rbp)
jmp    1138 <ft_isblank+0x38>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isblank>:
cmp    $0x20,%edi
ja     111d <ft_isblank+0x1d>
mov    $0x1,%eax
mov    %edi,%ecx
movabs $0x100000a00,%rdx
bt     %rcx,%rdx
jae    111d <ft_isblank+0x1d>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_isblank(i32 %0) {
switch i32 %0, label %2 [
i32 32, label %3
i32 11, label %3
i32 9, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
/* Type definitions */
struct task_struct {
  int dummy;
};
struct rq {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ BUG();
void prio_changed_idle(struct rq *rq, struct task_struct *p, int oldprio) {
  BUG();
}


x86 assembly (clang, -O0):
<prio_changed_idle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1030 <BUG@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.rq = type { i32 }
%struct.task_struct = type { i32 }
define void @prio_changed_idle(%struct.rq* %0, %struct.task_struct* %1, i32 %2) {
%4 = alloca %struct.rq*
%5 = alloca %struct.task_struct*
%6 = alloca i32
store %struct.rq* %0, %struct.rq** %4
store %struct.task_struct* %1, %struct.task_struct** %5
store i32 %2, i32* %6
%7 = call i32 (...) @BUG()
ret void
}

LLVM IR (-O2):
%struct.rq = type { i32 }
%struct.task_struct = type { i32 }
define void @prio_changed_idle(%struct.rq* nocapture readnone %0, %struct.task_struct* nocapture readnone %1, i32 %2) {
%4 = tail call i32 (...) @BUG()
ret void
}
/* Type definitions */
struct etimer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ etimer_elapsed(struct etimer *);
struct etimer *etimer_start(int /*<<< orphan*/);
int /*<<< orphan*/ print(char *, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int main(int argc, char *argv[]) {
  struct etimer *t1 = etimer_start(0);
  sleep(1);
  print("elapsed: %ld\n", etimer_elapsed(t1));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1030 <etimer_start@plt>
mov    %rax,-0x18(%rbp)
mov    $0x1,%edi
call   1060 <sleep@plt>
mov    -0x18(%rbp),%rdi
call   1050 <etimer_elapsed@plt>
mov    %eax,%esi
lea    0xe83(%rip),%rdi
call   1040 <print@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1030 <etimer_start@plt>
mov    %rax,%rbx
mov    $0x1,%edi
call   1060 <sleep@plt>
mov    %rbx,%rdi
call   1050 <etimer_elapsed@plt>
lea    0xe9c(%rip),%rdi
mov    %eax,%esi
call   1040 <print@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.etimer = type { i32 }
@.str = [14 x i8] c"elapsed: %ld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.etimer*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call %struct.etimer* @etimer_start(i32 0)
store %struct.etimer* %7, %struct.etimer** %6
%8 = call i32 @sleep(i32 1)
%9 = load %struct.etimer*, %struct.etimer** %6
%10 = call i32 @etimer_elapsed(%struct.etimer* %9)
%11 = call i32 @print(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
%struct.etimer = type { i32 }
@.str = [14 x i8] c"elapsed: %ld\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call %struct.etimer* @etimer_start(i32 0)
%4 = tail call i32 @sleep(i32 1)
%5 = tail call i32 @etimer_elapsed(%struct.etimer* %3)
%6 = tail call i32 @print(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, void *);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
void *imprimir_hola_mundo(void *tid) {
  printf("Hola mundo. Saludos del hilo %d \n", tid);
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<imprimir_hola_mundo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imprimir_hola_mundo>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"Hola mundo. Saludos del hilo %d \0A\00"
define i8* @imprimir_hola_mundo(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @pthread_exit(i32* null)
%7 = load i8*, i8** %2
ret i8* %7
}

LLVM IR (-O2):
@.str = [34 x i8] c"Hola mundo. Saludos del hilo %d \0A\00"
define noalias i8* @imprimir_hola_mundo(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ glClearColor(double, double, double, double);
int /*<<< orphan*/ glClearDepth(double);
int /*<<< orphan*/ scene_reshape(int, int);
void scene_init(int w, int h) {
  glClearColor(0.4, 0.4, 0.4, 0.0);
  glClearDepth(1.0);
  scene_reshape(w, h);
}


x86 assembly (clang, -O0):
<scene_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  0xec2(%rip),%xmm2
xorps  %xmm3,%xmm3
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1030 <glClearColor@plt>
movsd  0xea4(%rip),%xmm0
call   1050 <glClearDepth@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <scene_reshape@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scene_init>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
movsd  0xec1(%rip),%xmm0
xorps  %xmm3,%xmm3
movaps %xmm0,%xmm1
movaps %xmm0,%xmm2
call   1030 <glClearColor@plt>
movsd  0xeb3(%rip),%xmm0
call   1050 <glClearDepth@plt>
mov    %ebp,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <scene_reshape@plt>

LLVM IR (-O0):
define void @scene_init(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @glClearColor(double 4.000000e-01, double 4.000000e-01, double 4.000000e-01, double 0.000000e+00)
%6 = call i32 @glClearDepth(double 1.000000e+00)
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = call i32 @scene_reshape(i32 %7, i32 %8)
ret void
}

LLVM IR (-O2):
define void @scene_init(i32 %0, i32 %1) {
%3 = tail call i32 @glClearColor(double 4.000000e-01, double 4.000000e-01, double 4.000000e-01, double 0.000000e+00)
%4 = tail call i32 @glClearDepth(double 1.000000e+00)
%5 = tail call i32 @scene_reshape(i32 %0, i32 %1)
ret void
}
int __sx25_write_config_parameters(int linkid, struct config_ident *ipt,
                                   struct LINK_config_data *lpt,
                                   struct X25_config_data *xpt,
                                   struct MLP_config_data *mpt,
                                   struct LAPB_config_data *lbp,
                                   struct LLC2_config_data *l2p,
                                   struct WAN_config_data *wpt) {
  return (0);
}


x86 assembly (clang, -O0):
<__sx25_write_config_parameters>:
push   %rbp
mov    %rsp,%rbp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.config_ident = type opaque
%struct.LINK_config_data = type opaque
%struct.X25_config_data = type opaque
%struct.MLP_config_data = type opaque
%struct.LAPB_config_data = type opaque
%struct.LLC2_config_data = type opaque
%struct.WAN_config_data = type opaque
define i32 @__sx25_write_config_parameters(i32 %0, %struct.config_ident* %1, %struct.LINK_config_data* %2, %struct.X25_config_data* %3, %struct.MLP_config_data* %4, %struct.LAPB_config_data* %5, %struct.LLC2_config_data* %6, %struct.WAN_config_data* %7) {
%9 = alloca i32
%10 = alloca %struct.config_ident*
%11 = alloca %struct.LINK_config_data*
%12 = alloca %struct.X25_config_data*
%13 = alloca %struct.MLP_config_data*
%14 = alloca %struct.LAPB_config_data*
%15 = alloca %struct.LLC2_config_data*
%16 = alloca %struct.WAN_config_data*
store i32 %0, i32* %9
store %struct.config_ident* %1, %struct.config_ident** %10
store %struct.LINK_config_data* %2, %struct.LINK_config_data** %11
store %struct.X25_config_data* %3, %struct.X25_config_data** %12
store %struct.MLP_config_data* %4, %struct.MLP_config_data** %13
store %struct.LAPB_config_data* %5, %struct.LAPB_config_data** %14
store %struct.LLC2_config_data* %6, %struct.LLC2_config_data** %15
store %struct.WAN_config_data* %7, %struct.WAN_config_data** %16
ret i32 0
}

LLVM IR (-O2):
%struct.config_ident = type opaque
%struct.LINK_config_data = type opaque
%struct.X25_config_data = type opaque
%struct.MLP_config_data = type opaque
%struct.LAPB_config_data = type opaque
%struct.LLC2_config_data = type opaque
%struct.WAN_config_data = type opaque
define i32 @__sx25_write_config_parameters(i32 %0, %struct.config_ident* nocapture readnone %1, %struct.LINK_config_data* nocapture readnone %2, %struct.X25_config_data* nocapture readnone %3, %struct.MLP_config_data* nocapture readnone %4, %struct.LAPB_config_data* nocapture readnone %5, %struct.LLC2_config_data* nocapture readnone %6, %struct.WAN_config_data* nocapture readnone %7) {
ret i32 0
}
void gpio_write(void *gpio_base, unsigned int offset, unsigned int value) {
  *((volatile unsigned *)(gpio_base + offset)) = value;
}


x86 assembly (clang, -O0):
<gpio_write>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %edx,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpio_write>:
mov    %esi,%eax
mov    %edx,(%rdi,%rax,1)
ret

LLVM IR (-O0):
define void @gpio_write(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = zext i32 %9 to i64
%11 = getelementptr i8, i8* %8, i64 %10
%12 = bitcast i8* %11 to i32*
store volatile i32 %7, i32* %12
ret void
}

LLVM IR (-O2):
define void @gpio_write(i8* %0, i32 %1, i32 %2) {
%4 = zext i32 %1 to i64
%5 = getelementptr i8, i8* %0, i64 %4
%6 = bitcast i8* %5 to i32*
store volatile i32 %2, i32* %6
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int get_bit(char const *mem, uint64_t bit_idx) {
  uint64_t bytes = bit_idx / 8;
  return ((*(mem + bytes) & (1 << bit_idx % 8)) != 0);
}


x86 assembly (clang, -O0):
<get_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
mov    %edx,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_bit>:
mov    %esi,%ecx
lea    0x7(%rcx),%eax
test   %esi,%esi
cmovns %esi,%eax
sar    $0x3,%eax
cltq
movsbl (%rdi,%rax,1),%eax
and    $0x7,%cl
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @get_bit(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = sdiv i32 %6, 8
store i32 %7, i32* %5
%8 = load i8*, i8** %3
%9 = load i32, i32* %5
%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 = load i32, i32* %4
%15 = srem i32 %14, 8
%16 = shl i32 1, %15
%17 = and i32 %13, %16
%18 = icmp ne i32 %17, 0
%19 = zext i1 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @get_bit(i8* nocapture %0, i32 %1) {
%3 = sdiv i32 %1, 8
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = and i32 %1, 7
%9 = lshr i32 %7, %8
%10 = and i32 %9, 1
ret i32 %10
}