#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(void) {
  int maxnum, i, j, start, end, k;
  printf("Digite o número máximo: ");
  scanf("%d", &maxnum);
  while (maxnum % 2 == 0) {
    printf("\nO número deve ser ímpar!");
    printf("\nDigite o número máximo: ");
    scanf("%d", &maxnum);
  }
  start = 1;
  end = maxnum;
  for (i = 0; i <= (maxnum - 1) / 2; i++) {
    for (k = 1; k <= i; k++) {
      printf(" ");
    }
    for (j = start; j <= end; j++) {
      printf("%d", j);
    }
    start++;
    end--;
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1192 <main+0x72>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7c(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    114d <main+0x2d>
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jg     1255 <main+0x135>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11f6 <main+0xd6>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ce <main+0xae>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1227 <main+0x107>
mov    -0x10(%rbp),%esi
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11fc <main+0xdc>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a6 <main+0x86>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xede(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%r13d
test   $0x1,%r13b
jne    11aa <main+0x7a>
lea    0xe97(%rip),%r14
lea    0xeac(%rip),%r15
lea    0xe86(%rip),%r12
lea    0x4(%rsp),%rbx
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%r13d
test   $0x1,%r13b
je     1180 <main+0x50>
test   %r13d,%r13d
js     1247 <main+0x117>
mov    $0x1,%ebx
lea    0xe41(%rip),%r14
mov    %r13d,%r15d
xor    %r12d,%r12d
jmp    1205 <main+0xd5>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
add    $0xffffffff,%r15d
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r12),%eax
mov    0x4(%rsp),%ecx
mov    %ecx,%edx
add    $0xffffffff,%edx
shr    $0x1f,%edx
add    %edx,%ecx
add    $0xffffffff,%ecx
sar    %ecx
add    $0xfffffffe,%r13d
cmp    %ecx,%r12d
mov    %eax,%r12d
jge    1247 <main+0x117>
mov    %r12d,%ebp
test   %r12d,%r12d
je     121f <main+0xef>
nopl   (%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1210 <main+0xe0>
cmp    %r15d,%ebx
jg     11d0 <main+0xa0>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
lea    (%rbx,%rbp,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%r13d
jne    1230 <main+0x100>
jmp    11d0 <main+0xa0>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Digite o n\C3\BAmero m\C3\A1ximo: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [28 x i8] c"\0AO n\C3\BAmero deve ser \C3\ADmpar!\00"
@.str.3 = [28 x i8] c"\0ADigite o n\C3\BAmero m\C3\A1ximo: \00"
@.str.4 = [2 x i8] c" \00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %10
10: ; preds = %14, %0
%11 = load i32, i32* %2
%12 = srem i32 %11, 2
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %10
18: ; preds = %10
store i32 1, i32* %5
%19 = load i32, i32* %2
store i32 %19, i32* %6
store i32 0, i32* %3
br label %20
20: ; preds = %54, %18
%21 = load i32, i32* %3
%22 = load i32, i32* %2
%23 = sub nsw i32 %22, 1
%24 = sdiv i32 %23, 2
%25 = icmp sle i32 %21, %24
br i1 %25, label %26, label %57
26: ; preds = %20
store i32 1, i32* %7
br label %27
27: ; preds = %33, %26
%28 = load i32, i32* %7
%29 = load i32, i32* %3
%30 = icmp sle i32 %28, %29
br i1 %30, label %31, label %36
31: ; preds = %27
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %33
33: ; preds = %31
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
br label %27
36: ; preds = %27
%37 = load i32, i32* %5
store i32 %37, i32* %4
br label %38
38: ; preds = %45, %36
%39 = load i32, i32* %4
%40 = load i32, i32* %6
%41 = icmp sle i32 %39, %40
br i1 %41, label %42, label %48
42: ; preds = %38
%43 = load i32, i32* %4
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %42
%46 = load i32, i32* %4
%47 = add nsw i32 %46, 1
store i32 %47, i32* %4
br label %38
48: ; preds = %38
%49 = load i32, i32* %5
%50 = add nsw i32 %49, 1
store i32 %50, i32* %5
%51 = load i32, i32* %6
%52 = add nsw i32 %51, -1
store i32 %52, i32* %6
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %54
54: ; preds = %48
%55 = load i32, i32* %3
%56 = add nsw i32 %55, 1
store i32 %56, i32* %3
br label %20
57: ; preds = %20
%58 = load i32, i32* %1
ret i32 %58
}

LLVM IR (-O2):
@.str = [27 x i8] c"Digite o n\C3\BAmero m\C3\A1ximo: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [28 x i8] c"\0AO n\C3\BAmero deve ser \C3\ADmpar!\00"
@.str.3 = [28 x i8] c"\0ADigite o n\C3\BAmero m\C3\A1ximo: \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = and i32 %5, 1
%7 = icmp eq i32 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %13, %0
%9 = phi i32 [ %5, %0 ], [ %17, %13 ]
%10 = icmp slt i32 %9, 0
br i1 %10, label %48, label %11
11: ; preds = %8
%12 = add nuw i32 %9, 1
br label %20
13: ; preds = %0, %13
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%17 = load i32, i32* %1
%18 = and i32 %17, 1
%19 = icmp eq i32 %18, 0
br i1 %19, label %13, label %8
20: ; preds = %11, %38
%21 = phi i32 [ %12, %11 ], [ %47, %38 ]
%22 = phi i32 [ %9, %11 ], [ %40, %38 ]
%23 = phi i32 [ 1, %11 ], [ %39, %38 ]
%24 = phi i32 [ 0, %11 ], [ %42, %38 ]
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %28, %20
%27 = icmp sgt i32 %23, %22
br i1 %27, label %38, label %33
28: ; preds = %20, %28
%29 = phi i32 [ %31, %28 ], [ 1, %20 ]
%30 = call i32 @putchar(i32 32)
%31 = add nuw nsw i32 %29, 1
%32 = icmp eq i32 %31, %23
br i1 %32, label %26, label %28
33: ; preds = %26, %33
%34 = phi i32 [ %36, %33 ], [ %23, %26 ]
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = add nuw i32 %34, 1
%37 = icmp eq i32 %36, %21
br i1 %37, label %38, label %33
38: ; preds = %33, %26
%39 = add nuw nsw i32 %23, 1
%40 = add nsw i32 %22, -1
%41 = call i32 @putchar(i32 10)
%42 = add nuw nsw i32 %24, 1
%43 = load i32, i32* %1
%44 = add nsw i32 %43, -1
%45 = sdiv i32 %44, 2
%46 = icmp slt i32 %24, %45
%47 = add i32 %21, -1
br i1 %46, label %20, label %48
48: ; preds = %38, %8
ret i32 0
}