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

/* Variables and functions */
int /*<<< orphan*/ display_array2(int *, int);
int main(void) {
  int vector[] = {1, 2, 3, 7, 2, 1, 2, 7};
  display_array2(vector, (int)(sizeof(vector) / sizeof((vector)[0])));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed1(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x8,%esi
call   1030 <display_array2@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xef5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x8,%esi
call   1030 <display_array2@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.vector = [8 x i32] [i32 1, i32 2, i32 3, i32 7, i32 2, i32 1, i32 2, i32 7]
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i32]
store i32 0, i32* %1
%3 = bitcast [8 x i32]* %2 to i8*
%4 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%5 = call i32 @display_array2(i32* %4, i32 8)
ret i32 0
}

LLVM IR (-O2):
@__const.main.vector = [8 x i32] [i32 1, i32 2, i32 3, i32 7, i32 2, i32 1, i32 2, i32 7]
define i32 @main() {
%1 = alloca [8 x i32]
%2 = bitcast [8 x i32]* %1 to i8*
%3 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%4 = call i32 @display_array2(i32* %3, i32 8)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ PutData(char *, int);
int main(void) {
  char buf[256];
  PutData(buf, sizeof(buf));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x110(%rbp),%rdi
mov    $0x100,%esi
call   1030 <PutData@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x108,%rsp
mov    %rsp,%rdi
mov    $0x100,%esi
call   1030 <PutData@plt>
xor    %eax,%eax
add    $0x108,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = call i32 @PutData(i8* %3, i32 256)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @PutData(i8* %2, i32 256)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, char *);
char *strrev(char *);
int main() {
  char message[100];
  scanf("%s", message);
  printf("%s", strrev(message));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x70(%rbp),%rsi
lea    0xebd(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x70(%rbp),%rdi
call   1050 <strrev@plt>
mov    %rax,%rsi
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x68,%rsp
lea    0xec2(%rip),%r14
mov    %rsp,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1050 <strrev@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = call i8* @strrev(i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i8* @strrev(i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}
long long szss() { return 0xffff0000ffffffffLL; }


x86 assembly (clang, -O0):
<szss>:
push   %rbp
mov    %rsp,%rbp
movabs $0xffff0000ffffffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<szss>:
movabs $0xffff0000ffffffff,%rax
ret

LLVM IR (-O0):
define i64 @szss() {
ret i64 -281470681743361
}

LLVM IR (-O2):
define i64 @szss() {
ret i64 -281470681743361
}
/* Variables and functions */
int /*<<< orphan*/ printt();
int main(int argc, char *argv[]) {
  printt();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @printt()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @printt()
ret i32 0
}
char getOverflowflag(char flags[]) { return flags[8 - 7]; }


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

x86 assembly (clang, -O2):
<getOverflowflag>:
mov    0x1(%rdi),%al
ret

LLVM IR (-O0):
define signext i8 @getOverflowflag(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %4
ret i8 %5
}

LLVM IR (-O2):
define signext i8 @getOverflowflag(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %2
ret i8 %3
}
int main() {
  int firstnum, secondnum;
  float price, yield;
  double maturity;
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca float
%6 = alloca double
store i32 0, i32* %1
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int md_getgeo(struct block_device *bdev, struct hd_geometry *geo) {
  int a;
  return a;
}


x86 assembly (clang, -O0):
<md_getgeo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.block_device = type opaque
%struct.hd_geometry = type opaque
define i32 @md_getgeo(%struct.block_device* %0, %struct.hd_geometry* %1) {
%3 = alloca %struct.block_device*
%4 = alloca %struct.hd_geometry*
%5 = alloca i32
store %struct.block_device* %0, %struct.block_device** %3
store %struct.hd_geometry* %1, %struct.hd_geometry** %4
%6 = load i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
%struct.block_device = type opaque
%struct.hd_geometry = type opaque
define i32 @md_getgeo(%struct.block_device* nocapture readnone %0, %struct.hd_geometry* nocapture readnone %1) {
ret i32 undef
}
void local_init() {}


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

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

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

LLVM IR (-O2):
define void @local_init() {
ret void
}
int floatCompare(i, j)
float *i, *j;
{ return ((*i <= *j) ? -1 : 1); }


x86 assembly (clang, -O0):
<floatCompare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    $0x1,%eax
mov    $0xffffffff,%ecx
ucomiss %xmm1,%xmm0
cmovae %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<floatCompare>:
movss  (%rsi),%xmm0
xor    %eax,%eax
ucomiss (%rdi),%xmm0
setb   %al
add    %eax,%eax
add    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @floatCompare(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %3
%6 = load float, float* %5
%7 = load float*, float** %4
%8 = load float, float* %7
%9 = fcmp ole float %6, %8
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 -1, i32 1
ret i32 %11
}

LLVM IR (-O2):
define i32 @floatCompare(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = load float, float* %1
%5 = fcmp ole float %3, %4
%6 = select i1 %5, i32 -1, i32 1
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ error(int /*<<< orphan*/, int /*<<< orphan*/, char *,
                         char const *);
void syntax_error(const char *message) {
  error(0, 0, "Syntax error: %s", message);
}


x86 assembly (clang, -O0):
<syntax_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
xor    %esi,%esi
lea    0xed7(%rip),%rdx
mov    %esi,%edi
call   1030 <error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<syntax_error>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdx
xor    %edi,%edi
xor    %esi,%esi
jmp    1030 <error@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"Syntax error: %s\00"
define void @syntax_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @error(i32 0, i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"Syntax error: %s\00"
define void @syntax_error(i8* %0) {
%2 = tail call i32 @error(i32 0, i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int f7(int x) {
#pragma omp declare simd simdlen(8) aligned(b : 8 * sizeof(int))
  extern int f8(int a, int *b, int c);
  return x;
}


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

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

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

LLVM IR (-O2):
define i32 @f7(i32 returned %0) {
ret i32 %0
}
void mbc2_ram_wr(int val) {}


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

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

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

LLVM IR (-O2):
define void @mbc2_ram_wr(i32 %0) {
ret void
}
int param_set_int(const char *val, struct kernel_param *kp) { return 0; }


x86 assembly (clang, -O0):
<param_set_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.kernel_param = type opaque
define i32 @param_set_int(i8* %0, %struct.kernel_param* %1) {
%3 = alloca i8*
%4 = alloca %struct.kernel_param*
store i8* %0, i8** %3
store %struct.kernel_param* %1, %struct.kernel_param** %4
ret i32 0
}

LLVM IR (-O2):
%struct.kernel_param = type opaque
define i32 @param_set_int(i8* nocapture readnone %0, %struct.kernel_param* nocapture readnone %1) {
ret i32 0
}
/* Type definitions */
struct obstack {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ obstack_free(struct obstack *, void *);
__attribute__((__weak__, __always___)) void
softboundmpx_obstack_free(struct obstack *obj, void *object) {
  obstack_free(obj, object);
}


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

x86 assembly (clang, -O2):
<softboundmpx_obstack_free>:
jmp    1030 <obstack_free@plt>

LLVM IR (-O0):
%struct.obstack = type { i32 }
define weak void @softboundmpx_obstack_free(%struct.obstack* %0, i8* %1) {
%3 = alloca %struct.obstack*
%4 = alloca i8*
store %struct.obstack* %0, %struct.obstack** %3
store i8* %1, i8** %4
%5 = load %struct.obstack*, %struct.obstack** %3
%6 = load i8*, i8** %4
%7 = call i32 @obstack_free(%struct.obstack* %5, i8* %6)
ret void
}

LLVM IR (-O2):
%struct.obstack = type { i32 }
define weak void @softboundmpx_obstack_free(%struct.obstack* %0, i8* %1) {
%3 = tail call i32 @obstack_free(%struct.obstack* %0, i8* %1)
ret void
}
/* Variables and functions */
int strlen(char *);
char tolower(char);
void mklower(char *sx) {
  int len, k;
  len = strlen(sx);
  for (k = 0; k < len; ++k) {
    sx[k] = tolower(sx[k]);
  }
}


x86 assembly (clang, -O0):
<mklower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1177 <mklower+0x57>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <tolower@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113f <mklower+0x1f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mklower>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
call   1030 <strlen@plt>
test   %eax,%eax
jle    1157 <mklower+0x37>
mov    %eax,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%edi
call   1040 <tolower@plt>
mov    %al,(%r15,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1140 <mklower+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @mklower(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = zext i32 %2 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = tail call signext i8 @tolower(i8 signext %9)
store i8 %10, i8* %8
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %1
ret void
}
int indexof(char str[], char target) {
  int i = 0;
  char c;
  while ((c = str[i++]) != '\0')
    if (c == target)
      return c;
  return -1;
}


x86 assembly (clang, -O0):
<indexof>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x19(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     115a <indexof+0x5a>
movsbl -0x19(%rbp),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    1155 <indexof+0x55>
movsbl -0x19(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1161 <indexof+0x61>
jmp    1115 <indexof+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<indexof>:
movzbl (%rdi),%eax
test   %al,%al
je     1115 <indexof+0x15>
add    $0x1,%rdi
cmp    %sil,%al
jne    1100 <indexof>
movsbl %sil,%eax
ret
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @indexof(i8* nocapture %0, i8 signext %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i64 [ %9, %8 ], [ 0, %2 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = add nuw i64 %4, 1
%10 = icmp eq i8 %6, %1
br i1 %10, label %11, label %3
11: ; preds = %8
%12 = sext i8 %1 to i32
br label %13
13: ; preds = %3, %11
%14 = phi i32 [ %12, %11 ], [ -1, %3 ]
ret i32 %14
}
void sigsegv_reset_onstack_flag(void) {}


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

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

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

LLVM IR (-O2):
define void @sigsegv_reset_onstack_flag() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ green(char *);
int /*<<< orphan*/ printColor(int /*<<< orphan*/);
void cmGreen(char *str) { printColor(green(str)); }


x86 assembly (clang, -O0):
<cmGreen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <green@plt>
mov    %eax,%edi
call   1040 <printColor@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmGreen>:
push   %rax
call   1030 <green@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <printColor@plt>

LLVM IR (-O0):
define void @cmGreen(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @green(i8* %3)
%5 = call i32 @printColor(i32 %4)
ret void
}

LLVM IR (-O2):
define void @cmGreen(i8* %0) {
%2 = tail call i32 @green(i8* %0)
%3 = tail call i32 @printColor(i32 %2)
ret void
}
int check_nth_bit(unsigned int num, int n) { return (num >> (n - 1)) & 1; }


x86 assembly (clang, -O0):
<check_nth_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
shr    %cl,%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_nth_bit>:
mov    %edi,%eax
lea    -0x1(%rsi),%ecx
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @check_nth_bit(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = sub nsw i32 %6, 1
%8 = lshr i32 %5, %7
%9 = and i32 %8, 1
ret i32 %9
}

LLVM IR (-O2):
define i32 @check_nth_bit(i32 %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = lshr i32 %0, %3
%5 = and i32 %4, 1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_help() { fprintf(stderr, "usage: bfc <filename>\n"); }


x86 assembly (clang, -O0):
<print_help>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_help>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"usage: bfc <filename>\0A\00"
define void @print_help() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"usage: bfc <filename>\0A\00"
define void @print_help() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *doubleToString(scalar_t__);
scalar_t__ parseNum(char *, int);
char *wum_sub(char *a, char *b) {
  return doubleToString((parseNum(a, 10) - parseNum(b, 10)));
}


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

x86 assembly (clang, -O2):
<wum_sub>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    $0xa,%esi
call   1030 <parseNum@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0xa,%esi
call   1030 <parseNum@plt>
sub    %rax,%rbx
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <doubleToString@plt>

LLVM IR (-O0):
define i8* @wum_sub(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 = call i64 @parseNum(i8* %5, i32 10)
%7 = load i8*, i8** %4
%8 = call i64 @parseNum(i8* %7, i32 10)
%9 = sub nsw i64 %6, %8
%10 = call i8* @doubleToString(i64 %9)
ret i8* %10
}

LLVM IR (-O2):
define i8* @wum_sub(i8* %0, i8* %1) {
%3 = tail call i64 @parseNum(i8* %0, i32 10)
%4 = tail call i64 @parseNum(i8* %1, i32 10)
%5 = sub nsw i64 %3, %4
%6 = tail call i8* @doubleToString(i64 %5)
ret i8* %6
}
int shr1_local(x)
int x;
{ return 2 * x; }


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

x86 assembly (clang, -O2):
<shr1_local>:
lea    (%rdi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @shr1_local(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
stop(int sig) {
  fprintf(stdout, "Processus Utilisateur arrété\n");
  exit(0);
}


x86 assembly (clang, -O0):
<stop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@stdout = global i32 0
@.str = [32 x i8] c"Processus Utilisateur arr\C3\A9t\C3\A9\0A\00"
define i32 @stop(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stdout
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [32 x i8] c"Processus Utilisateur arr\C3\A9t\C3\A9\0A\00"
define i32 @stop(i32 %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
struct lifo {
  int dummy;
};

/* Variables and functions */
double erfc(double);
double pop(struct lifo *);
double opr_erfc(struct lifo *stack) {
  double op = pop(stack);
  return erfc(op);
}


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

x86 assembly (clang, -O2):
<opr_erfc>:
push   %rax
call   1030 <pop@plt>
pop    %rax
jmp    1040 <erfc@plt>

LLVM IR (-O0):
%struct.lifo = type { i32 }
define double @opr_erfc(%struct.lifo* %0) {
%2 = alloca %struct.lifo*
%3 = alloca double
store %struct.lifo* %0, %struct.lifo** %2
%4 = load %struct.lifo*, %struct.lifo** %2
%5 = call double @pop(%struct.lifo* %4)
store double %5, double* %3
%6 = load double, double* %3
%7 = call double @erfc(double %6)
ret double %7
}

LLVM IR (-O2):
%struct.lifo = type { i32 }
define double @opr_erfc(%struct.lifo* %0) {
%2 = tail call double @pop(%struct.lifo* %0)
%3 = tail call double @erfc(double %2)
ret double %3
}
unsigned int BWTResidentSizeInWord(const unsigned int numChar) {
  unsigned int numCharRoundUpToOccInterval;
  numCharRoundUpToOccInterval = (numChar + 256 - 1) / 256 * 256;
  return (numCharRoundUpToOccInterval + 16 - 1) / 16;
}


x86 assembly (clang, -O0):
<BWTResidentSizeInWord>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x100,%eax
sub    $0x1,%eax
shr    $0x8,%eax
shl    $0x8,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%eax
sub    $0x1,%eax
shr    $0x4,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BWTResidentSizeInWord>:
lea    0xff(%rdi),%eax
shr    $0x4,%eax
and    $0xfffffff0,%eax
ret

LLVM IR (-O0):
define i32 @BWTResidentSizeInWord(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = add i32 %4, 256
%6 = sub i32 %5, 1
%7 = udiv i32 %6, 256
%8 = mul i32 %7, 256
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = add i32 %9, 16
%11 = sub i32 %10, 1
%12 = udiv i32 %11, 16
ret i32 %12
}

LLVM IR (-O2):
define i32 @BWTResidentSizeInWord(i32 %0) {
%2 = add i32 %0, 255
%3 = lshr i32 %2, 4
%4 = and i32 %3, 268435440
ret i32 %4
}
/* Type definitions */
struct plainstring {
  int dummy;
};

/* Variables and functions */
struct plainstring *plainstring_new();
int /*<<< orphan*/ plainstring_set_char(struct plainstring *, char);
struct plainstring *plainstring_new_char(char c) {
  struct plainstring *str = plainstring_new();
  if (!str)
    return str;
  plainstring_set_char(str, c);
  return str;
}


x86 assembly (clang, -O0):
<plainstring_new_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x9(%rbp)
mov    $0x0,%al
call   1030 <plainstring_new@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1151 <plainstring_new_char+0x31>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1166 <plainstring_new_char+0x46>
mov    -0x18(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   1040 <plainstring_set_char@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plainstring_new_char>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <plainstring_new@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1140 <plainstring_new_char+0x20>
movsbl %bpl,%esi
mov    %rbx,%rdi
call   1040 <plainstring_set_char@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.plainstring = type { i32 }
define %struct.plainstring* @plainstring_new_char(i8 signext %0) {
%2 = alloca %struct.plainstring*
%3 = alloca i8
%4 = alloca %struct.plainstring*
store i8 %0, i8* %3
%5 = call %struct.plainstring* (...) @plainstring_new()
store %struct.plainstring* %5, %struct.plainstring** %4
%6 = load %struct.plainstring*, %struct.plainstring** %4
%7 = icmp ne %struct.plainstring* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = load %struct.plainstring*, %struct.plainstring** %4
store %struct.plainstring* %9, %struct.plainstring** %2
br label %15
10: ; preds = %1
%11 = load %struct.plainstring*, %struct.plainstring** %4
%12 = load i8, i8* %3
%13 = call i32 @plainstring_set_char(%struct.plainstring* %11, i8 signext %12)
%14 = load %struct.plainstring*, %struct.plainstring** %4
store %struct.plainstring* %14, %struct.plainstring** %2
br label %15
15: ; preds = %10, %8
%16 = load %struct.plainstring*, %struct.plainstring** %2
ret %struct.plainstring* %16
}

LLVM IR (-O2):
%struct.plainstring = type { i32 }
define %struct.plainstring* @plainstring_new_char(i8 signext %0) {
%2 = tail call %struct.plainstring* (...) @plainstring_new()
%3 = icmp eq %struct.plainstring* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @plainstring_set_char(%struct.plainstring* %2, i8 signext %0)
br label %6
6: ; preds = %1, %4
ret %struct.plainstring* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ cmovznz(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
uint64_t cmovznz64(uint64_t t, uint64_t z, uint64_t nz) {
  return cmovznz(t, z, nz);
}


x86 assembly (clang, -O0):
<cmovznz64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <cmovznz@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmovznz64>:
jmp    1030 <cmovznz@plt>

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

LLVM IR (-O2):
define i32 @cmovznz64(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @cmovznz(i32 %0, i32 %1, i32 %2)
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void configureBlePatch(void) {
  uint8_t *pPatchTab = (uint8_t *)(0x21000000 + 0x033C);
  uint32_t *pIrqPatch = (uint32_t *)(0x21000000 + 0x03AC);
  pPatchTab[103] = 0;
  pPatchTab[60] = 1;
  pPatchTab[48] = 2;
  pIrqPatch[1] = 0x21000411;
  pIrqPatch[9] = 0x21000451;
}


x86 assembly (clang, -O0):
<configureBlePatch>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2100033c,%eax
mov    %rax,-0x8(%rbp)
mov    $0x210003ac,%eax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,0x19c(%rax)
mov    -0x8(%rbp),%rax
movl   $0x1,0xf0(%rax)
mov    -0x8(%rbp),%rax
movl   $0x2,0xc0(%rax)
mov    -0x10(%rbp),%rax
movl   $0x21000411,0x4(%rax)
mov    -0x10(%rbp),%rax
movl   $0x21000451,0x24(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<configureBlePatch>:
movl   $0x0,0x210004d8
movl   $0x1,0x2100042c
movl   $0x2,0x210003fc
movl   $0x21000411,0x210003b0
movl   $0x21000451,0x210003d0
ret

LLVM IR (-O0):
define void @configureBlePatch() {
%1 = alloca i32*
%2 = alloca i32*
store i32* inttoptr (i64 553648956 to i32*), i32** %1
store i32* inttoptr (i64 553649068 to i32*), i32** %2
%3 = load i32*, i32** %1
%4 = getelementptr inbounds i32, i32* %3, i64 103
store i32 0, i32* %4
%5 = load i32*, i32** %1
%6 = getelementptr inbounds i32, i32* %5, i64 60
store i32 1, i32* %6
%7 = load i32*, i32** %1
%8 = getelementptr inbounds i32, i32* %7, i64 48
store i32 2, i32* %8
%9 = load i32*, i32** %2
%10 = getelementptr inbounds i32, i32* %9, i64 1
store i32 553649169, i32* %10
%11 = load i32*, i32** %2
%12 = getelementptr inbounds i32, i32* %11, i64 9
store i32 553649233, i32* %12
ret void
}

LLVM IR (-O2):
define void @configureBlePatch() {
store i32 0, i32* inttoptr (i64 553649368 to i32*)
store i32 1, i32* inttoptr (i64 553649196 to i32*)
store i32 2, i32* inttoptr (i64 553649148 to i32*)
store i32 553649169, i32* inttoptr (i64 553649072 to i32*)
store i32 553649233, i32* inttoptr (i64 553649104 to i32*)
ret void
}
int check_eeprom_9003(struct edump *edump) { return 1; }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    $0x1,%eax
ret

LLVM IR (-O0):
%struct.edump = type opaque
define i32 @check_eeprom_9003(%struct.edump* %0) {
%2 = alloca %struct.edump*
store %struct.edump* %0, %struct.edump** %2
ret i32 1
}

LLVM IR (-O2):
%struct.edump = type opaque
define i32 @check_eeprom_9003(%struct.edump* nocapture readnone %0) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ CA_ResetError();
void CA_Init() { CA_ResetError(); }


x86 assembly (clang, -O0):
<CA_Init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <CA_ResetError@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @CA_Init() {
%1 = call i32 (...) @CA_ResetError()
ret void
}

LLVM IR (-O2):
define void @CA_Init() {
%1 = tail call i32 (...) @CA_ResetError()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printIntArray(int *pdata, int length) {
  int i;
  for (i = 0; i < length; i++) {
    printf("%3d", *(pdata + i));
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printIntArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <printIntArray+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printIntArray+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printIntArray>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <printIntArray+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <printIntArray+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%3d\00"
define void @printIntArray(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
void setup_gpio(void) {
  *((volatile unsigned short *)0x4000134) = 0x8000 | (1 << 8);
}


x86 assembly (clang, -O0):
<setup_gpio>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4000134,%eax
movw   $0x8100,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup_gpio>:
movw   $0x8100,0x4000134
ret

LLVM IR (-O0):
define void @setup_gpio() {
store volatile i16 -32512, i16* inttoptr (i64 67109172 to i16*)
ret void
}

LLVM IR (-O2):
define void @setup_gpio() {
store volatile i16 -32512, i16* inttoptr (i64 67109172 to i16*)
ret void
}
char *langRomTypeGameReader() { return "Sunrise GameReader"; }


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

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

LLVM IR (-O0):
@.str = [19 x i8] c"Sunrise GameReader\00"
define i8* @langRomTypeGameReader() {
ret i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [19 x i8] c"Sunrise GameReader\00"
define i8* @langRomTypeGameReader() {
ret i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ fn2(int **);
void test() {
  int *p;
  fn2(&p);
  *p = 42;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
call   1030 <fn2@plt>
mov    -0x8(%rbp),%rax
movl   $0x2a,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
mov    %rsp,%rdi
call   1030 <fn2@plt>
mov    (%rsp),%rax
movl   $0x2a,(%rax)
pop    %rax
ret

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

LLVM IR (-O2):
define void @test() {
%1 = alloca i32*
%2 = bitcast i32** %1 to i8*
%3 = call i32 @fn2(i32** %1)
%4 = load i32*, i32** %1
store i32 42, i32* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, void *, void *);
void show_args(void *p1, void *p2) {
  printf("p1 = %p, p2 = %p\n", p1, p2);
  while (1)
    ;
}


x86 assembly (clang, -O0):
<show_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
jmp    1134 <show_args+0x24>

x86 assembly (clang, -O2):
<show_args>:
push   %rax
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
jmp    1130 <show_args+0x20>

LLVM IR (-O0):
@.str = [18 x i8] c"p1 = %p, p2 = %p\0A\00"
define void @show_args(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 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
br label %8
8: ; preds = %2, %8
br label %8
}

LLVM IR (-O2):
@.str = [18 x i8] c"p1 = %p, p2 = %p\0A\00"
define void @show_args(i8* %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
br label %4
4: ; preds = %2, %4
br label %4
}
void hcente_(i) int *i;
{ hcentertext(*i); }


x86 assembly (clang, -O0):
<hcente_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    $0x0,%al
call   1030 <hcentertext@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hcente_>:
mov    (%rdi),%edi
xor    %eax,%eax
jmp    1030 <hcentertext@plt>

LLVM IR (-O0):
define void @hcente_(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = call i32 (i32, ...) bitcast (i32 (...)* @hcentertext to i32 (i32, ...)*)(i32 %4)
ret void
}

LLVM IR (-O2):
define void @hcente_(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @hcentertext to i32 (i32, ...)*)(i32 %2)
ret void
}
int is_parenth(char c) { return (c == '(' || c == ')'); }


x86 assembly (clang, -O0):
<is_parenth>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x28,%ecx
mov    %al,-0x2(%rbp)
je     1129 <is_parenth+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x29,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_parenth>:
and    $0xfe,%dil
xor    %eax,%eax
cmp    $0x28,%dil
sete   %al
ret

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

LLVM IR (-O2):
define i32 @is_parenth(i8 signext %0) {
%2 = and i8 %0, -2
%3 = icmp eq i8 %2, 40
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ msg_exit(char *);
void *xmalloc(size_t size) {
  void *obj = malloc(size);
  if (!obj)
    msg_exit("out of memory");
  return obj;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1150 <xmalloc+0x30>
lea    0xeb5(%rip),%rdi
call   1030 <msg_exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <xmalloc+0x1a>
lea    0xecb(%rip),%rdi
call   1030 <msg_exit@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"out of memory\00"
define i8* @xmalloc(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 ne i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @msg_exit(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [14 x i8] c"out of memory\00"
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @msg_exit(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ SVCXPRT;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ svc_destroy(int /*<<< orphan*/ *);
int /*<<< orphan*/ *svcfd_create(int, int /*<<< orphan*/, int /*<<< orphan*/);
int main(void) {
  int test_status = 1;
  int fd = 0;
  SVCXPRT *svcr = NULL;
  svcr = svcfd_create(fd, 0, 0);
  if (svcr == NULL)
    return test_status;
  svc_destroy(svcr);
  test_status = 0;
  printf("%d\n", test_status);
  return test_status;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0xc(%rbp),%edi
xor    %edx,%edx
mov    %edx,%esi
call   1050 <svcfd_create@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    117b <main+0x4b>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a0 <main+0x70>
mov    -0x18(%rbp),%rdi
call   1040 <svc_destroy@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <svcfd_create@plt>
test   %rax,%rax
je     115b <main+0x2b>
mov    %rax,%rdi
call   1040 <svc_destroy@plt>
lea    0xeae(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
jmp    1160 <main+0x30>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32* @svcfd_create(i32 0, i32 0, i32 0)
%2 = icmp eq i32* %1, null
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i32 @svc_destroy(i32* %1)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
br label %6
6: ; preds = %0, %3
%7 = phi i32 [ 0, %3 ], [ 1, %0 ]
ret i32 %7
}
/* Type definitions */
typedef long clock_t;

/* Variables and functions */
int CLOCKS_PER_SEC;
long clock();
void delay(int milliseconds) {
  long pause;
  clock_t now, then;
  pause = milliseconds * (CLOCKS_PER_SEC / 1000);
  now = then = clock();
  while ((now - then) < pause) {
    now = clock();
  }
}


x86 assembly (clang, -O0):
<delay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    0x2ec0(%rip),%rax
mov    (%rax),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
imul   %ecx,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x20(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1171 <delay+0x61>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x18(%rbp)
jmp    114f <delay+0x3f>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delay>:
push   %r15
push   %r14
push   %rbx
mov    0x2ecc(%rip),%rax
movslq (%rax),%rax
imul   $0x10624dd3,%rax,%r14
mov    %r14,%rax
shr    $0x3f,%rax
sar    $0x26,%r14
add    %eax,%r14d
imul   %edi,%r14d
xor    %eax,%eax
call   1030 <clock@plt>
test   %r14d,%r14d
jle    115f <delay+0x4f>
mov    %rax,%r15
movslq %r14d,%rbx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <clock@plt>
sub    %r15,%rax
cmp    %rbx,%rax
jl     1150 <delay+0x40>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@CLOCKS_PER_SEC = global i32 0
define void @delay(i32 %0) {
%2 = load i32, i32* @CLOCKS_PER_SEC
%3 = sdiv i32 %2, 1000
%4 = mul nsw i32 %3, %0
%5 = sext i32 %4 to i64
%6 = tail call i64 (...) @clock()
%7 = icmp sgt i32 %4, 0
br i1 %7, label %8, label %12
8: ; preds = %1, %8
%9 = tail call i64 (...) @clock()
%10 = sub nsw i64 %9, %6
%11 = icmp slt i64 %10, %5
br i1 %11, label %8, label %12
12: ; preds = %8, %1
ret void
}