#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 a(int n) {
  int i, j;
  if (n < 1 || n > 9)
    return 0;
  else {
    for (i = 1; i <= n; i++) {
      for (j = 1; j <= n - i; j++)
        printf(" ");
      for (j = 1; j <= (2 * i - 1); j++)
        printf("%d", i);
      printf("\n");
    }
    return 1;
  }
}


x86 assembly (clang, -O0):
<a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     112f <a+0x1f>
cmpl   $0x9,-0x8(%rbp)
jle    113b <a+0x2b>
movl   $0x0,-0x4(%rbp)
jmp    11df <a+0xcf>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11d8 <a+0xc8>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jg     1182 <a+0x72>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1155 <a+0x45>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11bc <a+0xac>
mov    -0xc(%rbp),%esi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1189 <a+0x79>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1142 <a+0x32>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edi,%r14d
lea    -0xa(%r14),%ecx
xor    %eax,%eax
cmp    $0xfffffff7,%ecx
jb     11ae <a+0x8e>
mov    $0x1,%r12d
lea    0xebd(%rip),%r15
mov    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
cmp    %r14d,%ebx
jge    1171 <a+0x51>
mov    %r14d,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    %ebp,%ebx
jne    1160 <a+0x40>
mov    %r12d,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    1180 <a+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%eax
add    $0x2,%r12d
cmp    %r14d,%ebx
mov    %eax,%ebx
jne    1150 <a+0x30>
mov    $0x1,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
define i32 @a(i32 %0) {
%2 = add i32 %0, -10
%3 = icmp ult i32 %2, -9
br i1 %3, label %26, label %4
4: ; preds = %1, %20
%5 = phi i32 [ %24, %20 ], [ 2, %1 ]
%6 = phi i32 [ %23, %20 ], [ %0, %1 ]
%7 = phi i32 [ %22, %20 ], [ 1, %1 ]
%8 = icmp slt i32 %7, %0
br i1 %8, label %9, label %14
9: ; preds = %4, %9
%10 = phi i32 [ %12, %9 ], [ 1, %4 ]
%11 = tail call i32 @putchar(i32 32)
%12 = add nuw i32 %10, 1
%13 = icmp eq i32 %12, %6
br i1 %13, label %14, label %9
14: ; preds = %9, %4
br label %15
15: ; preds = %14, %15
%16 = phi i32 [ %18, %15 ], [ 1, %14 ]
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%18 = add nuw i32 %16, 1
%19 = icmp eq i32 %18, %5
br i1 %19, label %20, label %15
20: ; preds = %15
%21 = tail call i32 @putchar(i32 10)
%22 = add nuw i32 %7, 1
%23 = add i32 %6, -1
%24 = add i32 %5, 2
%25 = icmp eq i32 %7, %0
br i1 %25, label %26, label %4
26: ; preds = %20, %1
%27 = phi i32 [ 0, %1 ], [ 1, %20 ]
ret i32 %27
}