#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, ...);
void HighPrint(int x[3]) {
  if (x[2] == 0 && x[1] == 0) {
    printf("%d \n", x[0]);
  } else if (x[2] == 0) {
    printf("%d%04d \n", x[1], x[0]);
  } else {
    printf("%d%04d%04d \n", x[2], x[1], x[0]);
  }
}


x86 assembly (clang, -O0):
<HighPrint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,0x8(%rax)
jne    1151 <HighPrint+0x41>
mov    -0x8(%rbp),%rax
cmpl   $0x0,0x4(%rax)
jne    1151 <HighPrint+0x41>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a6 <HighPrint+0x96>
mov    -0x8(%rbp),%rax
cmpl   $0x0,0x8(%rax)
jne    117f <HighPrint+0x6f>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a1 <HighPrint+0x91>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%esi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a6 <HighPrint+0x96>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HighPrint>:
mov    0x4(%rdi),%edx
mov    0x8(%rdi),%esi
test   %esi,%esi
je     112a <HighPrint+0x1a>
mov    (%rdi),%ecx
lea    0xeeb(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
mov    (%rdi),%eax
test   %edx,%edx
je     1142 <HighPrint+0x32>
lea    0xece(%rip),%rdi
mov    %edx,%esi
mov    %eax,%edx
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xeb7(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%d \0A\00"
@.str.1 = [9 x i8] c"%d%04d \0A\00"
@.str.2 = [13 x i8] c"%d%04d%04d \0A\00"
define void @HighPrint(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 2
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %1
%8 = load i32*, i32** %2
%9 = getelementptr inbounds i32, i32* %8, i64 1
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %7
%13 = load i32*, i32** %2
%14 = getelementptr inbounds i32, i32* %13, i64 0
%15 = load i32, i32* %14
%16 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %42
17: ; preds = %7, %1
%18 = load i32*, i32** %2
%19 = getelementptr inbounds i32, i32* %18, i64 2
%20 = load i32, i32* %19
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %17
%23 = load i32*, i32** %2
%24 = getelementptr inbounds i32, i32* %23, i64 1
%25 = load i32, i32* %24
%26 = load i32*, i32** %2
%27 = getelementptr inbounds i32, i32* %26, i64 0
%28 = load i32, i32* %27
%29 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %25, i32 %28)
br label %41
30: ; preds = %17
%31 = load i32*, i32** %2
%32 = getelementptr inbounds i32, i32* %31, i64 2
%33 = load i32, i32* %32
%34 = load i32*, i32** %2
%35 = getelementptr inbounds i32, i32* %34, i64 1
%36 = load i32, i32* %35
%37 = load i32*, i32** %2
%38 = getelementptr inbounds i32, i32* %37, i64 0
%39 = load i32, i32* %38
%40 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %33, i32 %36, i32 %39)
br label %41
41: ; preds = %30, %22
br label %42
42: ; preds = %41, %12
ret void
}

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