xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
main() {
  int a[5];
  printf("%d", &a[6] - &a[1]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x20(%rbp),%rax
add    $0x18,%rax
lea    -0x20(%rbp),%rcx
add    $0x4,%rcx
sub    %rcx,%rax
sar    $0x2,%rax
mov    %eax,%esi
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 6
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%4 = ptrtoint i32* %2 to i64
%5 = ptrtoint i32* %3 to i64
%6 = sub i64 %4, %5
%7 = sdiv exact i64 %6, 4
%8 = trunc i64 %7 to i32
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void error(void) {
  perror("bin2c");
  exit(1);
}


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"bin2c\00"
define void @error() {
%1 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [6 x i8] c"bin2c\00"
define void @error() {
%1 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isgraph(int);
void t_isgraph_0xae() {
  Assert_real((isgraph(174) == 0),
              "/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/ctype/test_isgraph.c",
              875, ("isgraph should be 0 for 0xae"));
}


x86 assembly (clang, -O0):
<t_isgraph_0xae>:
push   %rbp
mov    %rsp,%rbp
mov    $0xae,%edi
call   1040 <isgraph@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x36b,%edx
lea    0xf5b(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isgraph_0xae>:
push   %rax
mov    $0xae,%edi
call   1040 <isgraph@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x36b,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 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/ctype/test_isgraph.c\00"
@.str.1 = [29 x i8] c"isgraph should be 0 for 0xae\00"
define void @t_isgraph_0xae() {
%1 = call i64 @isgraph(i32 174)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 875, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 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/ctype/test_isgraph.c\00"
@.str.1 = [29 x i8] c"isgraph should be 0 for 0xae\00"
define void @t_isgraph_0xae() {
%1 = tail call i64 @isgraph(i32 174)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 875, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
struct tms {
  int dummy;
};
typedef int /*<<< orphan*/ clock_t;

/* Variables and functions */
int /*<<< orphan*/ puts(char *);
clock_t times(struct tms *buffer) {
  (void)buffer;
  puts("times: not implemented");
  return (clock_t)-1;
}


x86 assembly (clang, -O0):
<times>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.tms = type { i32 }
@.str = [23 x i8] c"times: not implemented\00"
define i32 @times(%struct.tms* %0) {
%2 = alloca %struct.tms*
store %struct.tms* %0, %struct.tms** %2
%3 = load %struct.tms*, %struct.tms** %2
%4 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
%struct.tms = type { i32 }
@.str = [23 x i8] c"times: not implemented\00"
define i32 @times(%struct.tms* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}
unsigned int rol32(unsigned int A, unsigned char n) {
  return ((A) << (n)) | ((A) >> (32 - (n)));
}


x86 assembly (clang, -O0):
<rol32>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%eax
movzbl -0x5(%rbp),%ecx
shl    %cl,%eax
mov    -0x4(%rbp),%edx
movzbl -0x5(%rbp),%esi
mov    $0x20,%ecx
sub    %esi,%ecx
shr    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rol32>:
mov    %esi,%ecx
mov    %edi,%eax
rol    %cl,%eax
ret

LLVM IR (-O0):
define i32 @rol32(i32 %0, i8 zeroext %1) {
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
store i8 %1, i8* %4
%5 = load i32, i32* %3
%6 = load i8, i8* %4
%7 = zext i8 %6 to i32
%8 = shl i32 %5, %7
%9 = load i32, i32* %3
%10 = load i8, i8* %4
%11 = zext i8 %10 to i32
%12 = sub nsw i32 32, %11
%13 = lshr i32 %9, %12
%14 = or i32 %8, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @rol32(i32 %0, i8 zeroext %1) {
%3 = zext i8 %1 to i32
%4 = shl i32 %0, %3
%5 = sub nsw i32 32, %3
%6 = lshr i32 %0, %5
%7 = or i32 %6, %4
ret i32 %7
}
int test_imm_BCuint64_lowword_reg(unsigned long long val) {
  return ((val) & (0xBC << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_BCuint64_lowword_reg>:
test   $0xbc,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_BCuint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 188
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int memcmp(char const *, char const *, size_t);
size_t strlen(char const *);
int strcmp(const char *a, const char *b) {
  size_t n = strlen(a);
  size_t m = strlen(b);
  return memcmp(a, b, (n < m ? n : m) + 1);
}


x86 assembly (clang, -O0):
<strcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1175 <strcmp+0x55>
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    117d <strcmp+0x5d>
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rdx
add    $0x1,%rdx
call   1040 <memcmp@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strlen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    %rax,%rbx
cmovae %rax,%rbx
add    $0x1,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <memcmp@plt>

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

LLVM IR (-O2):
define i32 @strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = icmp ult i64 %3, %4
%6 = select i1 %5, i64 %3, i64 %4
%7 = add i64 %6, 1
%8 = tail call i32 @memcmp(i8* %0, i8* %1, i64 %7)
ret i32 %8
}
void U422ToARGB() {}


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

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

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

LLVM IR (-O2):
define void @U422ToARGB() {
ret void
}
int skip_until_char(char *s, int len, char c) {
  register int i;
  for (i = 0; i < len; i++) {
    if (s[i] == c)
      break;
  }
  return (i);
}


x86 assembly (clang, -O0):
<skip_until_char>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1153 <skip_until_char+0x53>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0xd(%rbp),%ecx
cmp    %ecx,%eax
jne    1140 <skip_until_char+0x40>
jmp    1153 <skip_until_char+0x53>
jmp    1145 <skip_until_char+0x45>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1117 <skip_until_char+0x17>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_until_char>:
test   %esi,%esi
jle    1121 <skip_until_char+0x21>
mov    %esi,%ecx
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
cmp    %dl,(%rdi,%rax,1)
je     1120 <skip_until_char+0x20>
add    $0x1,%rax
cmp    %rax,%rcx
jne    1110 <skip_until_char+0x10>
mov    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @skip_until_char(i8* nocapture %0, i32 %1, i8 signext %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %12
%8 = phi i64 [ 0, %5 ], [ %13, %12 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, %2
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %17, label %7
15: ; preds = %7
%16 = trunc i64 %8 to i32
br label %17
17: ; preds = %12, %15, %3
%18 = phi i32 [ 0, %3 ], [ %16, %15 ], [ %1, %12 ]
ret i32 %18
}
/* Variables and functions */
void *malloc(size_t);
void *__alloc(void *cc, size_t n) {
  void *mem = malloc(n);
  return mem;
}


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

x86 assembly (clang, -O2):
<__alloc>:
mov    %rsi,%rdi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @__alloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = call i8* @malloc(i64 %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
ret i8* %8
}

LLVM IR (-O2):
define noalias i8* @__alloc(i8* nocapture readnone %0, i64 %1) {
%3 = tail call i8* @malloc(i64 %1)
ret i8* %3
}
int compare_int(const void *a, const void *b) {
  int temp = *((int *)a) - *((int *)b);
  if (temp > 0)
    return 1;
  else if (temp < 0)
    return -1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<compare_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
sub    (%rcx),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    1131 <compare_int+0x31>
movl   $0x1,-0x4(%rbp)
jmp    114e <compare_int+0x4e>
cmpl   $0x0,-0x1c(%rbp)
jge    1147 <compare_int+0x47>
movl   $0xffffffff,-0x4(%rbp)
jmp    114e <compare_int+0x4e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_int>:
mov    (%rdi),%eax
sub    (%rsi),%eax
mov    %eax,%ecx
sar    $0x1f,%ecx
test   %eax,%eax
mov    $0x1,%eax
cmovle %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @compare_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
%8 = ashr i32 %7, 31
%9 = icmp slt i32 %7, 1
%10 = select i1 %9, i32 %8, i32 1
ret i32 %10
}
/* Variables and functions */
int foo();
void f4(void) {
  switch (foo()) {
  case 3:
    break;
  }
}


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
call   1030 <foo@plt>
sub    $0x3,%eax
jne    112e <f4+0x1e>
jmp    1129 <f4+0x19>
jmp    112e <f4+0x1e>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f4() {
%1 = call i32 (...) @foo()
switch i32 %1, label %3 [
i32 3, label %2
]
2: ; preds = %0
br label %3
3: ; preds = %0, %2
ret void
}

LLVM IR (-O2):
define void @f4() {
%1 = tail call i32 (...) @foo()
ret void
}
/* Type definitions */
struct sl_pp_macro {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _macro_destroy(struct sl_pp_macro *);
int /*<<< orphan*/ _macro_init(struct sl_pp_macro *);
void sl_pp_macro_reset(struct sl_pp_macro *macro) {
  _macro_destroy(macro);
  _macro_init(macro);
}


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

x86 assembly (clang, -O2):
<sl_pp_macro_reset>:
push   %rbx
mov    %rdi,%rbx
call   1040 <_macro_destroy@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <_macro_init@plt>

LLVM IR (-O0):
%struct.sl_pp_macro = type { i32 }
define void @sl_pp_macro_reset(%struct.sl_pp_macro* %0) {
%2 = alloca %struct.sl_pp_macro*
store %struct.sl_pp_macro* %0, %struct.sl_pp_macro** %2
%3 = load %struct.sl_pp_macro*, %struct.sl_pp_macro** %2
%4 = call i32 @_macro_destroy(%struct.sl_pp_macro* %3)
%5 = load %struct.sl_pp_macro*, %struct.sl_pp_macro** %2
%6 = call i32 @_macro_init(%struct.sl_pp_macro* %5)
ret void
}

LLVM IR (-O2):
%struct.sl_pp_macro = type { i32 }
define void @sl_pp_macro_reset(%struct.sl_pp_macro* %0) {
%2 = tail call i32 @_macro_destroy(%struct.sl_pp_macro* %0)
%3 = tail call i32 @_macro_init(%struct.sl_pp_macro* %0)
ret void
}
void foo(int **a) {
  int b = 1;
  *a = &b;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%rax
lea    -0xc(%rbp),%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
lea    -0x4(%rsp),%rax
mov    %rax,(%rdi)
ret

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

LLVM IR (-O2):
define void @foo(i32** nocapture writeonly %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32* %2, i32** %0
ret void
}
/* Variables and functions */
void *a(size_t);
void *b1(size_t n) { return a(n); }


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

x86 assembly (clang, -O2):
<b1>:
jmp    1030 <a@plt>

LLVM IR (-O0):
define i8* @b1(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i8* @a(i64 %3)
ret i8* %4
}

LLVM IR (-O2):
define i8* @b1(i64 %0) {
%2 = tail call i8* @a(i64 %0)
ret i8* %2
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ strlcpy(char *, char const *, size_t);
size_t strlen(char const *);
char *strndup(const char *s, size_t maxlen) {
  char *dup;
  size_t len = strlen(s);
  if (len > maxlen)
    len = maxlen;
  len++;
  dup = malloc(len);
  if (dup)
    strlcpy(dup, s, len);
  return dup;
}


x86 assembly (clang, -O0):
<strndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    1163 <strndup+0x33>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1198 <strndup+0x68>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <strlcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strndup>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %rax,%rbx
cmp    %r15,%rax
cmova  %r15,%rbx
add    $0x1,%rbx
mov    %rbx,%rdi
call   1040 <malloc@plt>
mov    %rax,%r15
test   %rax,%rax
je     116c <strndup+0x3c>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <strlcpy@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strndup(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%7 = load i8*, i8** %3
%8 = call i64 @strlen(i8* %7)
store i64 %8, i64* %6
%9 = load i64, i64* %6
%10 = load i64, i64* %4
%11 = icmp ugt i64 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load i64, i64* %4
store i64 %13, i64* %6
br label %14
14: ; preds = %12, %2
%15 = load i64, i64* %6
%16 = add i64 %15, 1
store i64 %16, i64* %6
%17 = load i64, i64* %6
%18 = call i8* @malloc(i64 %17)
store i8* %18, i8** %5
%19 = load i8*, i8** %5
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %26
21: ; preds = %14
%22 = load i8*, i8** %5
%23 = load i8*, i8** %3
%24 = load i64, i64* %6
%25 = call i32 @strlcpy(i8* %22, i8* %23, i64 %24)
br label %26
26: ; preds = %21, %14
%27 = load i8*, i8** %5
ret i8* %27
}

LLVM IR (-O2):
define i8* @strndup(i8* %0, i64 %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = icmp ugt i64 %3, %1
%5 = select i1 %4, i64 %1, i64 %3
%6 = add i64 %5, 1
%7 = tail call i8* @malloc(i64 %6)
%8 = icmp eq i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = tail call i32 @strlcpy(i8* %7, i8* %0, i64 %6)
br label %11
11: ; preds = %9, %2
ret i8* %7
}
/* Variables and functions */
int my_strlen(char *);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  char *string = "This is a test";
  int l;
  l = my_strlen(string);
  printf("Length is %i\n", l);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <my_strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xebf(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <my_strlen@plt>
lea    0xedb(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"This is a test\00"
@.str.1 = [14 x i8] c"Length is %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @my_strlen(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"This is a test\00"
@.str.1 = [14 x i8] c"Length is %i\0A\00"
define i32 @main() {
%1 = tail call i32 @my_strlen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ chdir(char *);
int /*<<< orphan*/ system(char *);
int main() {
  chdir("/mnt/user/code/SimpleMotors/bin");
  system("/mnt/user/jvm/java Main");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <chdir@plt>
lea    0xee9(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <chdir@plt>
lea    0xeec(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"/mnt/user/code/SimpleMotors/bin\00"
@.str.1 = [24 x i8] c"/mnt/user/jvm/java Main\00"
define i32 @main() {
%1 = call i32 @chdir(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"/mnt/user/code/SimpleMotors/bin\00"
@.str.1 = [24 x i8] c"/mnt/user/jvm/java Main\00"
define i32 @main() {
%1 = tail call i32 @chdir(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct stat {
  int st_mode;
};

/* Variables and functions */
int __S_IFMT;
int __S_IFREG;
scalar_t__ stat(char *, struct stat *);
int dashf(char *fname) {
  struct stat st;
  return (stat(fname, &st) == 0 &&
          ((((st.st_mode)) & __S_IFMT) == (__S_IFREG)));
}


x86 assembly (clang, -O0):
<dashf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
jne    1156 <dashf+0x46>
mov    -0x10(%rbp),%eax
mov    0x2ea3(%rip),%rcx
and    (%rcx),%eax
mov    0x2e8a(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dashf>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1125 <dashf+0x15>
pop    %rcx
ret
mov    0x2ebc(%rip),%rax
mov    (%rax),%ecx
and    (%rsp),%ecx
mov    0x2ea0(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%ecx
sete   %al
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@__S_IFMT = global i32 0
@__S_IFREG = global i32 0
define i32 @dashf(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @stat(i8* %4, %struct.stat* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %1
%8 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%9 = load i32, i32* %8
%10 = load i32, i32* @__S_IFMT
%11 = and i32 %9, %10
%12 = load i32, i32* @__S_IFREG
%13 = icmp eq i32 %11, %12
br label %14
14: ; preds = %7, %1
%15 = phi i1 [ false, %1 ], [ %13, %7 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@__S_IFMT = global i32 0
@__S_IFREG = global i32 0
define i32 @dashf(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = load i32, i32* @__S_IFMT
%10 = and i32 %9, %8
%11 = load i32, i32* @__S_IFREG
%12 = icmp eq i32 %10, %11
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %6, %1
%15 = phi i32 [ 0, %1 ], [ %13, %6 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ tmxr_buf_debug_char(int /*<<< orphan*/);
void tmxr_buf_debug_string(const char *string) {
  while (*string)
    tmxr_buf_debug_char(*string++);
}


x86 assembly (clang, -O0):
<tmxr_buf_debug_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <tmxr_buf_debug_string+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <tmxr_buf_debug_char@plt>
jmp    111c <tmxr_buf_debug_string+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tmxr_buf_debug_string>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <tmxr_buf_debug_string+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <tmxr_buf_debug_char@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <tmxr_buf_debug_string+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @tmxr_buf_debug_string(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %7, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %2
%10 = load i8, i8* %8
%11 = sext i8 %10 to i32
%12 = call i32 @tmxr_buf_debug_char(i32 %11)
br label %3
13: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @tmxr_buf_debug_string(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @tmxr_buf_debug_char(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Type definitions */
struct Cyc_Lexing_lexbuf {
  int dummy;
};

/* Variables and functions */
int Cyc_asmtok_rec(struct Cyc_Lexing_lexbuf *, int);
int Cyc_asmtok(struct Cyc_Lexing_lexbuf *lexbuf) {
  int _T0;
  _T0 = Cyc_asmtok_rec(lexbuf, 7);
  return _T0;
}


x86 assembly (clang, -O0):
<Cyc_asmtok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x7,%esi
call   1030 <Cyc_asmtok_rec@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_asmtok>:
mov    $0x7,%esi
jmp    1030 <Cyc_asmtok_rec@plt>

LLVM IR (-O0):
%struct.Cyc_Lexing_lexbuf = type { i32 }
define i32 @Cyc_asmtok(%struct.Cyc_Lexing_lexbuf* %0) {
%2 = alloca %struct.Cyc_Lexing_lexbuf*
%3 = alloca i32
store %struct.Cyc_Lexing_lexbuf* %0, %struct.Cyc_Lexing_lexbuf** %2
%4 = load %struct.Cyc_Lexing_lexbuf*, %struct.Cyc_Lexing_lexbuf** %2
%5 = call i32 @Cyc_asmtok_rec(%struct.Cyc_Lexing_lexbuf* %4, i32 7)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
%struct.Cyc_Lexing_lexbuf = type { i32 }
define i32 @Cyc_asmtok(%struct.Cyc_Lexing_lexbuf* %0) {
%2 = tail call i32 @Cyc_asmtok_rec(%struct.Cyc_Lexing_lexbuf* %0, i32 7)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, size_t);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *l9p_malloc(size_t size) {
  void *r = malloc(size);
  if (r == NULL) {
    fprintf(stderr, "cannot allocate %zd bytes: out of memory\n", size);
    abort();
  }
  return (r);
}


x86 assembly (clang, -O0):
<l9p_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1174 <l9p_malloc+0x44>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe98(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<l9p_malloc>:
push   %rbx
mov    %rdi,%rbx
call   1050 <malloc@plt>
test   %rax,%rax
je     1140 <l9p_malloc+0x10>
pop    %rbx
ret
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [42 x i8] c"cannot allocate %zd bytes: out of memory\0A\00"
define i8* @l9p_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = load i64, i64* %2
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i64 %10)
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %1
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [42 x i8] c"cannot allocate %zd bytes: out of memory\0A\00"
define noalias i8* @l9p_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i64 %0)
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %1
ret i8* %2
}
void *memset4(void *s, int c) { return __builtin_memset(s, c, 256); }


x86 assembly (clang, -O0):
<memset4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    %rdi,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x100,%edx
movzbl %al,%esi
call   1030 <memset@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memset4>:
mov    %rdi,%rax
movd   %esi,%xmm0
punpcklbw %xmm0,%xmm0
pshuflw $0x0,%xmm0,%xmm0
pshufd $0x0,%xmm0,%xmm0
movdqu %xmm0,0xf0(%rdi)
movdqu %xmm0,0xe0(%rdi)
movdqu %xmm0,0xd0(%rdi)
movdqu %xmm0,0xc0(%rdi)
movdqu %xmm0,0xb0(%rdi)
movdqu %xmm0,0xa0(%rdi)
movdqu %xmm0,0x90(%rdi)
movdqu %xmm0,0x80(%rdi)
movdqu %xmm0,0x70(%rdi)
movdqu %xmm0,0x60(%rdi)
movdqu %xmm0,0x50(%rdi)
movdqu %xmm0,0x40(%rdi)
movdqu %xmm0,0x30(%rdi)
movdqu %xmm0,0x20(%rdi)
movdqu %xmm0,0x10(%rdi)
movdqu %xmm0,(%rdi)
ret

LLVM IR (-O0):
define i8* @memset4(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = trunc i32 %6 to i8
ret i8* %5
}

LLVM IR (-O2):
define i8* @memset4(i8* returned writeonly %0, i32 %1) {
%3 = trunc i32 %1 to i8
tail call void @llvm.memset.p0i8.i64(i8* align 1 dereferenceable(256) %0, i8 %3, i64 256, i1 false)
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ spiReadRegister(int);
void rfmClearIntStatus(void) {
  spiReadRegister(0x03);
  spiReadRegister(0x04);
}


x86 assembly (clang, -O0):
<rfmClearIntStatus>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1030 <spiReadRegister@plt>
mov    $0x4,%edi
call   1030 <spiReadRegister@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rfmClearIntStatus>:
push   %rax
mov    $0x3,%edi
call   1030 <spiReadRegister@plt>
mov    $0x4,%edi
pop    %rax
jmp    1030 <spiReadRegister@plt>

LLVM IR (-O0):
define void @rfmClearIntStatus() {
%1 = call i32 @spiReadRegister(i32 3)
%2 = call i32 @spiReadRegister(i32 4)
ret void
}

LLVM IR (-O2):
define void @rfmClearIntStatus() {
%1 = tail call i32 @spiReadRegister(i32 3)
%2 = tail call i32 @spiReadRegister(i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ptr();
int main(void) {
  ptr();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <ptr@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @ptr()
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t get_uint16_be(const uint8_t *buf) {
  uint16_t res;
  res = buf[0] << 8 | buf[1];
  return res;
}


x86 assembly (clang, -O0):
<get_uint16_be>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
or     0x4(%rcx),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_uint16_be>:
mov    (%rdi),%eax
shl    $0x8,%eax
or     0x4(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @get_uint16_be(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 0
%6 = load i32, i32* %5
%7 = shl i32 %6, 8
%8 = load i32*, i32** %2
%9 = getelementptr inbounds i32, i32* %8, i64 1
%10 = load i32, i32* %9
%11 = or i32 %7, %10
store i32 %11, i32* %3
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @get_uint16_be(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 8
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = or i32 %3, %5
ret i32 %6
}
void do_something_exit(void) { pr_alert("%s", __func__); }


x86 assembly (clang, -O0):
<do_something_exit>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee1(%rip),%rsi
mov    $0x0,%al
call   1030 <pr_alert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_something_exit>:
lea    0xee9(%rip),%rdi
lea    0xee5(%rip),%rsi
xor    %eax,%eax
jmp    1030 <pr_alert@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@__func__.do_something_exit = [18 x i8] c"do_something_exit\00"
define void @do_something_exit() {
%1 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @pr_alert to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__func__.do_something_exit, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@__func__.do_something_exit = [18 x i8] c"do_something_exit\00"
define void @do_something_exit() {
%1 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @pr_alert to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__func__.do_something_exit, i64 0, i64 0))
ret void
}
int main() { return 12; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0xc,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 12
}
void etm_configure_registers(void) {
  (*((volatile unsigned *)0xE0041FB0)) = 0xC5ACCE55;
  (*((volatile unsigned *)0xE0041000)) &= ~(0x1u);
  (*((volatile unsigned *)0xE0043000u)) |= 0x1u;
  (*((volatile unsigned *)0xE0080014u)) &= (~0x10u);
}


x86 assembly (clang, -O0):
<etm_configure_registers>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe0041fb0,%eax
movl   $0xc5acce55,(%rax)
mov    $0xe0041000,%eax
mov    (%rax),%ecx
and    $0xfffffffe,%ecx
mov    $0xe0041000,%eax
mov    %ecx,(%rax)
mov    $0xe0043000,%eax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    $0xe0043000,%eax
mov    %ecx,(%rax)
mov    $0xe0080014,%eax
mov    (%rax),%ecx
and    $0xffffffef,%ecx
mov    $0xe0080014,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<etm_configure_registers>:
mov    $0xe0041000,%eax
movl   $0xc5acce55,0xfb0(%rax)
ce ac c5
andl   $0xfffffffe,(%rax)
orl    $0x1,0x2000(%rax)
andl   $0xffffffef,0x3f014(%rax)
ret

LLVM IR (-O0):
define void @etm_configure_registers() {
store volatile i32 -978530731, i32* inttoptr (i64 3758366640 to i32*)
%1 = load volatile i32, i32* inttoptr (i64 3758362624 to i32*)
%2 = and i32 %1, -2
store volatile i32 %2, i32* inttoptr (i64 3758362624 to i32*)
%3 = load volatile i32, i32* inttoptr (i64 3758370816 to i32*)
%4 = or i32 %3, 1
store volatile i32 %4, i32* inttoptr (i64 3758370816 to i32*)
%5 = load volatile i32, i32* inttoptr (i64 3758620692 to i32*)
%6 = and i32 %5, -17
store volatile i32 %6, i32* inttoptr (i64 3758620692 to i32*)
ret void
}

LLVM IR (-O2):
define void @etm_configure_registers() {
store volatile i32 -978530731, i32* inttoptr (i64 3758366640 to i32*)
%1 = load volatile i32, i32* inttoptr (i64 3758362624 to i32*)
%2 = and i32 %1, -2
store volatile i32 %2, i32* inttoptr (i64 3758362624 to i32*)
%3 = load volatile i32, i32* inttoptr (i64 3758370816 to i32*)
%4 = or i32 %3, 1
store volatile i32 %4, i32* inttoptr (i64 3758370816 to i32*)
%5 = load volatile i32, i32* inttoptr (i64 3758620692 to i32*)
%6 = and i32 %5, -17
store volatile i32 %6, i32* inttoptr (i64 3758620692 to i32*)
ret void
}
void task_led_marquee_exit(void *task) {}


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

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

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

LLVM IR (-O2):
define void @task_led_marquee_exit(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void closeSocket(int socketFd) {
  if (socketFd != -1) {
    close(socketFd);
  }
}


x86 assembly (clang, -O0):
<closeSocket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
je     112d <closeSocket+0x1d>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<closeSocket>:
cmp    $0xffffffff,%edi
je     111a <closeSocket+0xa>
jmp    1030 <close@plt>
ret

LLVM IR (-O0):
define void @closeSocket(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, -1
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = call i32 @close(i32 %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @closeSocket(i32 %0) {
%2 = icmp eq i32 %0, -1
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @close(i32 %0)
br label %5
5: ; preds = %3, %1
ret void
}
unsigned char uchar_clamp(double clr, unsigned char max) {
  unsigned short result;
  result = (unsigned short)(short)(clr + 0.5);
  if (result > max) {
    result = (clr < 0) ? 0 : max;
  }
  return result;
}


x86 assembly (clang, -O0):
<uchar_clamp>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
movsd  %xmm0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xee4(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %ax,-0xc(%rbp)
movzwl -0xc(%rbp),%eax
movzbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jle    115e <uchar_clamp+0x5e>
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1150 <uchar_clamp+0x50>
xor    %eax,%eax
mov    %eax,-0x10(%rbp)
jmp    1157 <uchar_clamp+0x57>
movzbl -0x9(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %ax,-0xc(%rbp)
mov    -0xc(%rbp),%ax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uchar_clamp>:
movsd  0xef8(%rip),%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%ecx
xor    %eax,%eax
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
cmovbe %edi,%eax
cmp    %di,%cx
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define zeroext i8 @uchar_clamp(double %0, i8 zeroext %1) {
%3 = alloca double
%4 = alloca i8
%5 = alloca i16
store double %0, double* %3
store i8 %1, i8* %4
%6 = load double, double* %3
%7 = fadd double %6, 5.000000e-01
%8 = fptosi double %7 to i16
store i16 %8, i16* %5
%9 = load i16, i16* %5
%10 = zext i16 %9 to i32
%11 = load i8, i8* %4
%12 = zext i8 %11 to i32
%13 = icmp sgt i32 %10, %12
br i1 %13, label %14, label %24
14: ; preds = %2
%15 = load double, double* %3
%16 = fcmp olt double %15, 0.000000e+00
br i1 %16, label %17, label %18
17: ; preds = %14
br label %21
18: ; preds = %14
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
br label %21
21: ; preds = %18, %17
%22 = phi i32 [ 0, %17 ], [ %20, %18 ]
%23 = trunc i32 %22 to i16
store i16 %23, i16* %5
br label %24
24: ; preds = %21, %2
%25 = load i16, i16* %5
%26 = trunc i16 %25 to i8
ret i8 %26
}

LLVM IR (-O2):
define zeroext i8 @uchar_clamp(double %0, i8 zeroext %1) {
%3 = fadd double %0, 5.000000e-01
%4 = fptosi double %3 to i16
%5 = zext i8 %1 to i16
%6 = icmp ugt i16 %4, %5
%7 = fcmp olt double %0, 0.000000e+00
%8 = select i1 %7, i16 0, i16 %5
%9 = select i1 %6, i16 %8, i16 %4
%10 = trunc i16 %9 to i8
ret i8 %10
}
/* Variables and functions */
int /*<<< orphan*/ fatal_error(int /*<<< orphan*/, char *, char *, int);
void _invalid_case(char *fn, int line) {
  fatal_error(0, "Invalid case in switch statement, file %s, line %d", fn,
              line);
}


x86 assembly (clang, -O0):
<_invalid_case>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
xor    %edi,%edi
lea    0xed1(%rip),%rsi
call   1030 <fatal_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_invalid_case>:
mov    %esi,%ecx
mov    %rdi,%rdx
lea    0xee4(%rip),%rsi
xor    %edi,%edi
jmp    1030 <fatal_error@plt>

LLVM IR (-O0):
@.str = [51 x i8] c"Invalid case in switch statement, file %s, line %d\00"
define void @_invalid_case(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @fatal_error(i32 0, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [51 x i8] c"Invalid case in switch statement, file %s, line %d\00"
define void @_invalid_case(i8* %0, i32 %1) {
%3 = tail call i32 @fatal_error(i32 0, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo(int);
void bar(void) { foo(3); }


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

x86 assembly (clang, -O2):
<bar>:
mov    $0x3,%edi
jmp    1030 <foo@plt>

LLVM IR (-O0):
define void @bar() {
%1 = call i32 @foo(i32 3)
ret void
}

LLVM IR (-O2):
define void @bar() {
%1 = tail call i32 @foo(i32 3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pem_password_cb;
typedef int /*<<< orphan*/ d2i_of_void;
typedef int /*<<< orphan*/ DSA;
typedef int /*<<< orphan*/ BIO;

/* Variables and functions */
int /*<<< orphan*/ *PEM_ASN1_read_bio(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                      int /*<<< orphan*/ *, void **,
                                      int /*<<< orphan*/ *, void *);
int /*<<< orphan*/ PEM_STRING_DSAPARAMS;
scalar_t__ d2i_DSAparams;
DSA *PEM_read_bio_DSAparams(BIO *bp, DSA **x, pem_password_cb *cb, void *u) {
  return PEM_ASN1_read_bio((d2i_of_void *)d2i_DSAparams, PEM_STRING_DSAPARAMS,
                           bp, (void **)x, cb, u);
}


x86 assembly (clang, -O0):
<PEM_read_bio_DSAparams>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2eb1(%rip),%rax
mov    (%rax),%rdi
mov    0x2eb7(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
call   1030 <PEM_ASN1_read_bio@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PEM_read_bio_DSAparams>:
mov    %rcx,%r9
mov    %rdx,%r8
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    0x2ebd(%rip),%rax
mov    (%rax),%rdi
mov    0x2ec3(%rip),%rax
mov    (%rax),%esi
jmp    1030 <PEM_ASN1_read_bio@plt>

LLVM IR (-O0):
@d2i_DSAparams = global i64 0
@PEM_STRING_DSAPARAMS = global i32 0
define i32* @PEM_read_bio_DSAparams(i32* %0, i32** %1, i32* %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32**
%7 = alloca i32*
%8 = alloca i8*
store i32* %0, i32** %5
store i32** %1, i32*** %6
store i32* %2, i32** %7
store i8* %3, i8** %8
%9 = load i64, i64* @d2i_DSAparams
%10 = inttoptr i64 %9 to i32*
%11 = load i32, i32* @PEM_STRING_DSAPARAMS
%12 = load i32*, i32** %5
%13 = load i32**, i32*** %6
%14 = bitcast i32** %13 to i8**
%15 = load i32*, i32** %7
%16 = load i8*, i8** %8
%17 = call i32* @PEM_ASN1_read_bio(i32* %10, i32 %11, i32* %12, i8** %14, i32* %15, i8* %16)
ret i32* %17
}

LLVM IR (-O2):
@d2i_DSAparams = global i64 0
@PEM_STRING_DSAPARAMS = global i32 0
define i32* @PEM_read_bio_DSAparams(i32* %0, i32** %1, i32* %2, i8* %3) {
%5 = load i64, i64* @d2i_DSAparams
%6 = inttoptr i64 %5 to i32*
%7 = load i32, i32* @PEM_STRING_DSAPARAMS
%8 = bitcast i32** %1 to i8**
%9 = tail call i32* @PEM_ASN1_read_bio(i32* %6, i32 %7, i32* %0, i8** %8, i32* %2, i8* %3)
ret i32* %9
}