xunge/DecIR huggingface dataset:
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
uint32_t TimerIntStatus(uint32_t ui32Base, bool bMasked) {
  ;
  return (bMasked ? (*((volatile unsigned long *)(ui32Base + 0x00000020)))
                  : (*((volatile unsigned long *)(ui32Base + 0x0000001C))));
}


x86 assembly (clang, -O0):
<TimerIntStatus>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1126 <TimerIntStatus+0x26>
mov    -0x8(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1132 <TimerIntStatus+0x32>
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerIntStatus>:
mov    %rdi,-0x8(%rsp)
xor    %eax,%eax
test   %esi,%esi
setne  %al
mov    -0x8(%rsp),%rcx
mov    0x1c(%rcx,%rax,4),%rax
ret

LLVM IR (-O0):
define i64 @TimerIntStatus(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store volatile i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load volatile i64, i64* %3
%9 = add i64 %8, 32
%10 = inttoptr i64 %9 to i64*
%11 = load volatile i64, i64* %10
br label %17
12: ; preds = %2
%13 = load volatile i64, i64* %3
%14 = add i64 %13, 28
%15 = inttoptr i64 %14 to i64*
%16 = load volatile i64, i64* %15
br label %17
17: ; preds = %12, %7
%18 = phi i64 [ %11, %7 ], [ %16, %12 ]
ret i64 %18
}

LLVM IR (-O2):
define i64 @TimerIntStatus(i64 %0, i32 %1) {
%3 = alloca i64
store volatile i64 %0, i64* %3
%4 = icmp eq i32 %1, 0
%5 = load volatile i64, i64* %3
%6 = select i1 %4, i64 28, i64 32
%7 = add i64 %5, %6
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
ret i64 %9
}
/* Variables and functions */
char *_ltrim(char *);
char *_rtrim(char *);
char *_btrim(char *pStr) {
  char *p = _ltrim(pStr);
  return _rtrim(p);
}


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

x86 assembly (clang, -O2):
<_btrim>:
push   %rax
call   1040 <_ltrim@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <_rtrim@plt>

LLVM IR (-O0):
define i8* @_btrim(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @_ltrim(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i8* @_rtrim(i8* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @_btrim(i8* %0) {
%2 = tail call i8* @_ltrim(i8* %0)
%3 = tail call i8* @_rtrim(i8* %2)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ fatal_error(char *, char const *, char const *,
                               unsigned long const);
void internal_error(const char *desc, const char *source_file,
                    const unsigned long int line) {
  fatal_error("Internal error %s, file %s, line %lu", desc, source_file, line);
}


x86 assembly (clang, -O0):
<internal_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xec9(%rip),%rdi
call   1030 <fatal_error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<internal_error>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee0(%rip),%rdi
jmp    1030 <fatal_error@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"Internal error %s, file %s, line %lu\00"
define void @internal_error(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i32 @fatal_error(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8, i64 %9)
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"Internal error %s, file %s, line %lu\00"
define void @internal_error(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @fatal_error(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i64 %2)
ret void
}
/* Type definitions */
struct DynArr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ pushDynArr(struct DynArr *, double);
void pitonum(struct DynArr *stack) { pushDynArr(stack, 3.14159265); }


x86 assembly (clang, -O0):
<pitonum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
movsd  0xed8(%rip),%xmm0
call   1030 <pushDynArr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pitonum>:
movsd  0xee8(%rip),%xmm0
jmp    1030 <pushDynArr@plt>

LLVM IR (-O0):
%struct.DynArr = type { i32 }
define void @pitonum(%struct.DynArr* %0) {
%2 = alloca %struct.DynArr*
store %struct.DynArr* %0, %struct.DynArr** %2
%3 = load %struct.DynArr*, %struct.DynArr** %2
%4 = call i32 @pushDynArr(%struct.DynArr* %3, double 0x400921FB53C8D4F1)
ret void
}

LLVM IR (-O2):
%struct.DynArr = type { i32 }
define void @pitonum(%struct.DynArr* %0) {
%2 = tail call i32 @pushDynArr(%struct.DynArr* %0, double 0x400921FB53C8D4F1)
ret void
}
/* Variables and functions */
size_t identity(size_t s) { return s; }


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

x86 assembly (clang, -O2):
<identity>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @identity(i64 returned %0) {
ret i64 %0
}
/* Variables and functions */
float cosf(float);
float sinf(float);
__attribute__((always_)) void c2SinCos(float radians, float *s, float *c) {
  *c = cosf(radians);
  *s = sinf(radians);
}


x86 assembly (clang, -O0):
<c2SinCos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <cosf@plt>
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x4(%rbp),%xmm0
call   1030 <sinf@plt>
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c2SinCos>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
movss  %xmm0,0x4(%rsp)
call   1040 <cosf@plt>
movss  %xmm0,(%rbx)
movss  0x4(%rsp),%xmm0
call   1030 <sinf@plt>
movss  %xmm0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @c2SinCos(float %0, float* %1, float* %2) {
%4 = alloca float
%5 = alloca float*
%6 = alloca float*
store float %0, float* %4
store float* %1, float** %5
store float* %2, float** %6
%7 = load float, float* %4
%8 = call float @cosf(float %7)
%9 = load float*, float** %6
store float %8, float* %9
%10 = load float, float* %4
%11 = call float @sinf(float %10)
%12 = load float*, float** %5
store float %11, float* %12
ret void
}

LLVM IR (-O2):
define void @c2SinCos(float %0, float* nocapture writeonly %1, float* nocapture writeonly %2) {
%4 = tail call float @cosf(float %0)
store float %4, float* %2
%5 = tail call float @sinf(float %0)
store float %5, float* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void cat() { printf("cat\n"); }


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

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

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

LLVM IR (-O2):
@str = [4 x i8] c"cat\00"
define void @cat() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int /*<<< orphan*/ F_SETOWN;
int O_ASYNC;
int fcntl(int /*<<< orphan*/, int /*<<< orphan*/, ...);
int getpid();
void enableKbdSignals() {
  int fd_flags;
  fcntl(0, F_SETOWN, getpid());
  fd_flags = fcntl(0, F_GETFL);
  fcntl(0, F_SETFL, (fd_flags | O_ASYNC));
}


x86 assembly (clang, -O0):
<enableKbdSignals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
xor    %edi,%edi
mov    $0x0,%al
call   1030 <fcntl@plt>
mov    0x2e80(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
mov    $0x0,%al
call   1030 <fcntl@plt>
mov    %eax,-0x4(%rbp)
mov    0x2e73(%rip),%rax
mov    (%rax),%esi
mov    -0x4(%rbp),%edx
mov    0x2e57(%rip),%rax
or     (%rax),%edx
xor    %edi,%edi
mov    $0x0,%al
call   1030 <fcntl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enableKbdSignals>:
push   %rbx
mov    0x2ec8(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
xor    %edi,%edi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <fcntl@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
xor    %eax,%eax
call   1030 <fcntl@plt>
mov    0x2e81(%rip),%rcx
mov    (%rcx),%esi
mov    0x2e68(%rip),%rcx
or     (%rcx),%eax
xor    %edi,%edi
mov    %eax,%edx
xor    %eax,%eax
pop    %rbx
jmp    1030 <fcntl@plt>

LLVM IR (-O0):
@F_SETOWN = global i32 0
@F_GETFL = global i32 0
@F_SETFL = global i32 0
@O_ASYNC = global i32 0
define void @enableKbdSignals() {
%1 = alloca i32
%2 = load i32, i32* @F_SETOWN
%3 = call i32 (...) @getpid()
%4 = call i32 (i32, i32, ...) @fcntl(i32 0, i32 %2, i32 %3)
%5 = load i32, i32* @F_GETFL
%6 = call i32 (i32, i32, ...) @fcntl(i32 0, i32 %5)
store i32 %6, i32* %1
%7 = load i32, i32* @F_SETFL
%8 = load i32, i32* %1
%9 = load i32, i32* @O_ASYNC
%10 = or i32 %8, %9
%11 = call i32 (i32, i32, ...) @fcntl(i32 0, i32 %7, i32 %10)
ret void
}

LLVM IR (-O2):
@F_SETOWN = global i32 0
@F_GETFL = global i32 0
@F_SETFL = global i32 0
@O_ASYNC = global i32 0
define void @enableKbdSignals() {
%1 = load i32, i32* @F_SETOWN
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 (i32, i32, ...) @fcntl(i32 0, i32 %1, i32 %2)
%4 = load i32, i32* @F_GETFL
%5 = tail call i32 (i32, i32, ...) @fcntl(i32 0, i32 %4)
%6 = load i32, i32* @F_SETFL
%7 = load i32, i32* @O_ASYNC
%8 = or i32 %7, %5
%9 = tail call i32 (i32, i32, ...) @fcntl(i32 0, i32 %6, i32 %8)
ret void
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  long quot;
  long rem;
};
typedef TYPE_1__ ldiv_t;

/* Variables and functions */
ldiv_t ldiv(long num, long den) {
  ldiv_t rv;
  rv.quot = num / den;
  rv.rem = num % den;
  return rv;
}


x86 assembly (clang, -O0):
<ldiv>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
cqto
idiv   %rcx
mov    %rdx,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldiv>:
mov    %rdi,%rax
mov    %rdi,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
je     1115 <ldiv+0x15>
cqto
idiv   %rsi
ret
xor    %edx,%edx
div    %esi
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64, i64 }
define { i64, i64 } @ldiv(i64 %0, i64 %1) {
%3 = alloca %struct.TYPE_3__
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%6 = load i64, i64* %4
%7 = load i64, i64* %5
%8 = sdiv i64 %6, %7
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 0
store i64 %8, i64* %9
%10 = load i64, i64* %4
%11 = load i64, i64* %5
%12 = srem i64 %10, %11
%13 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 1
store i64 %12, i64* %13
%14 = bitcast %struct.TYPE_3__* %3 to { i64, i64 }*
%15 = load { i64, i64 }, { i64, i64 }* %14
ret { i64, i64 } %15
}

LLVM IR (-O2):
define { i64, i64 } @ldiv(i64 %0, i64 %1) {
%3 = sdiv i64 %0, %1
%4 = srem i64 %0, %1
%5 = insertvalue { i64, i64 } poison, i64 %3, 0
%6 = insertvalue { i64, i64 } %5, i64 %4, 1
ret { i64, i64 } %6
}
int linearSearch(int space[], int key, int start, int end) {
  int pos = start;
  for (; pos <= end; pos++) {
    if (space[pos] == key)
      return pos;
  }
  return -1;
}


x86 assembly (clang, -O0):
<linearSearch>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     1155 <linearSearch+0x55>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x14(%rbp),%eax
jne    1142 <linearSearch+0x42>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115c <linearSearch+0x5c>
jmp    1147 <linearSearch+0x47>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1117 <linearSearch+0x17>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<linearSearch>:
mov    $0xffffffff,%eax
cmp    %ecx,%edx
jg     112f <linearSearch+0x2f>
movslq %edx,%r8
add    $0x1,%ecx
lea    (%rdi,%r8,4),%rdi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    %esi,(%rdi)
je     1130 <linearSearch+0x30>
add    $0x1,%edx
add    $0x4,%rdi
cmp    %edx,%ecx
jne    1120 <linearSearch+0x20>
ret
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @linearSearch(i32* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %2, %3
br i1 %5, label %20, label %6
6: ; preds = %4
%7 = sext i32 %2 to i64
%8 = add i32 %3, 1
br label %9
9: ; preds = %6, %14
%10 = phi i64 [ %7, %6 ], [ %15, %14 ]
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, %1
br i1 %13, label %18, label %14
14: ; preds = %9
%15 = add nsw i64 %10, 1
%16 = trunc i64 %15 to i32
%17 = icmp eq i32 %8, %16
br i1 %17, label %20, label %9
18: ; preds = %9
%19 = trunc i64 %10 to i32
br label %20
20: ; preds = %14, %18, %4
%21 = phi i32 [ -1, %4 ], [ %19, %18 ], [ -1, %14 ]
ret i32 %21
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ read(int, char *, int);
int /*<<< orphan*/ sleep(int);
int main(int argc, char **argv) {
  int fd = open(argv[1], O_RDONLY);
  while (1) {
    char c;
    read(fd, &c, 1);
    sleep(1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e93(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x15(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    115f <main+0x2f>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x8(%rsi),%rdi
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
mov    %eax,%ebx
lea    0x7(%rsp),%r14
nopl   (%rax)
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <read@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    1150 <main+0x20>

LLVM IR (-O0):
@O_RDONLY = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = load i32, i32* @O_RDONLY
%12 = call i32 @open(i8* %10, i32 %11)
store i32 %12, i32* %6
br label %13
13: ; preds = %2, %13
%14 = load i32, i32* %6
%15 = call i32 @read(i32 %14, i8* %7, i32 1)
%16 = call i32 @sleep(i32 1)
br label %13
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = load i32, i32* @O_RDONLY
%7 = tail call i32 @open(i8* %5, i32 %6)
br label %8
8: ; preds = %8, %2
%9 = call i32 @read(i32 %7, i8* %3, i32 1)
%10 = tail call i32 @sleep(i32 1)
br label %8
}
void MySub() {}


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

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

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

LLVM IR (-O2):
define void @MySub() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
ansi_goto(int x, int y) { printf("\033[%d;%dH", y + 1, x + 1); }


x86 assembly (clang, -O0):
<ansi_goto>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x8(%rbp),%edx
add    $0x1,%edx
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ansi_goto>:
add    $0x1,%esi
lea    0x1(%rdi),%edx
lea    0xee3(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"\1B[%d;%dH\00"
define i32 @ansi_goto(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = add nsw i32 %6, 1
%8 = load i32, i32* %4
%9 = add nsw i32 %8, 1
%10 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %9)
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
@.str = [9 x i8] c"\1B[%d;%dH\00"
define i32 @ansi_goto(i32 %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = add nsw i32 %0, 1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void print_binary(int n) {
  if (n) {
    print_binary(n >> 1);
    putchar(n & 1 ? '1' : '0');
  }
}


x86 assembly (clang, -O0):
<print_binary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     115e <print_binary+0x3e>
mov    -0x4(%rbp),%edi
sar    $0x1,%edi
call   1040 <print_binary@plt>
mov    -0x4(%rbp),%edx
and    $0x1,%edx
mov    $0x30,%eax
mov    $0x31,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_binary>:
test   %edi,%edi
je     113d <print_binary+0x1d>
push   %rbx
mov    %edi,%ebx
sar    %edi
call   1040 <print_binary@plt>
and    $0x1,%bl
or     $0x30,%bl
movzbl %bl,%edi
pop    %rbx
jmp    1030 <putchar@plt>
ret

LLVM IR (-O0):
define void @print_binary(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %15
5: ; preds = %1
%6 = load i32, i32* %2
%7 = ashr i32 %6, 1
%8 = load i32, i32* %2
%9 = and i32 %8, 1
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i64
%12 = select i1 %10, i32 49, i32 48
%13 = trunc i32 %12 to i8
%14 = call i32 @putchar(i8 signext %13)
br label %15
15: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @print_binary(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %4
3: ; preds = %1, %4
ret void
4: ; preds = %1
%5 = ashr i32 %0, 1
tail call void @print_binary(i32 %5)
%6 = trunc i32 %0 to i8
%7 = and i8 %6, 1
%8 = or i8 %7, 48
%9 = tail call i32 @putchar(i8 signext %8)
br label %3
}
int test_imm_02uint32_mem(unsigned int *val) {
  return ((*val) & (0x02 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_02uint32_mem>:
testb  $0x2,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_02uint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 2
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
float ceilf(float);
float futrts_ceil32(float x) { return ceilf(x); }


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

x86 assembly (clang, -O2):
<futrts_ceil32>:
jmp    1030 <ceilf@plt>

LLVM IR (-O0):
define float @futrts_ceil32(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @llvm.ceil.f32(float %3)
ret float %4
}

LLVM IR (-O2):
define float @futrts_ceil32(float %0) {
%2 = tail call float @llvm.ceil.f32(float %0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d\n", ((2 + 2) * (2 + 2)));
  printf("the max number is %d\n", 100000);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [22 x i8] c"the max number is %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 16)
%3 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 100000)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [22 x i8] c"the max number is %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 16)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 100000)
ret i32 0
}
void av_frame_get_buffer() {}


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

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

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

LLVM IR (-O2):
define void @av_frame_get_buffer() {
ret void
}
int test_imm_90uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x90 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_90uint64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $0x10,%rdx
and    $0x90,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_90uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 9437184
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
char HCarry(char, char);
char HSum(char, char);
void HAdder(char *Pa, char *Pb, char *Psum, char *Pcary) {
  *Psum = HSum(*Pa, *Pb);
  *Pcary = HCarry(*Pa, *Pb);
}


x86 assembly (clang, -O0):
<HAdder>:
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),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
movsbl %cl,%edi
movsbl (%rax),%esi
call   1040 <HSum@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
movsbl %cl,%edi
movsbl (%rax),%esi
call   1030 <HCarry@plt>
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HAdder>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
movsbl (%rdi),%edi
movsbl (%rsi),%esi
call   1040 <HSum@plt>
mov    %al,(%r15)
movsbl (%rbx),%edi
movsbl (%r12),%esi
call   1030 <HCarry@plt>
mov    %al,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @HAdder(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = load i8, i8* %9
%11 = load i8*, i8** %6
%12 = load i8, i8* %11
%13 = call signext i8 @HSum(i8 signext %10, i8 signext %12)
%14 = load i8*, i8** %7
store i8 %13, i8* %14
%15 = load i8*, i8** %5
%16 = load i8, i8* %15
%17 = load i8*, i8** %6
%18 = load i8, i8* %17
%19 = call signext i8 @HCarry(i8 signext %16, i8 signext %18)
%20 = load i8*, i8** %8
store i8 %19, i8* %20
ret void
}

LLVM IR (-O2):
define void @HAdder(i8* nocapture %0, i8* nocapture %1, i8* nocapture writeonly %2, i8* nocapture writeonly %3) {
%5 = load i8, i8* %0
%6 = load i8, i8* %1
%7 = tail call signext i8 @HSum(i8 signext %5, i8 signext %6)
store i8 %7, i8* %2
%8 = load i8, i8* %0
%9 = load i8, i8* %1
%10 = tail call signext i8 @HCarry(i8 signext %8, i8 signext %9)
store i8 %10, i8* %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ syscall_cp(int, int, void *, size_t);
ssize_t read(int fd, void *buf, size_t count) {
  return syscall_cp(3, fd, buf, count);
}


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

x86 assembly (clang, -O2):
<read>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %edi,%esi
mov    $0x3,%edi
jmp    1030 <syscall_cp@plt>

LLVM IR (-O0):
define i32 @read(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i32 @syscall_cp(i32 3, i32 %7, i8* %8, i64 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @read(i32 %0, i8* %1, i64 %2) {
%4 = tail call i32 @syscall_cp(i32 3, i32 %0, i8* %1, i64 %2)
ret i32 %4
}
int bitcount(unsigned x) {
  unsigned c;
  for (c = 0; x; c++)
    x &= x - 1;
  return c;
}


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 = %12, %1
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %15
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
br label %12
12: ; preds = %7
%13 = load i32, i32* %3
%14 = add i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @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 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
}
int main(int argc, char **argv) {
  int x;
  float r = argc;
  if (0 <= r) {
    x = 7;
  } else {
    x = 42;
  }
  return x;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1139 <main+0x39>
movl   $0x7,-0x14(%rbp)
jmp    1140 <main+0x40>
movl   $0x2a,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
test   %edi,%edi
mov    $0x7,%ecx
mov    $0x2a,%eax
cmovns %ecx,%eax
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = sitofp i32 %8 to float
store float %9, float* %7
%10 = load float, float* %7
%11 = fcmp ole float 0.000000e+00, %10
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 7, i32* %6
br label %14
13: ; preds = %2
store i32 42, i32* %6
br label %14
14: ; preds = %13, %12
%15 = load i32, i32* %6
ret i32 %15
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = icmp sgt i32 %0, -1
%4 = select i1 %3, i32 7, i32 42
ret i32 %4
}
void matrix(int b[10][10], int x, int y) { b[x][y] = 1; }


x86 assembly (clang, -O0):
<matrix>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<matrix>:
movslq %esi,%rax
movslq %edx,%rcx
lea    (%rax,%rax,4),%rax
lea    (%rdi,%rax,8),%rax
movl   $0x1,(%rax,%rcx,4)
ret

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

LLVM IR (-O2):
define void @matrix([10 x i32]* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %4, i64 %5
store i32 1, i32* %6
ret void
}
char to_minus(char a) { return (a + ('a' - 'A')); }


x86 assembly (clang, -O0):
<to_minus>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x20,%eax
movsbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i8 @to_minus(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = add nsw i32 %4, 32
%6 = trunc i32 %5 to i8
ret i8 %6
}

LLVM IR (-O2):
define signext i8 @to_minus(i8 signext %0) {
%2 = add i8 %0, 32
ret i8 %2
}
int *swap(int *array, int ind1, int ind2) {
  int v1 = array[ind1];
  int v2 = array[ind2];
  array[ind2] = v1;
  array[ind1] = v2;
  return array;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
mov    %rdi,%rax
movslq %esi,%rcx
mov    (%rdi,%rcx,4),%esi
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%edi
mov    %esi,(%rax,%rdx,4)
mov    %edi,(%rax,%rcx,4)
ret

LLVM IR (-O0):
define i32* @swap(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32*, i32** %4
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %9, i64 %11
%13 = load i32, i32* %12
store i32 %13, i32* %7
%14 = load i32*, i32** %4
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
store i32 %18, i32* %8
%19 = load i32, i32* %7
%20 = load i32*, i32** %4
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
store i32 %19, i32* %23
%24 = load i32, i32* %8
%25 = load i32*, i32** %4
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
store i32 %24, i32* %28
%29 = load i32*, i32** %4
ret i32* %29
}

LLVM IR (-O2):
define i32* @swap(i32* returned %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %6, i32* %8
store i32 %9, i32* %5
ret i32* %0
}
/* Type definitions */
struct fs_file {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ fs_http_read_to(struct fs_file *, void *, size_t, int);
ssize_t fs_http_read(struct fs_file *f, void *buf, size_t count) {
  return fs_http_read_to(f, buf, count, -1);
}


x86 assembly (clang, -O0):
<fs_http_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0xffffffff,%ecx
call   1030 <fs_http_read_to@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fs_http_read>:
mov    $0xffffffff,%ecx
jmp    1030 <fs_http_read_to@plt>

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

LLVM IR (-O2):
%struct.fs_file = type { i32 }
define i32 @fs_http_read(%struct.fs_file* %0, i8* %1, i64 %2) {
%4 = tail call i32 @fs_http_read_to(%struct.fs_file* %0, i8* %1, i64 %2, i32 -1)
ret i32 %4
}
/* Type definitions */
struct page {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ set_pageblock_flags_mask(struct page *, unsigned long, int,
                                            unsigned long);
void set_pageblock_flags_group(struct page *page, unsigned long flags,
                               int start_bitidx, int end_bitidx) {
  unsigned long nr_flag_bits = end_bitidx - start_bitidx + 1;
  unsigned long mask = (1 << nr_flag_bits) - 1;
  set_pageblock_flags_mask(page, flags, end_bitidx, mask);
}


x86 assembly (clang, -O0):
<set_pageblock_flags_group>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
add    $0x1,%eax
cltq
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
cltq
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    -0x28(%rbp),%rcx
call   1030 <set_pageblock_flags_mask@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_pageblock_flags_group>:
mov    %ecx,%eax
sub    %edx,%ecx
add    $0x1,%cl
mov    $0xffffffff,%edx
shl    %cl,%edx
not    %edx
movslq %edx,%rcx
mov    %eax,%edx
jmp    1030 <set_pageblock_flags_mask@plt>

LLVM IR (-O0):
%struct.page = type { i32 }
define void @set_pageblock_flags_group(%struct.page* %0, i64 %1, i32 %2, i32 %3) {
%5 = alloca %struct.page*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i64
store %struct.page* %0, %struct.page** %5
store i64 %1, i64* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %8
%12 = load i32, i32* %7
%13 = sub nsw i32 %11, %12
%14 = add nsw i32 %13, 1
%15 = sext i32 %14 to i64
store i64 %15, i64* %9
%16 = load i64, i64* %9
%17 = trunc i64 %16 to i32
%18 = shl i32 1, %17
%19 = sub nsw i32 %18, 1
%20 = sext i32 %19 to i64
store i64 %20, i64* %10
%21 = load %struct.page*, %struct.page** %5
%22 = load i64, i64* %6
%23 = load i32, i32* %8
%24 = load i64, i64* %10
%25 = call i32 @set_pageblock_flags_mask(%struct.page* %21, i64 %22, i32 %23, i64 %24)
ret void
}

LLVM IR (-O2):
%struct.page = type { i32 }
define void @set_pageblock_flags_group(%struct.page* %0, i64 %1, i32 %2, i32 %3) {
%5 = sub i32 1, %2
%6 = add i32 %5, %3
%7 = shl nsw i32 -1, %6
%8 = xor i32 %7, -1
%9 = sext i32 %8 to i64
%10 = tail call i32 @set_pageblock_flags_mask(%struct.page* %0, i64 %1, i32 %3, i64 %9)
ret void
}
void gtk_text_mark_get_type() {}


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

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

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

LLVM IR (-O2):
define void @gtk_text_mark_get_type() {
ret void
}
void hack_alloc_init(void) {}


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

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

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

LLVM IR (-O2):
define void @hack_alloc_init() {
ret void
}
unsigned char FastUByteAddClamp255(unsigned char a, unsigned char b) {
  unsigned int c = a + b;
  if (c > 255)
    c = 255;
  return (unsigned char)c;
}


x86 assembly (clang, -O0):
<FastUByteAddClamp255>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
movzbl -0x2(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0xff,-0x8(%rbp)
jbe    1131 <FastUByteAddClamp255+0x31>
movl   $0xff,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FastUByteAddClamp255>:
lea    (%rdi,%rsi,1),%ecx
cmp    $0xff,%ecx
mov    $0xff,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define zeroext i8 @FastUByteAddClamp255(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
%6 = load i8, i8* %3
%7 = zext i8 %6 to i32
%8 = load i8, i8* %4
%9 = zext i8 %8 to i32
%10 = add nsw i32 %7, %9
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = icmp ugt i32 %11, 255
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 255, i32* %5
br label %14
14: ; preds = %13, %2
%15 = load i32, i32* %5
%16 = trunc i32 %15 to i8
ret i8 %16
}

LLVM IR (-O2):
define zeroext i8 @FastUByteAddClamp255(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = zext i8 %1 to i32
%5 = add nuw nsw i32 %4, %3
%6 = icmp ult i32 %5, 255
%7 = select i1 %6, i32 %5, i32 255
%8 = trunc i32 %7 to i8
ret i8 %8
}
int array_min_index_from_one(int *a, int length) {
  int index_min = 1;
  for (int i = 2; i < length; i++) {
    if (a[i] < a[index_min]) {
      index_min = i;
    } else {
      index_min = i;
    }
  }
  return index_min;
}


x86 assembly (clang, -O0):
<array_min_index_from_one>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1165 <array_min_index_from_one+0x65>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x8(%rbp),%rcx
movslq -0x10(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    114c <array_min_index_from_one+0x4c>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1152 <array_min_index_from_one+0x52>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1157 <array_min_index_from_one+0x57>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1119 <array_min_index_from_one+0x19>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_min_index_from_one>:
cmp    $0x3,%esi
mov    $0x2,%eax
cmovge %esi,%eax
add    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @array_min_index_from_one(i32* nocapture readnone %0, i32 %1) {
%3 = call i32 @llvm.smax.i32(i32 %1, i32 2)
%4 = add nsw i32 %3, -1
ret i32 %4
}
void fme_global_error_uinit(struct ifpga_feature *feature) { (void)(feature); }


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

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

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

LLVM IR (-O2):
%struct.ifpga_feature = type opaque
define void @fme_global_error_uinit(%struct.ifpga_feature* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "Usage: imagerezip [-SVfd] [-b blksize] [-D hashfunc] [-z "
                  "level] Oimage1.ndz Nimage.ndz\n"
                  "\n"
                  "Produce a new image that is a copy of the old image.\n"
                  "\n"
                  "-S         Generate a new signature.\n"
                  "-V         Verify consistency of image and signature.\n"
                  "-f         Force imagedelta to use a questionable sigfile.\n"
                  "-d         Enable debugging.\n"
                  "-D hfunc   Hash function to use (md5 or sha1).\n"
                  "-b blksize Size of hash blocks (512 <= size <= 32M).\n"
                  "-z level   Compression level (0 to 9).\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [461 x i8] c"Usage: imagerezip [-SVfd] [-b blksize] [-D hashfunc] [-z level] Oimage1.ndz Nimage.ndz\0A\0AProduce a new image that is a copy of the old image.\0A\0A-S Generate a new signature.\0A-V Verify consistency of image and signature.\0A-f Force imagedelta to use a questionable sigfile.\0A-d Enable debugging.\0A-D hfunc Hash function to use (md5 or sha1).\0A-b blksize Size of hash blocks (512 <= size <= 32M).\0A-z level Compression level (0 to 9).\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([461 x i8], [461 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [461 x i8] c"Usage: imagerezip [-SVfd] [-b blksize] [-D hashfunc] [-z level] Oimage1.ndz Nimage.ndz\0A\0AProduce a new image that is a copy of the old image.\0A\0A-S Generate a new signature.\0A-V Verify consistency of image and signature.\0A-f Force imagedelta to use a questionable sigfile.\0A-d Enable debugging.\0A-D hfunc Hash function to use (md5 or sha1).\0A-b blksize Size of hash blocks (512 <= size <= 32M).\0A-z level Compression level (0 to 9).\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([461 x i8], [461 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
char Get_command(void) {
  char c;
  printf("Please enter a command (i, p, q):  ");
  scanf(" %c", &c);
  return c;
}


x86 assembly (clang, -O0):
<Get_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Get_command>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xef0(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x7(%rsp),%al
pop    %rcx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Please enter a command (i, p, q): \00"
@.str.1 = [4 x i8] c" %c\00"
define signext i8 @Get_command() {
%1 = alloca i8
%2 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
ret i8 %4
}

LLVM IR (-O2):
@.str = [36 x i8] c"Please enter a command (i, p, q): \00"
@.str.1 = [4 x i8] c" %c\00"
define signext i8 @Get_command() {
%1 = alloca i8
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
ret i8 %4
}