#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 j, i, n, star, space;
  printf("Inserisci il numero della diagonale (dispari): ");
  scanf("%d", &n);
  star = 1;
  space = n / 2;
  if (n % 2 != 0) {
    for (i = 0; i < n; i++) {
      for (j = 0; j < space; j++)
        printf(" ");
      for (j = 0; j < star; j++)
        printf("*");
      for (j = 0; j < space; j++)
        printf(" ");
      printf("\n");
      if (i < n / 2) {
        star = star + 2;
        space = space - 1;
      } else {
        star = star - 2;
        space = space + 1;
      }
    }
  } else {
    printf("Il numero inserito non è valido");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1279 <main+0x159>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1274 <main+0x154>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11b4 <main+0x94>
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    118e <main+0x6e>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e1 <main+0xc1>
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11bb <main+0x9b>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    120e <main+0xee>
lea    0xe33(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11e8 <main+0xc8>
lea    0xe20(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jge    124f <main+0x12f>
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1261 <main+0x141>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1266 <main+0x146>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117b <main+0x5b>
jmp    1285 <main+0x165>
lea    0xdb7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%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
call   1040 <printf@plt>
lea    0xee6(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%ebx
test   $0x1,%bl
jne    116e <main+0x3e>
lea    0xecf(%rip),%rdi
call   1040 <printf@plt>
jmp    1234 <main+0x104>
test   %ebx,%ebx
jle    1234 <main+0x104>
shr    %ebx
xor    %r14d,%r14d
mov    $0x1,%r15d
jmp    11cc <main+0x9c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
xor    %edx,%edx
xor    %esi,%esi
cmp    %ecx,%r14d
setge  %dl
setl   %sil
lea    (%r15,%rsi,4),%r15d
add    $0xfffffffe,%r15d
lea    (%rbx,%rdx,2),%ebx
add    $0xffffffff,%ebx
add    $0x1,%r14d
cmp    %eax,%r14d
jge    1234 <main+0x104>
mov    %ebx,%ebp
test   %ebx,%ebx
jle    11ef <main+0xbf>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11e0 <main+0xb0>
mov    %r15d,%ebp
test   %r15d,%r15d
jle    120f <main+0xdf>
nopw   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1200 <main+0xd0>
mov    %ebx,%ebp
test   %ebx,%ebx
jle    1190 <main+0x60>
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1220 <main+0xf0>
jmp    1190 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [48 x i8] c"Inserisci il numero della diagonale (dispari): \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [2 x i8] c"*\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [33 x i8] c"Il numero inserito non \C3\A8 valido\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
store i32 1, i32* %5
%9 = load i32, i32* %4
%10 = sdiv i32 %9, 2
store i32 %10, i32* %6
%11 = load i32, i32* %4
%12 = srem i32 %11, 2
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %70
14: ; preds = %0
store i32 0, i32* %3
br label %15
15: ; preds = %66, %14
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %69
19: ; preds = %15
store i32 0, i32* %2
br label %20
20: ; preds = %26, %19
%21 = load i32, i32* %2
%22 = load i32, i32* %6
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %29
24: ; preds = %20
%25 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %26
26: ; preds = %24
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
br label %20
29: ; preds = %20
store i32 0, i32* %2
br label %30
30: ; preds = %36, %29
%31 = load i32, i32* %2
%32 = load i32, i32* %5
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %39
34: ; preds = %30
%35 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %36
36: ; preds = %34
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 1
store i32 %38, i32* %2
br label %30
39: ; preds = %30
store i32 0, i32* %2
br label %40
40: ; preds = %46, %39
%41 = load i32, i32* %2
%42 = load i32, i32* %6
%43 = icmp slt i32 %41, %42
br i1 %43, label %44, label %49
44: ; preds = %40
%45 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %46
46: ; preds = %44
%47 = load i32, i32* %2
%48 = add nsw i32 %47, 1
store i32 %48, i32* %2
br label %40
49: ; preds = %40
%50 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%51 = load i32, i32* %3
%52 = load i32, i32* %4
%53 = sdiv i32 %52, 2
%54 = icmp slt i32 %51, %53
br i1 %54, label %55, label %60
55: ; preds = %49
%56 = load i32, i32* %5
%57 = add nsw i32 %56, 2
store i32 %57, i32* %5
%58 = load i32, i32* %6
%59 = sub nsw i32 %58, 1
store i32 %59, i32* %6
br label %65
60: ; preds = %49
%61 = load i32, i32* %5
%62 = sub nsw i32 %61, 2
store i32 %62, i32* %5
%63 = load i32, i32* %6
%64 = add nsw i32 %63, 1
store i32 %64, i32* %6
br label %65
65: ; preds = %60, %55
br label %66
66: ; preds = %65
%67 = load i32, i32* %3
%68 = add nsw i32 %67, 1
store i32 %68, i32* %3
br label %15
69: ; preds = %15
br label %72
70: ; preds = %0
%71 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
br label %72
72: ; preds = %70, %69
%73 = load i32, i32* %1
ret i32 %73
}

LLVM IR (-O2):
@.str = [48 x i8] c"Inserisci il numero della diagonale (dispari): \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.5 = [33 x i8] c"Il numero inserito non \C3\A8 valido\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 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 %46, label %8
8: ; preds = %0
%9 = icmp sgt i32 %5, 0
br i1 %9, label %10, label %48
10: ; preds = %8
%11 = lshr i32 %5, 1
br label %12
12: ; preds = %10, %35
%13 = phi i32 [ %43, %35 ], [ %11, %10 ]
%14 = phi i32 [ %41, %35 ], [ 1, %10 ]
%15 = phi i32 [ %44, %35 ], [ 0, %10 ]
%16 = icmp sgt i32 %13, 0
br i1 %16, label %19, label %17
17: ; preds = %19, %12
%18 = icmp sgt i32 %14, 0
br i1 %18, label %25, label %24
19: ; preds = %12, %19
%20 = phi i32 [ %22, %19 ], [ 0, %12 ]
%21 = call i32 @putchar(i32 32)
%22 = add nuw nsw i32 %20, 1
%23 = icmp eq i32 %22, %13
br i1 %23, label %17, label %19
24: ; preds = %25, %17
br i1 %16, label %30, label %35
25: ; preds = %17, %25
%26 = phi i32 [ %28, %25 ], [ 0, %17 ]
%27 = call i32 @putchar(i32 42)
%28 = add nuw nsw i32 %26, 1
%29 = icmp eq i32 %28, %14
br i1 %29, label %24, label %25
30: ; preds = %24, %30
%31 = phi i32 [ %33, %30 ], [ 0, %24 ]
%32 = call i32 @putchar(i32 32)
%33 = add nuw nsw i32 %31, 1
%34 = icmp eq i32 %33, %13
br i1 %34, label %35, label %30
35: ; preds = %30, %24
%36 = call i32 @putchar(i32 10)
%37 = load i32, i32* %1
%38 = sdiv i32 %37, 2
%39 = icmp slt i32 %15, %38
%40 = select i1 %39, i32 2, i32 -2
%41 = add nsw i32 %40, %14
%42 = select i1 %39, i32 -1, i32 1
%43 = add nsw i32 %42, %13
%44 = add nuw nsw i32 %15, 1
%45 = icmp slt i32 %44, %37
br i1 %45, label %12, label %48
46: ; preds = %0
%47 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
br label %48
48: ; preds = %35, %8, %46
ret i32 0
}