#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 period = 0;
  int i = 0;
  int j = 0;
  int l = 0;
  int max = 80;
  int level = 0;
  printf("Enter period: ");
  scanf("%d", &period);
  level = 1 + period / 2;
  for (l = 0; l < level; l++) {
    for (i = 0, j = 0; i < max; i++, j++) {
      if ((j == (level - 1) - l) || (j == (level - 1) + l)) {
        printf("*");
      } else {
        printf(" ");
      }
      if (j == period) {
        j = 0;
      }
      if ((i + 1) == max) {
        printf("\n");
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x50,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1255 <main+0x135>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1242 <main+0x122>
mov    -0x10(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
sub    -0x14(%rbp),%ecx
cmp    %ecx,%eax
je     11db <main+0xbb>
mov    -0x10(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
add    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jne    11ec <main+0xcc>
lea    0xe30(%rip),%rdi
call   1030 <printf@plt>
jmp    11f8 <main+0xd8>
lea    0xe1a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    120b <main+0xeb>
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cmp    -0x18(%rbp),%eax
jne    1226 <main+0x106>
lea    0xdf3(%rip),%rdi
call   1030 <printf@plt>
jmp    122b <main+0x10b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11a7 <main+0x87>
jmp    1247 <main+0x127>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118d <main+0x6d>
xor    %eax,%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
movl   $0x0,0x4(%rsp)
lea    0xeb6(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0xffffffff,%eax
jge    117a <main+0x4a>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%r15d
shr    $0x1f,%r15d
add    %eax,%r15d
sar    %r15d
xor    %r12d,%r12d
jmp    11a7 <main+0x77>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r12),%eax
cmp    %r12d,%r15d
mov    %eax,%r12d
je     1169 <main+0x39>
mov    %r12d,%r13d
add    %r15d,%r13d
mov    $0x20,%edi
mov    $0x2a,%eax
cmove  %eax,%edi
mov    %r15d,%ebp
sub    %r12d,%ebp
cmove  %eax,%edi
call   1030 <putchar@plt>
mov    $0x4f,%ebx
xor    %eax,%eax
jmp    11f3 <main+0xc3>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %ebp,%r14d
cmove  %eax,%edi
call   1030 <putchar@plt>
mov    %r14d,%eax
add    $0xffffffff,%ebx
je     1190 <main+0x60>
mov    $0x1,%r14d
cmp    0x4(%rsp),%eax
je     1205 <main+0xd5>
add    $0x1,%eax
mov    %eax,%r14d
mov    $0x2a,%eax
mov    $0x2a,%edi
cmp    %r13d,%r14d
je     11e0 <main+0xb0>
mov    $0x20,%edi
jmp    11e0 <main+0xb0>

LLVM IR (-O0):
@.str = [15 x i8] c"Enter period: \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"
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
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 80, i32* %6
store i32 0, i32* %7
%8 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 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)
%10 = load i32, i32* %2
%11 = sdiv i32 %10, 2
%12 = add nsw i32 1, %11
store i32 %12, i32* %7
store i32 0, i32* %5
br label %13
13: ; preds = %59, %0
%14 = load i32, i32* %5
%15 = load i32, i32* %7
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %62
17: ; preds = %13
store i32 0, i32* %3
store i32 0, i32* %4
br label %18
18: ; preds = %53, %17
%19 = load i32, i32* %3
%20 = load i32, i32* %6
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %58
22: ; preds = %18
%23 = load i32, i32* %4
%24 = load i32, i32* %7
%25 = sub nsw i32 %24, 1
%26 = load i32, i32* %5
%27 = sub nsw i32 %25, %26
%28 = icmp eq i32 %23, %27
br i1 %28, label %36, label %29
29: ; preds = %22
%30 = load i32, i32* %4
%31 = load i32, i32* %7
%32 = sub nsw i32 %31, 1
%33 = load i32, i32* %5
%34 = add nsw i32 %32, %33
%35 = icmp eq i32 %30, %34
br i1 %35, label %36, label %38
36: ; preds = %29, %22
%37 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %40
38: ; preds = %29
%39 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %40
40: ; preds = %38, %36
%41 = load i32, i32* %4
%42 = load i32, i32* %2
%43 = icmp eq i32 %41, %42
br i1 %43, label %44, label %45
44: ; preds = %40
store i32 0, i32* %4
br label %45
45: ; preds = %44, %40
%46 = load i32, i32* %3
%47 = add nsw i32 %46, 1
%48 = load i32, i32* %6
%49 = icmp eq i32 %47, %48
br i1 %49, label %50, label %52
50: ; preds = %45
%51 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %52
52: ; preds = %50, %45
br label %53
53: ; preds = %52
%54 = load i32, i32* %3
%55 = add nsw i32 %54, 1
store i32 %55, i32* %3
%56 = load i32, i32* %4
%57 = add nsw i32 %56, 1
store i32 %57, i32* %4
br label %18
58: ; preds = %18
br label %59
59: ; preds = %58
%60 = load i32, i32* %5
%61 = add nsw i32 %60, 1
store i32 %61, i32* %5
br label %13
62: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Enter period: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 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 = sdiv i32 %5, 2
%7 = icmp slt i32 %5, -1
br i1 %7, label %35, label %8
8: ; preds = %0, %31
%9 = phi i32 [ %33, %31 ], [ 0, %0 ]
%10 = sub nsw i32 %6, %9
%11 = add nsw i32 %9, %6
%12 = icmp eq i32 %10, 0
%13 = icmp eq i32 %11, 0
%14 = select i1 %12, i1 true, i1 %13
%15 = select i1 %14, i32 42, i32 32
%16 = call i32 @putchar(i32 %15)
br label %17
17: ; preds = %8, %17
%18 = phi i32 [ 1, %8 ], [ %29, %17 ]
%19 = phi i32 [ 0, %8 ], [ %23, %17 ]
%20 = load i32, i32* %1
%21 = icmp eq i32 %19, %20
%22 = add nsw i32 %19, 1
%23 = select i1 %21, i32 1, i32 %22
%24 = icmp eq i32 %23, %10
%25 = icmp eq i32 %23, %11
%26 = select i1 %24, i1 true, i1 %25
%27 = select i1 %26, i32 42, i32 32
%28 = call i32 @putchar(i32 %27)
%29 = add nuw nsw i32 %18, 1
%30 = icmp eq i32 %29, 80
br i1 %30, label %31, label %17
31: ; preds = %17
%32 = call i32 @putchar(i32 10)
%33 = add nuw nsw i32 %9, 1
%34 = icmp eq i32 %6, %9
br i1 %34, label %35, label %8
35: ; preds = %31, %0
ret i32 0
}