xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ siginfo_t;

/* Variables and functions */
int /*<<< orphan*/ save_regs(void *);
void usr2_handler(int signum, siginfo_t *info, void *ctxt_v) {
  save_regs(ctxt_v);
}


x86 assembly (clang, -O0):
<usr2_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <save_regs@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usr2_handler>:
mov    %rdx,%rdi
jmp    1030 <save_regs@plt>

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

LLVM IR (-O2):
define void @usr2_handler(i32 %0, i32* nocapture readnone %1, i8* %2) {
%4 = tail call i32 @save_regs(i8* %2)
ret void
}
unsigned long __mp_snapshot(void) { return 0; }


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

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

LLVM IR (-O0):
define i64 @__mp_snapshot() {
ret i64 0
}

LLVM IR (-O2):
define i64 @__mp_snapshot() {
ret i64 0
}
/* Type definitions */
typedef scalar_t__ uint64_t;
typedef int int64_t;

/* Variables and functions */
int64_t pts_diff(const uint64_t a, const uint64_t b) {
  return ((int64_t)(a - b) << 31) >> 31;
}


x86 assembly (clang, -O0):
<pts_diff>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
sub    -0x10(%rbp),%rax
shl    $0x1f,%eax
sar    $0x1f,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pts_diff>:
mov    %rdi,%rax
sub    %esi,%eax
and    $0x1,%eax
neg    %eax
ret

LLVM IR (-O0):
define i32 @pts_diff(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 = sub nsw i64 %5, %6
%8 = trunc i64 %7 to i32
%9 = shl i32 %8, 31
%10 = ashr i32 %9, 31
ret i32 %10
}

