#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
void prbig(int *x) {
  int a, l;
  char s[8];
  sprintf(s, "%%0%dd", 1);
  printf("%d", x[x[0]]);
  for (a = x[0] - 1; a >= 1; a--)
    printf(s, x[a]);
}


x86 assembly (clang, -O0):
<prbig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x18(%rbp),%rdi
lea    0xec9(%rip),%rsi
mov    $0x1,%edx
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jl     1193 <prbig+0x73>
lea    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1167 <prbig+0x47>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prbig>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r15
lea    0xecd(%rip),%rsi
lea    0x8(%rsp),%rdi
mov    $0x1,%edx
call   1040 <sprintf@plt>
movslq (%r15),%rax
mov    (%r15,%rax,4),%esi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
mov    (%r15),%ebx
cmp    $0x2,%ebx
jl     1189 <prbig+0x69>
add    $0x1,%rbx
lea    0x8(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
lea    -0x2(%rbx),%eax
mov    (%r15,%rax,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x2,%rbx
ja     1170 <prbig+0x50>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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