#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
void prbig(int *x, FILE *fp) {
  int a;
  fprintf(fp, "%d", x[x[0]]);
  for (a = x[0] - 1; a >= 1; a--)
    fprintf(fp, "%d", x[a]);
}


x86 assembly (clang, -O0):
<prbig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xec7(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jl     117d <prbig+0x6d>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe96(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    114a <prbig+0x3a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prbig>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
movslq (%rdi),%rax
mov    (%rdi,%rax,4),%edx
lea    0xed5(%rip),%rsi
mov    %r14,%rdi
call   1030 <fprintf@plt>
mov    (%r12),%ebx
cmp    $0x2,%ebx
jl     116c <prbig+0x5c>
add    $0x1,%rbx
lea    0xeb9(%rip),%r15
nopw   0x0(%rax,%rax,1)
lea    -0x2(%rbx),%eax
mov    (%r12,%rax,4),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <fprintf@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x2,%rbx
ja     1150 <prbig+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @prbig(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %4
%7 = load i32*, i32** %3
%8 = load i32*, i32** %3
%9 = getelementptr inbounds i32, i32* %8, i64 0
%10 = load i32, i32* %9
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %7, i64 %11
%13 = load i32, i32* %12
%14 = call i32 @fprintf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = load i32*, i32** %3
%16 = getelementptr inbounds i32, i32* %15, i64 0
%17 = load i32, i32* %16
%18 = sub nsw i32 %17, 1
store i32 %18, i32* %5
br label %19
19: ; preds = %30, %2
%20 = load i32, i32* %5
%21 = icmp sge i32 %20, 1
br i1 %21, label %22, label %33
22: ; preds = %19
%23 = load i32*, i32** %4
%24 = load i32*, i32** %3
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %24, i64 %26
%28 = load i32, i32* %27
%29 = call i32 @fprintf(i32* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %22
%31 = load i32, i32* %5
%32 = add nsw i32 %31, -1
store i32 %32, i32* %5
br label %19
33: ; preds = %19
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @prbig(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %0
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %20
10: ; preds = %2
%11 = zext i32 %8 to i64
br label %12
12: ; preds = %10, %12
%13 = phi i64 [ %11, %10 ], [ %14, %12 ]
%14 = add nsw i64 %13, -1
%15 = and i64 %14, 4294967295
%16 = getelementptr inbounds i32, i32* %0, i64 %15
%17 = load i32, i32* %16
%18 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = icmp ugt i64 %13, 2
br i1 %19, label %12, label %20
20: ; preds = %12, %2
ret void
}