LLVM IR (-O2):
define i32 @pts_diff(i64 %0, i64 %1) {
%3 = sub nsw i64 %0, %1
%4 = trunc i64 %3 to i32
%5 = and i32 %4, 1
%6 = sub nsw i32 0, %5
ret i32 %6
}
int test_imm_97uint16_mem(unsigned short *val) {
  return ((*val) & (-0x97 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_97uint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, -151
%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_97uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -151
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int asciitoint(char *s) {
  int i = 0;
  int n;
  for (i = 0; *(s + i) >= '0' && *(s + i) <= '9'; i++) {
    n = n * 10 + (*(s + i) - '0');
    return n;
  }
}


x86 assembly (clang, -O0):
<asciitoint>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x19(%rbp)
jl     1145 <asciitoint+0x45>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1155 <asciitoint+0x55>
jmp    1173 <asciitoint+0x73>
imul   $0xa,-0x18(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<asciitoint>:
movsbl (%rdi),%eax
add    $0xffffffd0,%eax
ret

LLVM IR (-O0):
define i32 @asciitoint(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
store i32 0, i32* %4
br label %6
6: ; preds = %36, %1
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 48
br i1 %13, label %14, label %22
14: ; preds = %6
%15 = load i8*, i8** %3
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp sle i32 %20, 57
br label %22
22: ; preds = %14, %6
%23 = phi i1 [ false, %6 ], [ %21, %14 ]
br i1 %23, label %24, label %39
24: ; preds = %22
%25 = load i32, i32* %5
%26 = mul nsw i32 %25, 10
%27 = load i8*, i8** %3
%28 = load i32, i32* %4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = sub nsw i32 %32, 48
%34 = add nsw i32 %26, %33
store i32 %34, i32* %5
%35 = load i32, i32* %5
store i32 %35, i32* %2
br label %39
36: ; No predecessors!
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
store i32 %38, i32* %4
br label %6
39: ; preds = %24, %22
%40 = load i32, i32* %2
ret i32 %40
}

LLVM IR (-O2):
define i32 @asciitoint(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = add i8 %2, -48
%5 = icmp ult i8 %4, 10
%6 = add nsw i32 %3, -48
%7 = select i1 %5, i32 %6, i32 undef
ret i32 %7
}
/* Variables and functions */
int syscall(int, int, int, int);
int reboot(int type) { return syscall(88, 0xfee1dead, 672274793, type); }


x86 assembly (clang, -O0):
<reboot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x58,%edi
mov    $0xfee1dead,%esi
mov    $0x28121969,%edx
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reboot>:
mov    %edi,%ecx
mov    $0x58,%edi
mov    $0xfee1dead,%esi
mov    $0x28121969,%edx
jmp    1030 <syscall@plt>

LLVM IR (-O0):
define i32 @reboot(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @syscall(i32 88, i32 -18751827, i32 672274793, i32 %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @reboot(i32 %0) {
%2 = tail call i32 @syscall(i32 88, i32 -18751827, i32 672274793, i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
scalar_t__ fsync(int);
int syncFileAndClose(int fd) {
  if (fsync(fd) != 0) {
    close(fd);
    return 1;
  }
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<syncFileAndClose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <fsync@plt>
cmp    $0x0,%rax
je     1151 <syncFileAndClose+0x31>
mov    -0x8(%rbp),%edi
call   1030 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    1160 <syncFileAndClose+0x40>
mov    -0x8(%rbp),%edi
call   1030 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<syncFileAndClose>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1040 <fsync@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %ebx,%edi
call   1030 <close@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @syncFileAndClose(i32 %0) {
%2 = tail call i64 @fsync(i32 %0)
%3 = icmp ne i64 %2, 0
%4 = tail call i32 @close(i32 %0)
%5 = zext i1 %3 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void *malloc(size_t);
int /*<<< orphan*/ perror(char *);
void *xmalloc(size_t n) {
  void *p = NULL;
  if ((p = malloc(n)) == 0) {
    perror("xmalloc");
    exit(1);
  }
  return p;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1171 <xmalloc+0x41>
lea    0xe9e(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rax
call   1030 <malloc@plt>
test   %rax,%rax
je     113d <xmalloc+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"xmalloc\00"
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int unlink(char const *);
void file_delete(const char *path) {
  if (unlink(path) == -1) {
    perror("safe_unlink - Failed to unlink.");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<file_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <unlink@plt>
cmp    $0xffffffff,%eax
jne    1168 <file_delete+0x38>
lea    0xeab(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_delete>:
push   %rax
call   1030 <unlink@plt>
cmp    $0xffffffff,%eax
je     113d <file_delete+0xd>
pop    %rax
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"safe_unlink - Failed to unlink.\00"
@EXIT_FAILURE = global i32 0
define void @file_delete(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @unlink(i8* %3)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
10: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"safe_unlink - Failed to unlink.\00"
@EXIT_FAILURE = global i32 0
define void @file_delete(i8* nocapture %0) {
%2 = tail call i32 @unlink(i8* %0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void mostrarVectorPuntero(int cant, int *ptrVector) {
  int i = 0;
  for (i = 0; i < cant; i++) {
    printf("%3d\n", *(ptrVector + i));
  }
  return;
}


x86 assembly (clang, -O0):
<mostrarVectorPuntero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115e <mostrarVectorPuntero+0x4e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <mostrarVectorPuntero+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mostrarVectorPuntero>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1145 <mostrarVectorPuntero+0x35>
mov    %rsi,%r15
mov    %edi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <mostrarVectorPuntero+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%3d\0A\00"
define void @mostrarVectorPuntero(i32 %0, i32* nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %1, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Type definitions */
struct inhalt {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct inhalt *);
void close_inhalt(struct inhalt *data) { free(data); }


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

x86 assembly (clang, -O2):
<close_inhalt>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.inhalt = type { i32 }
define void @close_inhalt(%struct.inhalt* %0) {
%2 = alloca %struct.inhalt*
store %struct.inhalt* %0, %struct.inhalt** %2
%3 = load %struct.inhalt*, %struct.inhalt** %2
%4 = call i32 @free(%struct.inhalt* %3)
ret void
}

LLVM IR (-O2):
%struct.inhalt = type { i32 }
define void @close_inhalt(%struct.inhalt* nocapture %0) {
%2 = tail call i32 @free(%struct.inhalt* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ light_off();
int /*<<< orphan*/ light_on();
void on_off() {
  light_on();
  for (int i = 0; i < 250000; ++i) {
  }
  light_off();
  for (int i = 0; i < 250000; ++i) {
  }
}


x86 assembly (clang, -O0):
<on_off>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <light_on@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x3d090,-0x4(%rbp)
jge    1156 <on_off+0x36>
jmp    1148 <on_off+0x28>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1136 <on_off+0x16>
mov    $0x0,%al
call   1040 <light_off@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3d090,-0x8(%rbp)
jge    1184 <on_off+0x64>
jmp    1176 <on_off+0x56>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1164 <on_off+0x44>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<on_off>:
push   %rax
xor    %eax,%eax
call   1030 <light_on@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <light_off@plt>

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

LLVM IR (-O2):
define void @on_off() {
%1 = tail call i32 (...) @light_on()
%2 = tail call i32 (...) @light_off()
ret void
}
int convert4To8(int b) {
  int c = b & 0xf;
  return (c << 4) | c;
}


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

x86 assembly (clang, -O2):
<convert4To8>:
and    $0xf,%edi
mov    %edi,%eax
shl    $0x4,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @convert4To8(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, 15
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = shl i32 %6, 4
%8 = load i32, i32* %3
%9 = or i32 %7, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @convert4To8(i32 %0) {
%2 = and i32 %0, 15
%3 = mul nuw nsw i32 %2, 17
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ num_inverso(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char *argv[]) {
  int num;
  printf("\nIntroduzca un nombre entero: ");
  scanf("%d", &num);
  printf("\nEl nombre introducido al reves es: ");
  num_inverso(num);
  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)
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
call   1040 <num_inverso@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%edi
call   1040 <num_inverso@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"\0AIntroduzca un nombre entero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [37 x i8] c"\0AEl nombre introducido al reves es: \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%9 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32, i32* %6
%11 = call i32 @num_inverso(i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"\0AIntroduzca un nombre entero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [37 x i8] c"\0AEl nombre introducido al reves es: \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%8 = load i32, i32* %3
%9 = call i32 @num_inverso(i32 %8)
ret i32 0
}
void BN_GF2m_mod_mul(void) {}


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

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

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

LLVM IR (-O2):
define void @BN_GF2m_mod_mul() {
ret void
}
numeric(c) char c;
{
  c = c & 127;
  return ((c >= '0') & (c <= '9'));
}


x86 assembly (clang, -O0):
<numeric>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
and    $0x7f,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
setge  %al
and    $0x1,%al
movzbl %al,%eax
movsbl -0x1(%rbp),%ecx
cmp    $0x39,%ecx
setle  %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<numeric>:
and    $0x7f,%edi
add    $0xffffffd0,%edi
xor    %eax,%eax
cmp    $0xa,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @numeric(i32 %0) {
%2 = alloca i8
%3 = trunc i32 %0 to i8
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = and i32 %5, 127
%7 = trunc i32 %6 to i8
store i8 %7, i8* %2
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp sge i32 %9, 48
%11 = zext i1 %10 to i32
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = icmp sle i32 %13, 57
%15 = zext i1 %14 to i32
%16 = and i32 %11, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @numeric(i32 %0) {
%2 = and i32 %0, 127
%3 = add nsw i32 %2, -48
%4 = icmp ult i32 %3, 10
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ USERNOTICE;
typedef int /*<<< orphan*/ ASN1_VALUE;

/* Variables and functions */
int /*<<< orphan*/ ASN1_item_free(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ USERNOTICE_it;
void USERNOTICE_free(USERNOTICE *a) {
  ASN1_item_free((ASN1_VALUE *)a, &USERNOTICE_it);
}


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

x86 assembly (clang, -O2):
<USERNOTICE_free>:
mov    0x2ec9(%rip),%rsi
jmp    1030 <ASN1_item_free@plt>

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

LLVM IR (-O2):
@USERNOTICE_it = global i32 0
define void @USERNOTICE_free(i32* %0) {
%2 = tail call i32 @ASN1_item_free(i32* %0, i32* @USERNOTICE_it)
ret void
}
/* Type definitions */
typedef char uint8_t;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ _write(int, char *, int);
void oled_cursor_set(int fd, bool val) {
  uint8_t buf[] = {'C', 'S', val ? 1 : 0};
  _write(fd, buf, sizeof(buf));
}


x86 assembly (clang, -O0):
<oled_cursor_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movb   $0x43,-0xb(%rbp)
movb   $0x53,-0xa(%rbp)
mov    -0x8(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,-0x9(%rbp)
mov    -0x4(%rbp),%edi
lea    -0xb(%rbp),%rsi
mov    $0x3,%edx
call   1030 <_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<oled_cursor_set>:
push   %rax
movw   $0x5343,0x5(%rsp)
test   %esi,%esi
setne  0x7(%rsp)
lea    0x5(%rsp),%rsi
mov    $0x3,%edx
call   1030 <_write@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @oled_cursor_set(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [3 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
store i8 67, i8* %6
%7 = getelementptr inbounds i8, i8* %6, i64 1
store i8 83, i8* %7
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i64
%12 = select i1 %10, i32 1, i32 0
%13 = trunc i32 %12 to i8
store i8 %13, i8* %8
%14 = load i32, i32* %3
%15 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%16 = call i32 @_write(i32 %14, i8* %15, i32 3)
ret void
}

LLVM IR (-O2):
define void @oled_cursor_set(i32 %0, i32 %1) {
%3 = alloca [3 x i8]
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
store i8 67, i8* %4
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 1
store i8 83, i8* %5
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 2
%7 = icmp ne i32 %1, 0
%8 = zext i1 %7 to i8
store i8 %8, i8* %6
%9 = call i32 @_write(i32 %0, i8* %4, i32 3)
ret void
}
/* Type definitions */
struct _reent {
  int dummy;
};

/* Variables and functions */
void *realloc(void *, int);
void *_realloc_r(struct _reent *ptr, void *old, int newlen) {
  return realloc(old, newlen);
}


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

x86 assembly (clang, -O2):
<_realloc_r>:
mov    %rsi,%rdi
mov    %edx,%esi
jmp    1030 <realloc@plt>

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

LLVM IR (-O2):
%struct._reent = type { i32 }
define i8* @_realloc_r(%struct._reent* nocapture readnone %0, i8* %1, i32 %2) {
%4 = tail call i8* @realloc(i8* %1, i32 %2)
ret i8* %4
}
void g_option_context_set_help_enabled() {}


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

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

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

LLVM IR (-O2):
define void @g_option_context_set_help_enabled() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ print_translate(int);
void errormem() {
  print_translate(24);
  exit(1);
}


x86 assembly (clang, -O0):
<errormem>:
push   %rbp
mov    %rsp,%rbp
mov    $0x18,%edi
call   1030 <print_translate@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<errormem>:
push   %rax
mov    $0x18,%edi
call   1030 <print_translate@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @errormem() {
%1 = call i32 @print_translate(i32 24)
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @errormem() {
%1 = tail call i32 @print_translate(i32 24)
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ cgdiv();
int /*<<< orphan*/ gen(char *);
void cgmod(void) {
  cgdiv();
  gen("movq\t%rdx,%rax");
}


x86 assembly (clang, -O0):
<cgmod>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <cgdiv@plt>
lea    0xece(%rip),%rdi
call   1030 <gen@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgmod>:
push   %rax
xor    %eax,%eax
call   1040 <cgdiv@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1030 <gen@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"movq\09%rdx,%rax\00"
define void @cgmod() {
%1 = call i32 (...) @cgdiv()
%2 = call i32 @gen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"movq\09%rdx,%rax\00"
define void @cgmod() {
%1 = tail call i32 (...) @cgdiv()
%2 = tail call i32 @gen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
scalar_t__ pthread_mutex_lock(int /*<<< orphan*/ *);
void *thread_func(void *arg) {
  pthread_mutex_t *mutex = (pthread_mutex_t *)arg;
  if (pthread_mutex_lock(mutex) != 0)
    exit(1);
  return NULL;
}


x86 assembly (clang, -O0):
<thread_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <pthread_mutex_lock@plt>
cmp    $0x0,%rax
je     1151 <thread_func+0x31>
mov    $0x1,%edi
call   1030 <exit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_func>:
push   %rax
call   1040 <pthread_mutex_lock@plt>
test   %rax,%rax
jne    112f <thread_func+0xf>
xor    %eax,%eax
pop    %rcx
ret
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define i8* @thread_func(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = call i64 @pthread_mutex_lock(i32* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %1
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @thread_func(i8* %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i64 @pthread_mutex_lock(i32* %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
ret i8* null
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
uint64_t __noswap64(uint64_t x) { return x; }


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

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

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

LLVM IR (-O2):
define i32 @__noswap64(i32 returned %0) {
ret i32 %0
}
double add(double a, double b) {
  double c;
  c = a + b;
  return c;
}


x86 assembly (clang, -O0):
<add>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<add>:
addsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @add(double %0, double %1) {
%3 = fadd double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ __NR_getpid;
long syscall(int /*<<< orphan*/);
long mygetpid(void) { return syscall(__NR_getpid); }


x86 assembly (clang, -O0):
<mygetpid>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <syscall@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<mygetpid>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
@__NR_getpid = global i32 0
define i64 @mygetpid() {
%1 = load i32, i32* @__NR_getpid
%2 = call i64 @syscall(i32 %1)
ret i64 %2
}

LLVM IR (-O2):
@__NR_getpid = global i32 0
define i64 @mygetpid() {
%1 = load i32, i32* @__NR_getpid
%2 = tail call i64 @syscall(i32 %1)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int warterm_erase() {
  puts("C\01");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [3 x i8] c"C\01\00"
define i32 @warterm_erase() {
%1 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"C\01\00"
define i32 @warterm_erase() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
unsigned short ComputeChecksum(int sum, int swap) {
  unsigned short checksum;
  if ((swap)) {
    sum = ((sum & 0xFF00) >> 8) + ((sum & 0x00FF) << 8);
  }
  checksum = ~sum;
  return checksum;
}


x86 assembly (clang, -O0):
<ComputeChecksum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1130 <ComputeChecksum+0x30>
mov    -0x4(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
mov    %ax,-0xa(%rbp)
movzwl -0xa(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ComputeChecksum>:
mov    %edi,%eax
rol    $0x8,%ax
test   %esi,%esi
cmove  %edi,%eax
not    %eax
ret

LLVM IR (-O0):
define zeroext i16 @ComputeChecksum(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i16
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = load i32, i32* %3
%10 = and i32 %9, 65280
%11 = ashr i32 %10, 8
%12 = load i32, i32* %3
%13 = and i32 %12, 255
%14 = shl i32 %13, 8
%15 = add nsw i32 %11, %14
store i32 %15, i32* %3
br label %16
16: ; preds = %8, %2
%17 = load i32, i32* %3
%18 = xor i32 %17, -1
%19 = trunc i32 %18 to i16
store i16 %19, i16* %5
%20 = load i16, i16* %5
ret i16 %20
}

LLVM IR (-O2):
define zeroext i16 @ComputeChecksum(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = trunc i32 %0 to i16
%5 = tail call i16 @llvm.bswap.i16(i16 %4)
%6 = zext i16 %5 to i32
%7 = select i1 %3, i32 %0, i32 %6
%8 = trunc i32 %7 to i16
%9 = xor i16 %8, -1
ret i16 %9
}
void RTLogWriteDebugger(void) {}


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

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

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

LLVM IR (-O2):
define void @RTLogWriteDebugger() {
ret void
}
int MAIN__(int ac, char **av) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @MAIN__(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
extern __attribute__((__gnu___)) double __attribute__((__const__))
carg(double _Complex _Z) {
  double res;
  __asm__("fpatan;" : "=t"(res) : "0"(__real__ _Z), "u"(__imag__ _Z) : "st(1)");
  return res;
}


x86 assembly (clang, -O0):
<carg>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
fldl   -0x20(%rbp)
fldl   -0x28(%rbp)
fxch   %st(1)
fpatan
fstpl  -0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<carg>:
movsd  %xmm0,-0x8(%rsp)
movsd  %xmm1,-0x10(%rsp)
fldl   -0x8(%rsp)
fldl   -0x10(%rsp)
fxch   %st(1)
fpatan
fstpl  -0x18(%rsp)
movsd  -0x18(%rsp),%xmm0
ret

LLVM IR (-O0):
define double @carg(double %0, double %1) {
%3 = alloca { double, double }
%4 = alloca double
%5 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 0
store double %0, double* %5
%6 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 1
store double %1, double* %6
%7 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 0
%8 = load double, double* %7
%9 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 1
%10 = load double, double* %9
%11 = call double asm "fpatan;", "={st},0,{st(1)},~{st(1)},~{dirflag},~{fpsr},~{flags}"(double %8, double %10)
store double %11, double* %4
%12 = load double, double* %4
ret double %12
}

LLVM IR (-O2):
define double @carg(double %0, double %1) {
%3 = tail call double asm "fpatan;", "={st},0,{st(1)},~{st(1)},~{dirflag},~{fpsr},~{flags}"(double %0, double %1)
ret double %3
}
int is_operator(char c) {
  int out;
  out = (c == '-');
  out = (out || (c == '+'));
  return (out);
}


x86 assembly (clang, -O0):
<is_operator>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x2d,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jne    1138 <is_operator+0x38>
movsbl -0x1(%rbp),%eax
cmp    $0x2b,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_operator>:
add    $0xd5,%dil
xor    %eax,%eax
test   $0xfd,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @is_operator(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 45
%7 = zext i1 %6 to i32
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 43
br label %14
14: ; preds = %10, %1
%15 = phi i1 [ true, %1 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
store i32 %16, i32* %3
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @is_operator(i8 signext %0) {
%2 = icmp eq i8 %0, 45
%3 = icmp eq i8 %0, 43
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
volatile bool buttonLeft(volatile unsigned int *p) {
  static bool b = false;
  if (((*p) & 0x00000004) == 0x00000004) {
    if (b == false) {
      b = true;
      return true;
    } else
      return false;
  }
  b = false;
  return false;
}


x86 assembly (clang, -O0):
<buttonLeft>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0x4,%eax
cmp    $0x4,%eax
jne    1149 <buttonLeft+0x49>
cmpl   $0x0,0x2f03(%rip)
jne    113d <buttonLeft+0x3d>
movl   $0x1,0x2ef3(%rip)
movl   $0x1,-0x4(%rbp)
jmp    115a <buttonLeft+0x5a>
movl   $0x0,-0x4(%rbp)
jmp    115a <buttonLeft+0x5a>
movl   $0x0,0x2ed1(%rip)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<buttonLeft>:
mov    (%rdi),%ecx
xor    %edx,%edx
test   $0x4,%cl
je     1119 <buttonLeft+0x19>
mov    $0x1,%edx
xor    %eax,%eax
cmpb   $0x0,0x2f0d(%rip)
jne    1127 <buttonLeft+0x27>
shr    $0x2,%cl
and    $0x1,%cl
mov    %cl,0x2eff(%rip)
mov    %edx,%eax
ret

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

LLVM IR (-O2):
@buttonLeft.b = internal unnamed_addr global i1 false
define i32 @buttonLeft(i32* %0) {
%2 = load volatile i32, i32* %0
%3 = and i32 %2, 4
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = load i1, i1* @buttonLeft.b
br i1 %6, label %10, label %7
7: ; preds = %1, %5
%8 = phi i32 [ 1, %5 ], [ 0, %1 ]
%9 = xor i1 %4, true
store i1 %9, i1* @buttonLeft.b
br label %10
10: ; preds = %7, %5
%11 = phi i32 [ 0, %5 ], [ %8, %7 ]
ret i32 %11
}
/* Type definitions */
typedef int wint_t;

/* Variables and functions */
scalar_t__ tolower(int);
wint_t towlower(wint_t c) { return c <= 255 ? (wint_t)tolower(c) : c; }


x86 assembly (clang, -O0):
<towlower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xff,-0x4(%rbp)
jg     1138 <towlower+0x28>
mov    -0x4(%rbp),%edi
call   1030 <tolower@plt>
mov    %eax,-0x8(%rbp)
jmp    113e <towlower+0x2e>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<towlower>:
mov    %edi,%eax
cmp    $0xff,%edi
jg     1126 <towlower+0x16>
push   %rax
mov    %eax,%edi
call   1030 <tolower@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @towlower(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 %3, 255
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i32, i32* %2
%7 = call i64 @tolower(i32 %6)
%8 = trunc i64 %7 to i32
br label %11
9: ; preds = %1
%10 = load i32, i32* %2
br label %11
11: ; preds = %9, %5
%12 = phi i32 [ %8, %5 ], [ %10, %9 ]
ret i32 %12
}

LLVM IR (-O2):
define i32 @towlower(i32 %0) {
%2 = icmp slt i32 %0, 256
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i64 @tolower(i32 %0)
%5 = trunc i64 %4 to i32
br label %6
6: ; preds = %1, %3
%7 = phi i32 [ %5, %3 ], [ %0, %1 ]
ret i32 %7
}
int null_contents(void *c) { return !c; }


x86 assembly (clang, -O0):
<null_contents>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<null_contents>:
xor    %eax,%eax
test   %rdi,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @null_contents(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
%5 = xor i1 %4, true
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @null_contents(i8* readnone %0) {
%2 = icmp eq i8* %0, null
%3 = zext i1 %2 to i32
ret i32 %3
}
int ubi_dbg_is_bitflip(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @ubi_dbg_is_bitflip() {
ret i32 0
}

LLVM IR (-O2):
define i32 @ubi_dbg_is_bitflip() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ emitln(char *);
int /*<<< orphan*/ expression();
int /*<<< orphan*/ match(char);
void notEquals() {
  match('#');
  expression();
  emitln("pop\t%%ebx");
  emitln("cmp\t%%eax,%%ebx");
  emitln("setne\t%%al");
  emitln("movsx\t%%al,%%eax\t#extend al to eax");
}


x86 assembly (clang, -O0):
<notEquals>:
push   %rbp
mov    %rsp,%rbp
mov    $0x23,%edi
call   1050 <match@plt>
mov    $0x0,%al
call   1040 <expression@plt>
lea    0xeb4(%rip),%rdi
call   1030 <emitln@plt>
lea    0xeb2(%rip),%rdi
call   1030 <emitln@plt>
lea    0xeb6(%rip),%rdi
call   1030 <emitln@plt>
lea    0xeb5(%rip),%rdi
call   1030 <emitln@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<notEquals>:
push   %rax
mov    $0x23,%edi
call   1050 <match@plt>
xor    %eax,%eax
call   1040 <expression@plt>
lea    0xeb7(%rip),%rdi
call   1030 <emitln@plt>
lea    0xeb5(%rip),%rdi
call   1030 <emitln@plt>
lea    0xeb9(%rip),%rdi
call   1030 <emitln@plt>
lea    0xeb8(%rip),%rdi
pop    %rax
jmp    1030 <emitln@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"pop\09%%ebx\00"
@.str.1 = [16 x i8] c"cmp\09%%eax,%%ebx\00"
@.str.2 = [11 x i8] c"setne\09%%al\00"
@.str.3 = [35 x i8] c"movsx\09%%al,%%eax\09#extend al to eax\00"
define void @notEquals() {
%1 = call i32 @match(i8 signext 35)
%2 = call i32 (...) @expression()
%3 = call i32 @emitln(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @emitln(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @emitln(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @emitln(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"pop\09%%ebx\00"
@.str.1 = [16 x i8] c"cmp\09%%eax,%%ebx\00"
@.str.2 = [11 x i8] c"setne\09%%al\00"
@.str.3 = [35 x i8] c"movsx\09%%al,%%eax\09#extend al to eax\00"
define void @notEquals() {
%1 = tail call i32 @match(i8 signext 35)
%2 = tail call i32 (...) @expression()
%3 = tail call i32 @emitln(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @emitln(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @emitln(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @emitln(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
ret void
}
unsigned IangleToQval(int iA) {
  unsigned s, ip, fp, qv;
  s = 0;
  if (iA < 0) {
    iA = -iA;
    s = 1;
  }
  qv = ((iA * 45) << 6) + 1440;
  if (s == 1)
    qv = -qv;
  return qv;
}


x86 assembly (clang, -O0):
<IangleToQval>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1127 <IangleToQval+0x27>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
imul   $0x2d,-0x4(%rbp),%eax
shl    $0x6,%eax
add    $0x5a0,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1148 <IangleToQval+0x48>
xor    %eax,%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IangleToQval>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
imul   $0xb40,%eax,%eax
mov    $0xfffffa60,%ecx
sub    %eax,%ecx
add    $0x5a0,%eax
test   %edi,%edi
cmovs  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @IangleToQval(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* %2
%11 = sub nsw i32 0, %10
store i32 %11, i32* %2
store i32 1, i32* %3
br label %12
12: ; preds = %9, %1
%13 = load i32, i32* %2
%14 = mul nsw i32 %13, 45
%15 = shl i32 %14, 6
%16 = add nsw i32 %15, 1440
store i32 %16, i32* %6
%17 = load i32, i32* %3
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %22
19: ; preds = %12
%20 = load i32, i32* %6
%21 = sub i32 0, %20
store i32 %21, i32* %6
br label %22
22: ; preds = %19, %12
%23 = load i32, i32* %6
ret i32 %23
}

LLVM IR (-O2):
define i32 @IangleToQval(i32 %0) {
%2 = icmp slt i32 %0, 0
%3 = sub nsw i32 0, %0
%4 = select i1 %2, i32 %3, i32 %0
%5 = mul i32 %4, 2880
%6 = add nsw i32 %5, 1440
%7 = sub i32 -1440, %5
%8 = select i1 %2, i32 %7, i32 %6
ret i32 %8
}
/* Variables and functions */
void fhexdump(int /*<<< orphan*/, unsigned int, void const *, unsigned int);
int /*<<< orphan*/ stdout;
void hexdump(unsigned int address, const void *buffer, unsigned int bufsize) {
  return fhexdump(stdout, address, buffer, bufsize);
}


x86 assembly (clang, -O0):
<hexdump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2eb7(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1030 <fhexdump@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexdump>:
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %edi,%esi
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
jmp    1030 <fhexdump@plt>

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

LLVM IR (-O2):
@stdout = global i32 0
define void @hexdump(i32 %0, i8* %1, i32 %2) {
%4 = load i32, i32* @stdout
tail call void @fhexdump(i32 %4, i32 %0, i8* %1, i32 %2)
ret void
}