xunge/DecIR huggingface dataset:
/* Type definitions */
struct sockaddr_un {
  int /*<<< orphan*/ sun_path;
  int /*<<< orphan*/ sun_family;
};
struct sockaddr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ AF_UNIX;
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ strcpy(int /*<<< orphan*/, char *);
int do_bind(int s, char *name) {
  struct sockaddr_un sun;
  int length;
  sun.sun_family = AF_UNIX;
  (void)strcpy(sun.sun_path, name);
  length = sizeof(sun.sun_family) + sizeof(sun.sun_path);
  return bind(s, (struct sockaddr *)(&sun), length);
}


x86 assembly (clang, -O0):
<do_bind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
movl   $0x8,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <bind@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_bind>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
mov    0x2eba(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
call   1030 <strcpy@plt>
lea    0x8(%rsp),%rsi
mov    %ebx,%edi
mov    $0x8,%edx
call   1040 <bind@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.sockaddr_un = type { i32, i32 }
%struct.sockaddr = type { i32 }
@AF_UNIX = global i32 0
define i32 @do_bind(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.sockaddr_un
%6 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%7 = load i32, i32* @AF_UNIX
%8 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %5, i32 0, i32 1
store i32 %7, i32* %8
%9 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %5, i32 0, i32 0
%10 = load i32, i32* %9
%11 = load i8*, i8** %4
%12 = call i32 @strcpy(i32 %10, i8* %11)
store i32 8, i32* %6
%13 = load i32, i32* %3
%14 = bitcast %struct.sockaddr_un* %5 to %struct.sockaddr*
%15 = load i32, i32* %6
%16 = call i32 @bind(i32 %13, %struct.sockaddr* %14, i32 %15)
ret i32 %16
}

LLVM IR (-O2):
%struct.sockaddr_un = type { i32, i32 }
%struct.sockaddr = type { i32 }
@AF_UNIX = global i32 0
define i32 @do_bind(i32 %0, i8* %1) {
%3 = alloca %struct.sockaddr_un
%4 = bitcast %struct.sockaddr_un* %3 to i8*
%5 = load i32, i32* @AF_UNIX
%6 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %3, i64 0, i32 1
store i32 %5, i32* %6
%7 = tail call i32 @strcpy(i32 undef, i8* %1)
%8 = bitcast %struct.sockaddr_un* %3 to %struct.sockaddr*
%9 = call i32 @bind(i32 %0, %struct.sockaddr* %8, i32 8)
ret i32 %9
}
long long unsigned int factoriel(int n) {
  if (n > 1) {
    return factoriel(n - 1) * n;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<factoriel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jle    1141 <factoriel+0x31>
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
call   1030 <factoriel@plt>
movslq -0xc(%rbp),%rcx
imul   %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    1149 <factoriel+0x39>
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<factoriel>:
mov    $0x1,%eax
cmp    $0x2,%edi
jl     1131 <factoriel+0x31>
mov    %edi,%ecx
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
imul   %rcx,%rax
lea    -0x1(%rcx),%rdx
cmp    $0x2,%rcx
mov    %rdx,%rcx
ja     1120 <factoriel+0x20>
ret

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

LLVM IR (-O2):
define i64 @factoriel(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %3, label %11
3: ; preds = %1
%4 = zext i32 %0 to i64
br label %5
5: ; preds = %3, %5
%6 = phi i64 [ %4, %3 ], [ %8, %5 ]
%7 = phi i64 [ 1, %3 ], [ %9, %5 ]
%8 = add nsw i64 %6, -1
%9 = mul i64 %7, %6
%10 = icmp ugt i64 %6, 2
br i1 %10, label %5, label %11
11: ; preds = %5, %1
%12 = phi i64 [ 1, %1 ], [ %9, %5 ]
ret i64 %12
}
int __ltulong(unsigned long a, unsigned long b) { return a < b; }


x86 assembly (clang, -O0):
<__ltulong>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
setb   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ltulong>:
xor    %eax,%eax
cmp    %rsi,%rdi
setb   %al
ret

LLVM IR (-O0):
define i32 @__ltulong(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp ult i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @__ltulong(i64 %0, i64 %1) {
%3 = icmp ult i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ MY_RELAX_CPU();
int LF_BACKOFF(void) {
  int i;
  for (i = 0; i < 200; i++)
    MY_RELAX_CPU();
  return 1;
}


x86 assembly (clang, -O0):
<LF_BACKOFF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0xc8,-0x4(%rbp)
jge    1141 <LF_BACKOFF+0x31>
mov    $0x0,%al
call   1030 <MY_RELAX_CPU@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <LF_BACKOFF+0xf>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LF_BACKOFF>:
push   %rbx
mov    $0xc8,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <MY_RELAX_CPU@plt>
add    $0xffffffff,%ebx
jne    1120 <LF_BACKOFF+0x10>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @LF_BACKOFF() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %7, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 200
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = call i32 (...) @MY_RELAX_CPU()
br label %7
7: ; preds = %5
%8 = load i32, i32* %1
%9 = add nsw i32 %8, 1
store i32 %9, i32* %1
br label %2
10: ; preds = %2
ret i32 1
}

LLVM IR (-O2):
define i32 @LF_BACKOFF() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 (...) @MY_RELAX_CPU()
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 200
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void _az_zero_array(void *ptr, size_t n, size_t size) {
  memset(ptr, 0, n * size);
}


x86 assembly (clang, -O0):
<_az_zero_array>:
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),%rdx
imul   -0x18(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_az_zero_array>:
imul   %rsi,%rdx
xor    %esi,%esi
jmp    1030 <memset@plt>

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

LLVM IR (-O2):
define void @_az_zero_array(i8* %0, i64 %1, i64 %2) {
%4 = mul i64 %2, %1
%5 = tail call i32 @memset(i8* %0, i32 0, i64 %4)
ret void
}
/* Variables and functions */
int pow(int, int);
int /*<<< orphan*/ printf(char *, int);
void problem_006(void) {
  int n = 100;
  int sum_of_squares = pow(n * (n + 1) / 2, 2);
  int square_of_sum = (2 * pow(n, 2) + 3 * n + 1) * n / 6;
  int difference = sum_of_squares - square_of_sum;
  printf("%i", difference);
  return;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x64,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
call   1040 <pow@plt>
shl    $0x1,%eax
imul   $0x3,-0x4(%rbp),%ecx
add    %ecx,%eax
add    $0x1,%eax
imul   -0x4(%rbp),%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbx
mov    $0x13ba,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %eax,%ebx
mov    $0x64,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
imul   $0xc8,%eax,%eax
add    $0x7594,%eax
cltq
imul   $0xffffffffd5555555,%rax,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
shr    $0x20,%rsi
add    %eax,%esi
add    %ebx,%esi
lea    0xe95(%rip),%rdi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
define void @problem_006() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 100, i32* %1
%5 = load i32, i32* %1
%6 = load i32, i32* %1
%7 = add nsw i32 %6, 1
%8 = mul nsw i32 %5, %7
%9 = sdiv i32 %8, 2
%10 = call i32 @pow(i32 %9, i32 2)
store i32 %10, i32* %2
%11 = load i32, i32* %1
%12 = call i32 @pow(i32 %11, i32 2)
%13 = mul nsw i32 2, %12
%14 = load i32, i32* %1
%15 = mul nsw i32 3, %14
%16 = add nsw i32 %13, %15
%17 = add nsw i32 %16, 1
%18 = load i32, i32* %1
%19 = mul nsw i32 %17, %18
%20 = sdiv i32 %19, 6
store i32 %20, i32* %3
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = sub nsw i32 %21, %22
store i32 %23, i32* %4
%24 = load i32, i32* %4
%25 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %24)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
define void @problem_006() {
%1 = tail call i32 @pow(i32 5050, i32 2)
%2 = tail call i32 @pow(i32 100, i32 2)
%3 = mul i32 %2, 200
%4 = add i32 %3, 30100
%5 = sdiv i32 %4, -6
%6 = add i32 %5, %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}
unsigned long sum(unsigned int n) {
  unsigned long sum = 0;
  for (unsigned long i = 1; i <= n; i++) {
    sum += i;
  }
  return sum;
}


x86 assembly (clang, -O0):
<sum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
cmp    %rcx,%rax
ja     1144 <sum+0x44>
mov    -0x18(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1117 <sum+0x17>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum>:
test   %edi,%edi
je     111f <sum+0x1f>
mov    %edi,%ecx
lea    -0x1(%rcx),%rax
lea    -0x2(%rcx),%rdx
mul    %rdx
shld   $0x3f,%rax,%rdx
lea    (%rdx,%rcx,2),%rax
add    $0xffffffffffffffff,%rax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @sum(i32 %0) {
%2 = zext i32 %0 to i64
%3 = icmp eq i32 %0, 0
br i1 %3, label %15, label %4
4: ; preds = %1
%5 = shl nuw nsw i64 %2, 1
%6 = add nsw i64 %2, -1
%7 = zext i64 %6 to i65
%8 = add nsw i64 %2, -2
%9 = zext i64 %8 to i65
%10 = mul i65 %7, %9
%11 = lshr i65 %10, 1
%12 = trunc i65 %11 to i64
%13 = add i64 %5, %12
%14 = add i64 %13, -1
br label %15
15: ; preds = %4, %1
%16 = phi i64 [ 0, %1 ], [ %14, %4 ]
ret i64 %16
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_12() {
  Assert_real((isqrt(12) == 3),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/stdlib/isqrt.c",
              65, ("Integer square root of 12 should be 3"));
}


x86 assembly (clang, -O0):
<t_sqrt_12>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc,%edi
call   1030 <isqrt@plt>
cmp    $0x3,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x41,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_12>:
push   %rax
mov    $0xc,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x41,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [38 x i8] c"Integer square root of 12 should be 3\00"
define void @t_sqrt_12() {
%1 = call i32 @isqrt(i32 12)
%2 = icmp eq i32 %1, 3
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 65, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [38 x i8] c"Integer square root of 12 should be 3\00"
define void @t_sqrt_12() {
%1 = tail call i32 @isqrt(i32 12)
%2 = icmp eq i32 %1, 3
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 65, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void _flush_cache(void) {}


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

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

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

LLVM IR (-O2):
define void @_flush_cache() {
ret void
}
void XkbFreeNames() {}


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

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

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

LLVM IR (-O2):
define void @XkbFreeNames() {
ret void
}
int ddsGetBlueMask(unsigned const char *buffer) {
  return (buffer[100] & 0xFF) | (buffer[101] & 0xFF) << 8 |
         (buffer[102] & 0xFF) << 16 | (buffer[103] & 0xFF) << 24;
}


x86 assembly (clang, -O0):
<ddsGetBlueMask>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x64(%rax),%eax
and    $0xff,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x65(%rcx),%ecx
and    $0xff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x66(%rcx),%ecx
and    $0xff,%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x67(%rcx),%ecx
and    $0xff,%ecx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ddsGetBlueMask>:
mov    0x64(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @ddsGetBlueMask(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 100
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = and i32 %6, 255
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 101
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = and i32 %11, 255
%13 = shl i32 %12, 8
%14 = or i32 %7, %13
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 102
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = and i32 %18, 255
%20 = shl i32 %19, 16
%21 = or i32 %14, %20
%22 = load i8*, i8** %2
%23 = getelementptr inbounds i8, i8* %22, i64 103
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = and i32 %25, 255
%27 = shl i32 %26, 24
%28 = or i32 %21, %27
ret i32 %28
}

LLVM IR (-O2):
define i32 @ddsGetBlueMask(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 100
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = getelementptr inbounds i8, i8* %0, i64 101
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 8
%9 = or i32 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 102
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl nuw nsw i32 %12, 16
%14 = or i32 %9, %13
%15 = getelementptr inbounds i8, i8* %0, i64 103
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = shl nuw i32 %17, 24
%19 = or i32 %14, %18
ret i32 %19
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void *test_fun(void *arg) {
  printf("omp_thread: %d\n", *((int *)arg));
  return arg;
}


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

x86 assembly (clang, -O2):
<test_fun>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%esi
lea    0xee3(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"omp_thread: %d\0A\00"
define i8* @test_fun(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i8*, i8** %2
ret i8* %7
}

LLVM IR (-O2):
@.str = [16 x i8] c"omp_thread: %d\0A\00"
define i8* @test_fun(i8* returned %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i8* %0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void initGpioPinMod(uint32_t hGPIO, uint32_t nPin, uint32_t mode) {
  uint32_t *GPIO_MODER;
  GPIO_MODER = (uint32_t *)(hGPIO + 0x00);
  *GPIO_MODER &= ~(0x03 << nPin * 2);
  *GPIO_MODER |= (mode << nPin * 2);
}


x86 assembly (clang, -O0):
<initGpioPinMod>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x0,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
mov    $0x3,%eax
shl    %cl,%eax
mov    %eax,%ecx
xor    $0xffffffff,%ecx
mov    -0x18(%rbp),%rax
and    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
shl    %cl,%eax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<initGpioPinMod>:
movslq %edi,%rax
lea    (%rsi,%rsi,1),%ecx
mov    $0x3,%esi
shl    %cl,%esi
not    %esi
shl    %cl,%edx
and    (%rax),%esi
or     %esi,%edx
mov    %edx,(%rax)
ret

LLVM IR (-O0):
define void @initGpioPinMod(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* %4
%9 = add nsw i32 %8, 0
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
store i32* %11, i32** %7
%12 = load i32, i32* %5
%13 = mul nsw i32 %12, 2
%14 = shl i32 3, %13
%15 = xor i32 %14, -1
%16 = load i32*, i32** %7
%17 = load i32, i32* %16
%18 = and i32 %17, %15
store i32 %18, i32* %16
%19 = load i32, i32* %6
%20 = load i32, i32* %5
%21 = mul nsw i32 %20, 2
%22 = shl i32 %19, %21
%23 = load i32*, i32** %7
%24 = load i32, i32* %23
%25 = or i32 %24, %22
store i32 %25, i32* %23
ret void
}

LLVM IR (-O2):
define void @initGpioPinMod(i32 %0, i32 %1, i32 %2) {
%4 = sext i32 %0 to i64
%5 = inttoptr i64 %4 to i32*
%6 = shl nsw i32 %1, 1
%7 = shl i32 3, %6
%8 = xor i32 %7, -1
%9 = load i32, i32* %5
%10 = and i32 %9, %8
%11 = shl i32 %2, %6
%12 = or i32 %10, %11
store i32 %12, i32* %5
ret void
}
/* Variables and functions */
int NI_USUAL_RTSI_SELECT(unsigned int);
unsigned NI_AO_SCAN_BEGIN_SRC_RTSI(unsigned rtsi_channel) {
  return NI_USUAL_RTSI_SELECT(rtsi_channel);
}


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

x86 assembly (clang, -O2):
<NI_AO_SCAN_BEGIN_SRC_RTSI>:
jmp    1030 <NI_USUAL_RTSI_SELECT@plt>

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

LLVM IR (-O2):
define i32 @NI_AO_SCAN_BEGIN_SRC_RTSI(i32 %0) {
%2 = tail call i32 @NI_USUAL_RTSI_SELECT(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
void f() {
  unsigned int max = 0;
  if (max < 82) {
    max = 82;
  }
  if (max < 43) {
    max = 43;
  }
  printf("max=%u\n", max);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x52,-0x4(%rbp)
jae    1130 <f+0x20>
movl   $0x52,-0x4(%rbp)
cmpl   $0x2b,-0x4(%rbp)
jae    1141 <f+0x31>
movl   $0x2b,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
lea    0xee9(%rip),%rdi
mov    $0x52,%esi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"max=%u\0A\00"
define void @f() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* %1
%3 = icmp ult i32 %2, 82
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 82, i32* %1
br label %5
5: ; preds = %4, %0
%6 = load i32, i32* %1
%7 = icmp ult i32 %6, 43
br i1 %7, label %8, label %9
8: ; preds = %5
store i32 43, i32* %1
br label %9
9: ; preds = %8, %5
%10 = load i32, i32* %1
%11 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"max=%u\0A\00"
define void @f() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 82)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage() {
  printf("\nusage: dpfilt in-file out-file");
  printf("\n"
         "\nThis program prepares an ASCII file for"
         "\ninput into MS Word.  It removes the hard"
         "\ncarraige returns from the end of each line."
         "\nIt keeps the return when there are two in"
         "\na row.  That makes the paragraphs correct"
         "\nfor MS Word.");
}


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

x86 assembly (clang, -O2):
<print_usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
lea    0xefc(%rip),%rdi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"\0Ausage: dpfilt in-file out-file\00"
@.str.1 = [224 x i8] c"\0A\0AThis program prepares an ASCII file for\0Ainput into MS Word. It removes the hard\0Acarraige returns from the end of each line.\0AIt keeps the return when there are two in\0Aa row. That makes the paragraphs correct\0Afor MS Word.\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([224 x i8], [224 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"\0Ausage: dpfilt in-file out-file\00"
@.str.1 = [224 x i8] c"\0A\0AThis program prepares an ASCII file for\0Ainput into MS Word. It removes the hard\0Acarraige returns from the end of each line.\0AIt keeps the return when there are two in\0Aa row. That makes the paragraphs correct\0Afor MS Word.\00"
define void @print_usage() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([224 x i8], [224 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SerialWriteChar(unsigned long);
void SerialSendBytes(unsigned long *data, unsigned long len) {
  if (0 < len) {
    unsigned long index;
    index = 0u;
    while (index < len) {
      SerialWriteChar(data[index]);
      index++;
    }
  }
}


x86 assembly (clang, -O0):
<SerialSendBytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jae    1169 <SerialSendBytes+0x59>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1164 <SerialSendBytes+0x54>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <SerialWriteChar@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1134 <SerialSendBytes+0x24>
jmp    1169 <SerialSendBytes+0x59>
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @SerialSendBytes(i64* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %11, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %9, %4 ], [ 0, %2 ]
%6 = getelementptr inbounds i64, i64* %0, i64 %5
%7 = load i64, i64* %6
%8 = tail call i32 @SerialWriteChar(i64 %7)
%9 = add nuw i64 %5, 1
%10 = icmp eq i64 %9, %1
br i1 %10, label %11, label %4
11: ; preds = %4, %2
ret void
}
int extn_shutdown(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @extn_shutdown() {
ret i32 0
}
/* Variables and functions */
int expensive_function(int);
int f(int y) {
  static int map[10];
  if (map[y]) {
    return map[y];
  }
  return map[y] = expensive_function(y);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movslq -0x8(%rbp),%rcx
lea    0x2f1a(%rip),%rax
cmpl   $0x0,(%rax,%rcx,4)
je     1146 <f+0x36>
movslq -0x8(%rbp),%rcx
lea    0x2f05(%rip),%rax
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4(%rbp)
jmp    115f <f+0x4f>
mov    -0x8(%rbp),%edi
call   1030 <expensive_function@plt>
movslq -0x8(%rbp),%rdx
lea    0x2ee7(%rip),%rcx
mov    %eax,(%rcx,%rdx,4)
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %r14
push   %rbx
push   %rax
movslq %edi,%rbx
lea    0x2f22(%rip),%r14
mov    (%r14,%rbx,4),%eax
test   %eax,%eax
jne    1131 <f+0x21>
mov    %ebx,%edi
call   1030 <expensive_function@plt>
mov    %eax,(%r14,%rbx,4)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@f.map = internal global [10 x i32] zeroinitializer
define i32 @f(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds [10 x i32], [10 x i32]* @f.map, i64 0, i64 %5
%7 = load i32, i32* %6
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [10 x i32], [10 x i32]* @f.map, i64 0, i64 %11
%13 = load i32, i32* %12
store i32 %13, i32* %2
br label %20
14: ; preds = %1
%15 = load i32, i32* %3
%16 = call i32 @expensive_function(i32 %15)
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [10 x i32], [10 x i32]* @f.map, i64 0, i64 %18
store i32 %16, i32* %19
store i32 %16, i32* %2
br label %20
20: ; preds = %14, %9
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
@f.map = internal unnamed_addr global [10 x i32] zeroinitializer
define i32 @f(i32 %0) {
%2 = sext i32 %0 to i64
%3 = getelementptr inbounds [10 x i32], [10 x i32]* @f.map, i64 0, i64 %2
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @expensive_function(i32 %0)
store i32 %7, i32* %3
br label %8
8: ; preds = %1, %6
%9 = phi i32 [ %7, %6 ], [ %4, %1 ]
ret i32 %9
}
unsigned long log_2(unsigned long val) {
  unsigned long ret;
  asm("bsrq	%1, %0" : "=r"(ret) : "r"(val));
  return ret;
}


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

x86 assembly (clang, -O2):
<log_2>:
bsr    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @log_2(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i64 asm "bsrq\09$1, $0", "=r,r,~{dirflag},~{fpsr},~{flags}"(i64 %4)
store i64 %5, i64* %3
%6 = load i64, i64* %3
ret i64 %6
}

LLVM IR (-O2):
define i64 @log_2(i64 %0) {
%2 = tail call i64 asm "bsrq\09$1, $0", "=r,r,~{dirflag},~{fpsr},~{flags}"(i64 %0)
ret i64 %2
}
void __remove(const char *filename) {}


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

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

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

LLVM IR (-O2):
define void @__remove(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pushNumber(int /*<<< orphan*/);
int /*<<< orphan*/ resumemusic();
void basResumeMusic(void) { pushNumber(resumemusic()); }


x86 assembly (clang, -O0):
<basResumeMusic>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <resumemusic@plt>
mov    %eax,%edi
call   1040 <pushNumber@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<basResumeMusic>:
push   %rax
xor    %eax,%eax
call   1030 <resumemusic@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <pushNumber@plt>

LLVM IR (-O0):
define void @basResumeMusic() {
%1 = call i32 (...) @resumemusic()
%2 = call i32 @pushNumber(i32 %1)
ret void
}

LLVM IR (-O2):
define void @basResumeMusic() {
%1 = tail call i32 (...) @resumemusic()
%2 = tail call i32 @pushNumber(i32 %1)
ret void
}
/* Variables and functions */
char *POPT_next_char(char const *);
size_t strlen(char const *);
size_t stringDisplayWidth(const char *s) {
  size_t n = strlen(s);
  n = 0;
  for (; *s; s = POPT_next_char(s))
    n++;
  return n;
}


x86 assembly (clang, -O0):
<stringDisplayWidth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     116c <stringDisplayWidth+0x4c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <POPT_next_char@plt>
mov    %rax,-0x8(%rbp)
jmp    1141 <stringDisplayWidth+0x21>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringDisplayWidth>:
push   %rbx
cmpb   $0x0,(%rdi)
je     1133 <stringDisplayWidth+0x23>
mov    %rdi,%rax
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
mov    %rax,%rdi
call   1030 <POPT_next_char@plt>
cmpb   $0x0,(%rax)
jne    1120 <stringDisplayWidth+0x10>
jmp    1135 <stringDisplayWidth+0x25>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @stringDisplayWidth(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = add i64 %5, 1
%8 = tail call i8* @POPT_next_char(i8* %6)
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i64 [ 0, %1 ], [ %7, %4 ]
ret i64 %12
}
__attribute__((__weak__, __always___)) char *softboundmpx_strerror(int errnum) {
  void *ret_ptr = strerror(errnum);
  __softboundmpx_store_return_metadata(
      ret_ptr, (void *)((char *)ret_ptr + strlen(ret_ptr) + 1));
  return ret_ptr;
}


x86 assembly (clang, -O0):
<softboundmpx_strerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <strerror@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdi
add    %rax,%rsi
add    $0x1,%rsi
mov    $0x0,%al
call   1040 <__softboundmpx_store_return_metadata@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<softboundmpx_strerror>:
push   %rbx
call   1050 <strerror@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <strlen@plt>
lea    (%rbx,%rax,1),%rsi
add    $0x1,%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <__softboundmpx_store_return_metadata@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define weak i8* @softboundmpx_strerror(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @strerror(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = load i8*, i8** %3
%8 = load i8*, i8** %3
%9 = call i64 @strlen(i8* %8)
%10 = getelementptr inbounds i8, i8* %7, i64 %9
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @__softboundmpx_store_return_metadata to i32 (i8*, i8*, ...)*)(i8* %6, i8* %11)
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
define weak i8* @softboundmpx_strerror(i32 %0) {
%2 = tail call i8* @strerror(i32 %0)
%3 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%4 = getelementptr inbounds i8, i8* %2, i64 %3
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @__softboundmpx_store_return_metadata to i32 (i8*, i8*, ...)*)(i8* %2, i8* %5)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void kiss_platform_serial_close(int handle) { close(handle); }


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

x86 assembly (clang, -O2):
<kiss_platform_serial_close>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @kiss_platform_serial_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int function(int);
void main() {
  int32_t a;
  a = 1;
  a = function(a);
}


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

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%edi
jmp    1030 <function@plt>

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
store i32 1, i32* %1
%2 = load i32, i32* %1
%3 = call i32 @function(i32 %2)
store i32 %3, i32* %1
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @function(i32 1)
ret void
}
double returnDoubleSum(const float a, double b) {
  double tempA = a;
  double tempB = b;
  return (tempA + tempB) / 1000000;
}


x86 assembly (clang, -O0):
<returnDoubleSum>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movsd  %xmm1,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  0xec8(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<returnDoubleSum>:
cvtss2sd %xmm0,%xmm0
addsd  %xmm1,%xmm0
divsd  0xef0(%rip),%xmm0
ret

LLVM IR (-O0):
define double @returnDoubleSum(float %0, double %1) {
%3 = alloca float
%4 = alloca double
%5 = alloca double
%6 = alloca double
store float %0, float* %3
store double %1, double* %4
%7 = load float, float* %3
%8 = fpext float %7 to double
store double %8, double* %5
%9 = load double, double* %4
store double %9, double* %6
%10 = load double, double* %5
%11 = load double, double* %6
%12 = fadd double %10, %11
%13 = fdiv double %12, 1.000000e+06
ret double %13
}

LLVM IR (-O2):
define double @returnDoubleSum(float %0, double %1) {
%3 = fpext float %0 to double
%4 = fadd double %3, %1
%5 = fdiv double %4, 1.000000e+06
ret double %5
}
int default_cmp(const void *k1, const void *k2) {
  return (char *)k1 < (char *)k2 ? -1 : (char *)k1 > (char *)k2;
}


x86 assembly (clang, -O0):
<default_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1127 <default_cmp+0x27>
mov    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    113a <default_cmp+0x3a>
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<default_cmp>:
xor    %ecx,%ecx
cmp    %rsi,%rdi
seta   %cl
mov    $0xffffffff,%eax
cmovae %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @default_cmp(i8* readnone %0, i8* readnone %1) {
%3 = icmp ult i8* %0, %1
%4 = icmp ugt i8* %0, %1
%5 = zext i1 %4 to i32
%6 = select i1 %3, i32 -1, i32 %5
ret i32 %6
}
void skipped(x) const char *const x;
{
  if (*x)
    nlog("Skipped"), logqnl(x);
}


x86 assembly (clang, -O0):
<skipped>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1152 <skipped+0x32>
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1040 <nlog@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <logqnl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipped>:
push   %rbx
cmpb   $0x0,(%rdi)
je     1142 <skipped+0x22>
mov    %rdi,%rbx
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1040 <nlog@plt>
mov    %rbx,%rdi
xor    %eax,%eax
pop    %rbx
jmp    1030 <logqnl@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Skipped\00"
define void @skipped(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = icmp ne i8 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @nlog to i32 (i8*, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %2
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @logqnl to i32 (i8*, ...)*)(i8* %8)
br label %10
10: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"Skipped\00"
define void @skipped(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @nlog to i32 (i8*, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @logqnl to i32 (i8*, ...)*)(i8* %0)
br label %7
7: ; preds = %4, %1
ret void
}
void XrmQGetResource() {}


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

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

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

LLVM IR (-O2):
define void @XrmQGetResource() {
ret void
}
int arch_prctl(int code, unsigned long addr) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @arch_prctl(i32 %0, i64 %1) {
ret i32 -1
}
void displaycon_off(void) {
  (*((volatile unsigned long *)0x77100000)) &= ~0x3;
  (*((volatile unsigned long *)0x77100020)) &= ~1;
}


x86 assembly (clang, -O0):
<displaycon_off>:
push   %rbp
mov    %rsp,%rbp
mov    $0x77100000,%eax
mov    (%rax),%rcx
and    $0xfffffffffffffffc,%rcx
mov    $0x77100000,%eax
mov    %rcx,(%rax)
mov    $0x77100020,%eax
mov    (%rax),%rcx
and    $0xfffffffffffffffe,%rcx
mov    $0x77100020,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<displaycon_off>:
andq   $0xfffffffffffffffc,0x77100000
77 fc
andq   $0xfffffffffffffffe,0x77100020
77 fe
ret

LLVM IR (-O0):
define void @displaycon_off() {
%1 = load volatile i64, i64* inttoptr (i64 1997537280 to i64*)
%2 = and i64 %1, -4
store volatile i64 %2, i64* inttoptr (i64 1997537280 to i64*)
%3 = load volatile i64, i64* inttoptr (i64 1997537312 to i64*)
%4 = and i64 %3, -2
store volatile i64 %4, i64* inttoptr (i64 1997537312 to i64*)
ret void
}

LLVM IR (-O2):
define void @displaycon_off() {
%1 = load volatile i64, i64* inttoptr (i64 1997537280 to i64*)
%2 = and i64 %1, -4
store volatile i64 %2, i64* inttoptr (i64 1997537280 to i64*)
%3 = load volatile i64, i64* inttoptr (i64 1997537312 to i64*)
%4 = and i64 %3, -2
store volatile i64 %4, i64* inttoptr (i64 1997537312 to i64*)
ret void
}
void ERR_print_errors(void) {}


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

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

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

LLVM IR (-O2):
define void @ERR_print_errors() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
void print_double(void *elemAddr, void *auxData) {
  printf("%.2f, ", *(double *)elemAddr);
}


x86 assembly (clang, -O0):
<print_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_double>:
movsd  (%rdi),%xmm0
lea    0xee5(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%.2f, \00"
define void @print_double(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to double*
%7 = load double, double* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %7)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%.2f, \00"
define void @print_double(i8* nocapture %0, i8* nocapture readnone %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ link_failure_log10l();
scalar_t__ log10l(long double);
void test_log10l(long double ld) {
  if (log10l(ld) != log10l(ld))
    link_failure_log10l();
}


x86 assembly (clang, -O0):
<test_log10l>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <log10l@plt>
mov    %rax,-0x18(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <log10l@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
je     1163 <test_log10l+0x43>
mov    $0x0,%al
call   1030 <link_failure_log10l@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_log10l>:
push   %rbx
sub    $0x20,%rsp
fldt   0x30(%rsp)
fld    %st(0)
fstpt  0x14(%rsp)
fstpt  (%rsp)
call   1040 <log10l@plt>
mov    %rax,%rbx
fldt   0x14(%rsp)
fstpt  (%rsp)
call   1040 <log10l@plt>
cmp    %rax,%rbx
jne    1151 <test_log10l+0x31>
add    $0x20,%rsp
pop    %rbx
ret
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
jmp    1030 <link_failure_log10l@plt>

LLVM IR (-O0):
define void @test_log10l(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = call i64 @log10l(x86_fp80 %3)
%5 = load x86_fp80, x86_fp80* %2
%6 = call i64 @log10l(x86_fp80 %5)
%7 = icmp ne i64 %4, %6
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (...) @link_failure_log10l()
br label %10
10: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
define void @test_log10l(x86_fp80 %0) {
%2 = tail call i64 @log10l(x86_fp80 %0)
%3 = tail call i64 @log10l(x86_fp80 %0)
%4 = icmp eq i64 %2, %3
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (...) @link_failure_log10l()
br label %7
7: ; preds = %5, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _IO(int, int);
int ioctl(int, int /*<<< orphan*/);
int CED_Reset1401(int fh) { return ioctl(fh, _IO(0xce, 3)); }


x86 assembly (clang, -O0):
<CED_Reset1401>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0xce,%edi
mov    $0x3,%esi
call   1030 <_IO@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%esi
call   1040 <ioctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CED_Reset1401>:
push   %rbx
mov    %edi,%ebx
mov    $0xce,%edi
mov    $0x3,%esi
call   1030 <_IO@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1040 <ioctl@plt>

LLVM IR (-O0):
define i32 @CED_Reset1401(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @_IO(i32 206, i32 3)
%5 = call i32 @ioctl(i32 %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @CED_Reset1401(i32 %0) {
%2 = tail call i32 @_IO(i32 206, i32 3)
%3 = tail call i32 @ioctl(i32 %0, i32 %2)
ret i32 %3
}
unsigned long bit_trunc(unsigned long var, int n_bits) {
  return var & ~((1 << n_bits) - 1);
}


x86 assembly (clang, -O0):
<bit_trunc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
sub    $0x1,%ecx
xor    $0xffffffff,%ecx
movslq %ecx,%rcx
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_trunc>:
mov    %esi,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
cltq
and    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @bit_trunc(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = load i32, i32* %4
%7 = shl i32 1, %6
%8 = sub nsw i32 %7, 1
%9 = xor i32 %8, -1
%10 = sext i32 %9 to i64
%11 = and i64 %5, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @bit_trunc(i64 %0, i32 %1) {
%3 = shl nsw i32 -1, %1
%4 = sext i32 %3 to i64
%5 = and i64 %4, %0
ret i64 %5
}