xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t _rol(uint32_t v, int n) { return (v << n) | (v >> (32 - n)); }


x86 assembly (clang, -O0):
<_rol>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
sub    -0x8(%rbp),%ecx
sar    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_rol>:
mov    %esi,%ecx
mov    %edi,%eax
shl    %cl,%eax
neg    %cl
sar    %cl,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @_rol(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = shl i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sub nsw i32 32, %9
%11 = ashr i32 %8, %10
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @_rol(i32 %0, i32 %1) {
%3 = shl i32 %0, %1
%4 = sub nsw i32 32, %1
%5 = ashr i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ prng_rand_byte();
void prng_rand_bytes(uint8_t *buffer, size_t buffer_len) {
  for (size_t i = 0; i < buffer_len; ++i) {
    buffer[i] = prng_rand_byte();
  }
}


x86 assembly (clang, -O0):
<prng_rand_bytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    115b <prng_rand_bytes+0x4b>
mov    $0x0,%al
call   1030 <prng_rand_byte@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <prng_rand_bytes+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prng_rand_bytes>:
push   %r15
push   %r14
push   %rbx
test   %rsi,%rsi
je     1144 <prng_rand_bytes+0x34>
mov    %rsi,%r15
mov    %rdi,%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <prng_rand_byte@plt>
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <prng_rand_bytes+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @prng_rand_bytes(i32* nocapture writeonly %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %4, label %5
4: ; preds = %5, %2
ret void
5: ; preds = %2, %5
%6 = phi i64 [ %9, %5 ], [ 0, %2 ]
%7 = tail call i32 (...) @prng_rand_byte()
%8 = getelementptr inbounds i32, i32* %0, i64 %6
store i32 %7, i32* %8
%9 = add nuw i64 %6, 1
%10 = icmp eq i64 %9, %1
br i1 %10, label %4, label %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("net-dump -i ifname -w dumpfile -s tftpserver\n");
  exit(-1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"net-dump -i ifname -w dumpfile -s tftpserver\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@str = [45 x i8] c"net-dump -i ifname -w dumpfile -s tftpserver\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
int rpathz_value();
int main() { return !(rpathz_value() == 5171); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rpathz_value@plt>
cmp    $0x1433,%eax
sete   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <rpathz_value@plt>
xor    %ecx,%ecx
cmp    $0x1433,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @rpathz_value()
%3 = icmp eq i32 %2, 5171
%4 = xor i1 %3, true
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @rpathz_value()
%2 = icmp ne i32 %1, 5171
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
size_t strlcpy(char *, char const *, size_t);
size_t BUF_strlcpy(char *dst, const char *src, size_t size) {
  return strlcpy(dst, src, size);
}


x86 assembly (clang, -O0):
<BUF_strlcpy>:
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
call   1030 <strlcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BUF_strlcpy>:
jmp    1030 <strlcpy@plt>

LLVM IR (-O0):
define i64 @BUF_strlcpy(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 i64 @strlcpy(i8* %7, i8* %8, i64 %9)
ret i64 %10
}

LLVM IR (-O2):
define i64 @BUF_strlcpy(i8* %0, i8* %1, i64 %2) {
%4 = tail call i64 @strlcpy(i8* %0, i8* %1, i64 %2)
ret i64 %4
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ exitFatal(char *, int);
int readIntegerExpanded();
uint16_t readPort(uint16_t dflt) {
  int res = readIntegerExpanded();
  if (res < 0 || res >= (1 << 16))
    exitFatal("port number out of range",
              sizeof("port number out of range") - 1);
  else if (res == 0)
    res = dflt;
  return res;
}


x86 assembly (clang, -O0):
<readPort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <readIntegerExpanded@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     114c <readPort+0x2c>
cmpl   $0x10000,-0x8(%rbp)
jl     1162 <readPort+0x42>
lea    0xead(%rip),%rdi
mov    $0x18,%esi
call   1030 <exitFatal@plt>
jmp    1177 <readPort+0x57>
cmpl   $0x0,-0x8(%rbp)
jne    1172 <readPort+0x52>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1177 <readPort+0x57>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readPort>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <readIntegerExpanded@plt>
mov    %eax,%ebx
cmp    $0x10000,%eax
jb     1148 <readPort+0x28>
lea    0xec4(%rip),%rdi
mov    $0x18,%esi
call   1030 <exitFatal@plt>
jmp    114d <readPort+0x2d>
test   %ebx,%ebx
cmove  %ebp,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"port number out of range\00"
define i32 @readPort(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @readIntegerExpanded()
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp sge i32 %8, 65536
br i1 %9, label %10, label %12
10: ; preds = %7, %1
%11 = call i32 @exitFatal(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 24)
br label %18
12: ; preds = %7
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = load i32, i32* %2
store i32 %16, i32* %3
br label %17
17: ; preds = %15, %12
br label %18
18: ; preds = %17, %10
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@.str = [25 x i8] c"port number out of range\00"
define i32 @readPort(i32 %0) {
%2 = tail call i32 (...) @readIntegerExpanded()
%3 = icmp ugt i32 %2, 65535
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @exitFatal(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 24)
br label %9
6: ; preds = %1
%7 = icmp eq i32 %2, 0
%8 = select i1 %7, i32 %0, i32 %2
br label %9
9: ; preds = %6, %4
%10 = phi i32 [ %2, %4 ], [ %8, %6 ]
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, double, double);
void drawVertexAt(int nr, double x, double y, FILE *f) {
  fprintf(f, "    \\node (v%d) at (%f,%f) {};\n", nr, x, y);
}


x86 assembly (clang, -O0):
<drawVertexAt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%edx
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xebf(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawVertexAt>:
mov    %rsi,%rax
mov    %edi,%edx
lea    0xee4(%rip),%rsi
mov    %rax,%rdi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [32 x i8] c" \\node (v%d) at (%f,%f) {};\0A\00"
define void @drawVertexAt(i32 %0, double %1, double %2, i32* %3) {
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca i32*
store i32 %0, i32* %5
store double %1, double* %6
store double %2, double* %7
store i32* %3, i32** %8
%9 = load i32*, i32** %8
%10 = load i32, i32* %5
%11 = load double, double* %6
%12 = load double, double* %7
%13 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %10, double %11, double %12)
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c" \\node (v%d) at (%f,%f) {};\0A\00"
define void @drawVertexAt(i32 %0, double %1, double %2, i32* nocapture %3) {
%5 = tail call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %0, double %1, double %2)
ret void
}
long long rdtsc() {
  long long l;
  asm volatile("rdtsc\n\t" : "=A"(l));
  return l;
}


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

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

LLVM IR (-O0):
define i64 @rdtsc() {
%1 = alloca i64
%2 = call i64 asm sideeffect "rdtsc\0A\09", "=A,~{dirflag},~{fpsr},~{flags}"()
store i64 %2, i64* %1
%3 = load i64, i64* %1
ret i64 %3
}

LLVM IR (-O2):
define i64 @rdtsc() {
%1 = tail call i64 asm sideeffect "rdtsc\0A\09", "=A,~{dirflag},~{fpsr},~{flags}"()
ret i64 %1
}
/* Variables and functions */
unsigned char *
background_generating_process_identifier_location(unsigned char **);
int background_generating_process_identifier(unsigned char **sec) {
  unsigned char *p;
  p = background_generating_process_identifier_location(sec);
  if (p)
    return (int)*p;
  return -1;
}


x86 assembly (clang, -O0):
<background_generating_process_identifier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <background_generating_process_identifier_location@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1143 <background_generating_process_identifier+0x33>
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    114a <background_generating_process_identifier+0x3a>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<background_generating_process_identifier>:
push   %rax
call   1030 <background_generating_process_identifier_location@plt>
test   %rax,%rax
je     1120 <background_generating_process_identifier+0x10>
movzbl (%rax),%eax
pop    %rcx
ret
mov    $0xffffffff,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @background_generating_process_identifier(i8** %0) {
%2 = tail call i8* @background_generating_process_identifier_location(i8** %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = load i8, i8* %2
%6 = zext i8 %5 to i32
br label %7
7: ; preds = %1, %4
%8 = phi i32 [ %6, %4 ], [ -1, %1 ]
ret i32 %8
}
float __ocl_min_float_float(float src1, float src2) {
  return (src1 < src2) ? src1 : src2;
}


x86 assembly (clang, -O0):
<__ocl_min_float_float>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1130 <__ocl_min_float_float+0x30>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    113a <__ocl_min_float_float+0x3a>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ocl_min_float_float>:
minss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @__ocl_min_float_float(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp olt float %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load float, float* %3
br label %12
10: ; preds = %2
%11 = load float, float* %4
br label %12
12: ; preds = %10, %8
%13 = phi float [ %9, %8 ], [ %11, %10 ]
ret float %13
}

LLVM IR (-O2):
define float @__ocl_min_float_float(float %0, float %1) {
%3 = fcmp olt float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int VirtualFree(void *address) {
  free(address);
  return 1;
}


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

x86 assembly (clang, -O2):
<VirtualFree>:
push   %rax
call   1030 <free@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @VirtualFree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret i32 1
}
char *getHelloWorld() {
  char *helloWorld = "Hello World!\r\n";
  return helloWorld;
}


x86 assembly (clang, -O0):
<getHelloWorld>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getHelloWorld>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Hello World!\0D\0A\00"
define i8* @getHelloWorld() {
%1 = alloca i8*
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
ret i8* %2
}

LLVM IR (-O2):
@.str = [15 x i8] c"Hello World!\0D\0A\00"
define i8* @getHelloWorld() {
ret i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0)
}
void sum3() { return; }


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

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

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

LLVM IR (-O2):
define void @sum3() {
ret void
}
long double longdouble_ignoring_shortint(long double x, short int y) {
  return x;
}


x86 assembly (clang, -O0):
<longdouble_ignoring_shortint>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
mov    %ax,-0x12(%rbp)
fldt   -0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<longdouble_ignoring_shortint>:
fldt   0x8(%rsp)
ret

LLVM IR (-O0):
define x86_fp80 @longdouble_ignoring_shortint(x86_fp80 %0, i16 signext %1) {
%3 = alloca x86_fp80
%4 = alloca i16
store x86_fp80 %0, x86_fp80* %3
store i16 %1, i16* %4
%5 = load x86_fp80, x86_fp80* %3
ret x86_fp80 %5
}

LLVM IR (-O2):
define x86_fp80 @longdouble_ignoring_shortint(x86_fp80 returned %0, i16 signext %1) {
ret x86_fp80 %0
}
void U_WMRREALIZEPALETTE_print(const char *contents) { (void)contents; }


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

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

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

LLVM IR (-O2):
define void @U_WMRREALIZEPALETTE_print(i8* nocapture %0) {
ret void
}
int source(void) {
  register int hardreg __asm__("0");
  asm("" : "=r"(hardreg));
  return hardreg;
}


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

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

LLVM IR (-O0):
define i32 @source() {
%1 = alloca i32
%2 = call i32 asm "", "={ax},~{dirflag},~{fpsr},~{flags}"()
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @source() {
%1 = tail call i32 asm "", "={ax},~{dirflag},~{fpsr},~{flags}"()
ret i32 %1
}
create_file_if_needed(in_name, out_name, out_image) char in_name[], out_name[];
short **out_image;
{}


x86 assembly (clang, -O0):
<create_file_if_needed>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @create_file_if_needed(i8* nocapture readnone %0, i8* nocapture readnone %1, i16** nocapture readnone %2) {
ret i32 undef
}
int test_imm_F1int8_mem(signed char *val) {
  return ((*val) & (-0xF1 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_F1int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, -241
%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_F1int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = and i32 %3, -241
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -40, i32 -20
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ nprint(char *, char *, unsigned int, int);
char *ufmt(unsigned int, unsigned int, char *);
void uprint(unsigned int v, unsigned int base, unsigned int width, int pad) {
  char buffer[32], *e = buffer + 32, *p;
  p = ufmt(v, base, e);
  nprint(p, e, width, pad);
}


x86 assembly (clang, -O0):
<uprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
lea    -0x30(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x38(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x38(%rbp),%rdx
call   1030 <ufmt@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1040 <nprint@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uprint>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %ecx,%ebx
mov    %edx,%ebp
lea    0x20(%rsp),%r14
mov    %r14,%rdx
call   1030 <ufmt@plt>
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1040 <nprint@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @uprint(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [32 x i8]
%10 = alloca i8*
%11 = alloca i8*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%12 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%13 = getelementptr inbounds i8, i8* %12, i64 32
store i8* %13, i8** %10
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = load i8*, i8** %10
%17 = call i8* @ufmt(i32 %14, i32 %15, i8* %16)
store i8* %17, i8** %11
%18 = load i8*, i8** %11
%19 = load i8*, i8** %10
%20 = load i32, i32* %7
%21 = load i32, i32* %8
%22 = call i32 @nprint(i8* %18, i8* %19, i32 %20, i32 %21)
ret void
}

LLVM IR (-O2):
define void @uprint(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca [32 x i8]
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 32
%8 = call i8* @ufmt(i32 %0, i32 %1, i8* %7)
%9 = call i32 @nprint(i8* %8, i8* %7, i32 %2, i32 %3)
ret void
}
void ptr_band2_Bad(int x, int *q) {
  int a[5];
  int *p;
  if (x) {
    p = q;
  } else {
    p = 0;
  }
  if ((int)p & x) {
  }
  a[10] = 0;
}


x86 assembly (clang, -O0):
<ptr_band2_Bad>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1122 <ptr_band2_Bad+0x22>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    112a <ptr_band2_Bad+0x2a>
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
and    -0x4(%rbp),%eax
cmp    $0x0,%eax
je     113f <ptr_band2_Bad+0x3f>
jmp    113f <ptr_band2_Bad+0x3f>
movl   $0x0,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @ptr_band2_Bad(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca [5 x i32]
%6 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32*, i32** %4
store i32* %10, i32** %6
br label %12
11: ; preds = %2
store i32* null, i32** %6
br label %12
12: ; preds = %11, %9
%13 = load i32*, i32** %6
%14 = ptrtoint i32* %13 to i32
%15 = load i32, i32* %3
%16 = and i32 %14, %15
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %12
br label %19
19: ; preds = %18, %12
%20 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 10
store i32 0, i32* %20
ret void
}

LLVM IR (-O2):
define void @ptr_band2_Bad(i32 %0, i32* nocapture %1) {
ret void
}
int toupper(int c) {
  if (c >= 'a' && c <= 'z')
    return (c - 32);
  else
    return c;
}


x86 assembly (clang, -O0):
<toupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x61,-0x8(%rbp)
jl     1129 <toupper+0x29>
cmpl   $0x7a,-0x8(%rbp)
jg     1129 <toupper+0x29>
mov    -0x8(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <toupper+0x2f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<toupper>:
lea    -0x61(%rdi),%ecx
lea    -0x20(%rdi),%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @toupper(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, -32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
/* Variables and functions */
int _ptrace(char *);
int main(int argc, char *argv[]) {
  int ret = 0;
  (void)argc;
  ret |= _ptrace(argv[0]);
  return (ret == 0) ? 0 : 2;
}


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)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <_ptrace@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edx
mov    $0x2,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
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
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 0
%10 = load i8*, i8** %9
%11 = call i32 @_ptrace(i8* %10)
%12 = load i32, i32* %6
%13 = or i32 %12, %11
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = icmp eq i32 %14, 0
%16 = zext i1 %15 to i64
%17 = select i1 %15, i32 0, i32 2
ret i32 %17
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i32 @_ptrace(i8* %3)
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 0, i32 2
ret i32 %6
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t mem_addr_translate(uint32_t addr, uint32_t chunk_start, uint32_t len) {
  uint32_t mask = len - 1;
  return chunk_start + (addr & mask);
}


x86 assembly (clang, -O0):
<mem_addr_translate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
and    -0x10(%rbp),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_addr_translate>:
lea    -0x1(%rdx),%eax
and    %edi,%eax
add    %esi,%eax
ret

LLVM IR (-O0):
define i32 @mem_addr_translate(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = sub nsw i32 %8, 1
store i32 %9, i32* %7
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = load i32, i32* %7
%13 = and i32 %11, %12
%14 = add nsw i32 %10, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @mem_addr_translate(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %2, -1
%5 = and i32 %4, %0
%6 = add nsw i32 %5, %1
ret i32 %6
}
void UARTDisable(unsigned int baseAdd) {
  (*((volatile unsigned int *)(baseAdd + (0x30)))) &=
      ~((0x00000001u) | (0x00002000u) | (0x00004000u));
}


x86 assembly (clang, -O0):
<UARTDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xffff9ffe,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTDisable>:
add    $0x30,%edi
andl   $0xffff9ffe,(%rdi)
ret

LLVM IR (-O0):
define void @UARTDisable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add i32 %3, 48
%5 = zext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = and i32 %7, -24578
store volatile i32 %8, i32* %6
ret void
}

LLVM IR (-O2):
define void @UARTDisable(i32 %0) {
%2 = add i32 %0, 48
%3 = zext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
%6 = and i32 %5, -24578
store volatile i32 %6, i32* %4
ret void
}
void lws_plat_pipe_close(struct lws *wsi) {}


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

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

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

LLVM IR (-O2):
%struct.lws = type opaque
define void @lws_plat_pipe_close(%struct.lws* nocapture %0) {
ret void
}
int fibleft(int i) {
  int l;
  long d = 0;
  for (l = 0; l < 10000; l++) {
    d += i - l;
  }
}


x86 assembly (clang, -O0):
<fibleft>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x2710,-0xc(%rbp)
jge    1141 <fibleft+0x41>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
cltq
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <fibleft+0x16>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fibleft(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
store i32 %0, i32* %3
store i64 0, i64* %5
store i32 0, i32* %4
br label %6
6: ; preds = %16, %1
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 10000
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = sub nsw i32 %10, %11
%13 = sext i32 %12 to i64
%14 = load i64, i64* %5
%15 = add nsw i64 %14, %13
store i64 %15, i64* %5
br label %16
16: ; preds = %9
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %6
19: ; preds = %6
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @fibleft(i32 %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ db(int);
void aas() { db(0x3F); }


x86 assembly (clang, -O0):
<aas>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3f,%edi
call   1030 <db@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<aas>:
mov    $0x3f,%edi
jmp    1030 <db@plt>

LLVM IR (-O0):
define void @aas() {
%1 = call i32 @db(i32 63)
ret void
}

LLVM IR (-O2):
define void @aas() {
%1 = tail call i32 @db(i32 63)
ret void
}
void GPMCDevTypeSelect(unsigned int baseAddr, unsigned int csNum,
                       unsigned int devType) {
  (*((volatile unsigned int *)(baseAddr + (0x60 + (csNum * (0x30)))))) &=
      ~(0x00000C00u);
  (*((volatile unsigned int *)(baseAddr + (0x60 + (csNum * (0x30)))))) |=
      ((devType << (0x0000000Au)) & (0x00000C00u));
}


x86 assembly (clang, -O0):
<GPMCDevTypeSelect>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
imul   $0x30,-0x8(%rbp),%ecx
add    $0x60,%ecx
add    %ecx,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xfffff3ff,%ecx
mov    %ecx,(%rax)
mov    -0xc(%rbp),%edx
shl    $0xa,%edx
and    $0xc00,%edx
mov    -0x4(%rbp),%eax
imul   $0x30,-0x8(%rbp),%ecx
add    $0x60,%ecx
add    %ecx,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPMCDevTypeSelect>:
lea    (%rsi,%rsi,2),%eax
shl    $0x4,%eax
add    %edi,%eax
add    $0x60,%eax
andl   $0xfffff3ff,(%rax)
and    $0x3,%edx
shl    $0xa,%edx
or     %edx,(%rax)
ret

LLVM IR (-O0):
define void @GPMCDevTypeSelect(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = mul i32 %8, 48
%10 = add i32 96, %9
%11 = add i32 %7, %10
%12 = zext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
%14 = load volatile i32, i32* %13
%15 = and i32 %14, -3073
store volatile i32 %15, i32* %13
%16 = load i32, i32* %6
%17 = shl i32 %16, 10
%18 = and i32 %17, 3072
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = mul i32 %20, 48
%22 = add i32 96, %21
%23 = add i32 %19, %22
%24 = zext i32 %23 to i64
%25 = inttoptr i64 %24 to i32*
%26 = load volatile i32, i32* %25
%27 = or i32 %26, %18
store volatile i32 %27, i32* %25
ret void
}

LLVM IR (-O2):
define void @GPMCDevTypeSelect(i32 %0, i32 %1, i32 %2) {
%4 = mul i32 %1, 48
%5 = add i32 %0, 96
%6 = add i32 %5, %4
%7 = zext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = and i32 %9, -3073
store volatile i32 %10, i32* %8
%11 = shl i32 %2, 10
%12 = and i32 %11, 3072
%13 = load volatile i32, i32* %8
%14 = or i32 %13, %12
store volatile i32 %14, i32* %8
ret void
}
/* Variables and functions */
char *skip_over_blank(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int parse_end(char **cp) {
  *cp = skip_over_blank(*cp);
  if (!strncmp(*cp, "</device>", 9)) {
    ;
    *cp += 9;
    return 0;
  }
  return -14;
}


x86 assembly (clang, -O0):
<parse_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <skip_over_blank@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    117d <parse_end+0x5d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x9,%rcx
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1184 <parse_end+0x64>
movl   $0xfffffff2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_end>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1040 <skip_over_blank@plt>
mov    %rax,(%rbx)
lea    0xeca(%rip),%rsi
mov    %rax,%rdi
mov    $0x9,%edx
call   1030 <strncmp@plt>
mov    %eax,%ecx
mov    $0xfffffff2,%eax
test   %ecx,%ecx
je     1150 <parse_end+0x30>
pop    %rbx
ret
addq   $0x9,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"</device>\00"
define i32 @parse_end(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
store i8** %0, i8*** %3
%4 = load i8**, i8*** %3
%5 = load i8*, i8** %4
%6 = call i8* @skip_over_blank(i8* %5)
%7 = load i8**, i8*** %3
store i8* %6, i8** %7
%8 = load i8**, i8*** %3
%9 = load i8*, i8** %8
%10 = call i32 @strncmp(i8* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %1
%13 = load i8**, i8*** %3
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8, i8* %14, i64 9
store i8* %15, i8** %13
store i32 0, i32* %2
br label %17
16: ; preds = %1
store i32 -14, i32* %2
br label %17
17: ; preds = %16, %12
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
@.str = [10 x i8] c"</device>\00"
define i32 @parse_end(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i8* @skip_over_blank(i8* %2)
store i8* %3, i8** %0
%4 = tail call i32 @strncmp(i8* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 9)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i8*, i8** %0
%8 = getelementptr inbounds i8, i8* %7, i64 9
store i8* %8, i8** %0
br label %9
9: ; preds = %1, %6
%10 = phi i32 [ 0, %6 ], [ -14, %1 ]
ret i32 %10
}
short SwapShort(short data) { return (data << 8) | ((data >> 8) & 0x00ff); }


x86 assembly (clang, -O0):
<SwapShort>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
shl    $0x8,%eax
movswl -0x2(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
or     %ecx,%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<SwapShort>:
mov    %edi,%ecx
movzbl %ch,%eax
shl    $0x8,%ecx
or     %ecx,%eax
ret

LLVM IR (-O0):
define signext i16 @SwapShort(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = shl i32 %4, 8
%6 = load i16, i16* %2
%7 = sext i16 %6 to i32
%8 = ashr i32 %7, 8
%9 = and i32 %8, 255
%10 = or i32 %5, %9
%11 = trunc i32 %10 to i16
ret i16 %11
}

LLVM IR (-O2):
define signext i16 @SwapShort(i16 signext %0) {
%2 = sext i16 %0 to i32
%3 = shl nsw i32 %2, 8
%4 = lshr i32 %2, 8
%5 = and i32 %4, 255
%6 = or i32 %5, %3
%7 = trunc i32 %6 to i16
ret i16 %7
}
/* Type definitions */
struct i2c_slave {
  int dummy;
};

/* Variables and functions */
struct i2c_slave *i2c_getSlave(int);
int i2c_sendSlaveCommand2(struct i2c_slave *, char *, int, char *, int);
int i2c_sendCommand2(int address, char *cmd, int cmdSize, char *response,
                     int respSize) {
  struct i2c_slave *slave = i2c_getSlave(address);
  return i2c_sendSlaveCommand2(slave, cmd, cmdSize, response, respSize);
}


x86 assembly (clang, -O0):
<i2c_sendCommand2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <i2c_getSlave@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
call   1040 <i2c_sendSlaveCommand2@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_sendCommand2>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8d,%r14d
mov    %rcx,%r15
mov    %edx,%ebp
mov    %rsi,%rbx
call   1030 <i2c_getSlave@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %r15,%rcx
mov    %r14d,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <i2c_sendSlaveCommand2@plt>

LLVM IR (-O0):
%struct.i2c_slave = type { i32 }
define i32 @i2c_sendCommand2(i32 %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca %struct.i2c_slave*
store i32 %0, i32* %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%12 = load i32, i32* %6
%13 = call %struct.i2c_slave* @i2c_getSlave(i32 %12)
store %struct.i2c_slave* %13, %struct.i2c_slave** %11
%14 = load %struct.i2c_slave*, %struct.i2c_slave** %11
%15 = load i8*, i8** %7
%16 = load i32, i32* %8
%17 = load i8*, i8** %9
%18 = load i32, i32* %10
%19 = call i32 @i2c_sendSlaveCommand2(%struct.i2c_slave* %14, i8* %15, i32 %16, i8* %17, i32 %18)
ret i32 %19
}

LLVM IR (-O2):
%struct.i2c_slave = type { i32 }
define i32 @i2c_sendCommand2(i32 %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = tail call %struct.i2c_slave* @i2c_getSlave(i32 %0)
%7 = tail call i32 @i2c_sendSlaveCommand2(%struct.i2c_slave* %6, i8* %1, i32 %2, i8* %3, i32 %4)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int i;
  i = 0;
loop:
  assert(i < 10);
  i++;
  if (i < 10)
    goto loop;
  assert(i == 10);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    114f <main+0x3f>
jmp    1126 <main+0x16>
cmpl   $0xa,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
%2 = tail call i32 @assert(i32 1)
%3 = tail call i32 @assert(i32 1)
%4 = tail call i32 @assert(i32 1)
%5 = tail call i32 @assert(i32 1)
%6 = tail call i32 @assert(i32 1)
%7 = tail call i32 @assert(i32 1)
%8 = tail call i32 @assert(i32 1)
%9 = tail call i32 @assert(i32 1)
%10 = tail call i32 @assert(i32 1)
%11 = tail call i32 @assert(i32 1)
ret i32 0
}
/* Variables and functions */
int *calloc(int, int);
int /*<<< orphan*/ printf(char *);
int *createArrayWithCapacity(int capacity) {
  int *newArray = calloc(capacity, sizeof(int));
  if (!newArray) {
    printf("can`t create array\n");
  }
  return newArray;
}


x86 assembly (clang, -O0):
<createArrayWithCapacity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1153 <createArrayWithCapacity+0x33>
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createArrayWithCapacity>:
push   %rbx
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113f <createArrayWithCapacity+0x1f>
lea    0xec6(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"can`t create array\0A\00"
define i32* @createArrayWithCapacity(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32* @calloc(i32 %4, i32 4)
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = icmp ne i32* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i32*, i32** %3
ret i32* %11
}

LLVM IR (-O2):
@str = [19 x i8] c"can`t create array\00"
define noalias i32* @createArrayWithCapacity(i32 %0) {
%2 = tail call i32* @calloc(i32 %0, i32 4)
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i32* %2
}
/* Variables and functions */
int /*<<< orphan*/ CALC_appendString(char *);
void CALC_add4() { CALC_appendString("4"); }


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

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

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

LLVM IR (-O2):
@.str = [2 x i8] c"4\00"
define void @CALC_add4() {
%1 = tail call i32 @CALC_appendString(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int M_PI;
int distance_to_origin(int, int);
double sin(int);
double evaluate_sin_of_distance(int x, int y, double wavelength) {
  return sin(distance_to_origin(x, y) * (2 * M_PI) / wavelength);
}


x86 assembly (clang, -O0):
<evaluate_sin_of_distance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <distance_to_origin@plt>
mov    0x2ea3(%rip),%rcx
mov    (%rcx),%ecx
shl    $0x1,%ecx
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
divsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evaluate_sin_of_distance>:
push   %rax
movsd  %xmm0,(%rsp)
call   1040 <distance_to_origin@plt>
mov    0x2eb6(%rip),%rcx
imul   (%rcx),%eax
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  (%rsp),%xmm0
cvttsd2si %xmm0,%edi
pop    %rax
jmp    1030 <sin@plt>

LLVM IR (-O0):
@M_PI = global i32 0
define double @evaluate_sin_of_distance(i32 %0, i32 %1, double %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
store double %2, double* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = call i32 @distance_to_origin(i32 %7, i32 %8)
%10 = load i32, i32* @M_PI
%11 = mul nsw i32 2, %10
%12 = mul nsw i32 %9, %11
%13 = sitofp i32 %12 to double
%14 = load double, double* %6
%15 = fdiv double %13, %14
%16 = fptosi double %15 to i32
%17 = call double @sin(i32 %16)
ret double %17
}

LLVM IR (-O2):
@M_PI = global i32 0
define double @evaluate_sin_of_distance(i32 %0, i32 %1, double %2) {
%4 = tail call i32 @distance_to_origin(i32 %0, i32 %1)
%5 = load i32, i32* @M_PI
%6 = shl i32 %4, 1
%7 = mul i32 %6, %5
%8 = sitofp i32 %7 to double
%9 = fdiv double %8, %2
%10 = fptosi double %9 to i32
%11 = tail call double @sin(i32 %10)
ret double %11
}
/* Variables and functions */
int /*<<< orphan*/ SYS_munmap;
int /*<<< orphan*/ abort();
scalar_t__ foo();
int /*<<< orphan*/ syscall(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int main() {
  if (foo() <= 0)
    abort();
  for (;;)
    syscall(SYS_munmap, 0, 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <foo@plt>
cmp    $0x0,%rax
jg     1157 <main+0x27>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    115c <main+0x2c>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
xor    %edx,%edx
mov    %edx,%esi
call   1040 <syscall@plt>
jmp    115c <main+0x2c>

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <foo@plt>
test   %rax,%rax
jle    115d <main+0x2d>
mov    0x2e9c(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rbx),%edi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <syscall@plt>
jmp    1150 <main+0x20>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@SYS_munmap = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 (...) @foo()
%3 = icmp sle i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
br label %7
7: ; preds = %7, %6
%8 = load i32, i32* @SYS_munmap
%9 = call i32 @syscall(i32 %8, i32 0, i32 0)
br label %7
}

LLVM IR (-O2):
@SYS_munmap = global i32 0
define i32 @main() {
%1 = tail call i64 (...) @foo()
%2 = icmp slt i64 %1, 1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0, %5
%6 = load i32, i32* @SYS_munmap
%7 = tail call i32 @syscall(i32 %6, i32 0, i32 0)
br label %5
}
/* Variables and functions */
char *__strchrnul(char const *, int);
char *strchr(const char *s, int c) {
  char *r = __strchrnul(s, c);
  return *(unsigned char *)r == (unsigned char)c ? r : 0;
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <__strchrnul@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
mov    -0xc(%rbp),%ecx
movzbl %cl,%ecx
cmp    %ecx,%eax
jne    1151 <strchr+0x41>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    115c <strchr+0x4c>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    115c <strchr+0x4c>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
push   %rbx
mov    %esi,%ebx
call   1030 <__strchrnul@plt>
xor    %ecx,%ecx
cmp    %bl,(%rax)
cmovne %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @strchr(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i8* @__strchrnul(i8* %6, i32 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = load i32, i32* %4
%13 = trunc i32 %12 to i8
%14 = zext i8 %13 to i32
%15 = icmp eq i32 %11, %14
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = load i8*, i8** %5
br label %19
18: ; preds = %2
br label %19
19: ; preds = %18, %16
%20 = phi i8* [ %17, %16 ], [ null, %18 ]
ret i8* %20
}

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
%3 = tail call i8* @__strchrnul(i8* %0, i32 %1)
%4 = load i8, i8* %3
%5 = trunc i32 %1 to i8
%6 = icmp eq i8 %4, %5
%7 = select i1 %6, i8* %3, i8* null
ret i8* %7
}