#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, j, N;
  scanf("%d", &N);
  i = 1;
  j = 5;
  while (i <= N) {
    while (j > 0 && j > i) {
      printf("%d", j);
      j = j - 1;
    }
    printf("*");
    j = i - 1;
    while (j > 0) {
      printf("%d", j);
      j = j - 1;
    }
    i = i + 1;
    j = 5;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11fd <main+0xdd>
jmp    115e <main+0x3e>
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x11(%rbp)
jle    1179 <main+0x59>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
setg   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1189 <main+0x69>
jmp    11a8 <main+0x88>
mov    -0xc(%rbp),%esi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115e <main+0x3e>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    11e8 <main+0xc8>
mov    -0xc(%rbp),%esi
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11bf <main+0x9f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
jmp    114d <main+0x2d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11e7 <main+0xb7>
mov    $0x1,%ebx
mov    $0x2,%r14d
lea    0xe9b(%rip),%r15
jmp    117f <main+0x4f>
nopw   0x0(%rax,%rax,1)
lea    0x1(%rbx),%eax
add    $0x1,%r14d
cmp    0x4(%rsp),%ebx
mov    %eax,%ebx
jge    11e7 <main+0xb7>
cmp    $0x4,%ebx
ja     11c0 <main+0x90>
mov    $0x5,%ebp
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebp
cmp    %ebx,%ebp
ja     1190 <main+0x60>
mov    $0x2a,%edi
call   1030 <putchar@plt>
cmp    $0x2,%ebx
jb     1170 <main+0x40>
jmp    11ca <main+0x9a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    %r14d,%ebp
nopl   (%rax)
lea    -0x2(%rbp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebp
cmp    $0x2,%ebp
jg     11d0 <main+0xa0>
jmp    1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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