#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 */
char getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  printf("Voer een getal in tussen 1 en 80: ");
  while (!scanf("%d", &n) || !(0 < n && n < 81)) {
    printf("Ongeldige invoer\n");
    while (getchar() != '\n')
      ;
    printf("Voer een getal in.\n");
  }
  for (int i = 0; i < n; i++) {
    for (int a = 0; a <= i; a++) {
      printf("*");
    }
    printf("\n");
  }
  int i = n - 1;
  while (i != 0) {
    int a = i;
    while (a != 0) {
      printf("*");
      a--;
    }
    printf("\n");
    i--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     118d <main+0x5d>
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0x8(%rbp),%ecx
mov    %al,-0x1a(%rbp)
jge    1185 <main+0x55>
cmpl   $0x51,-0x8(%rbp)
setl   %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
xor    $0xff,%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    119d <main+0x6d>
jmp    11d2 <main+0xa2>
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11c1 <main+0x91>
jmp    11a9 <main+0x79>
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
jmp    114b <main+0x1b>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    122c <main+0xfc>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1212 <main+0xe2>
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11ec <main+0xbc>
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11d9 <main+0xa9>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1283 <main+0x153>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1269 <main+0x139>
lea    0xdf6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1245 <main+0x115>
lea    0xdda(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1235 <main+0x105>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe9d(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb4(%rip),%r14
lea    0xc(%rsp),%r12
lea    0xeab(%rip),%r15
lea    0xeb5(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r12,%rsi
call   1070 <scanf@plt>
test   %eax,%eax
je     11ab <main+0x5b>
mov    0xc(%rsp),%eax
add    $0xffffffaf,%eax
cmp    $0xffffffb0,%eax
jae    11d5 <main+0x85>
mov    %r15,%rdi
call   1040 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xa,%al
jne    11c0 <main+0x70>
mov    %rbx,%rdi
call   1040 <puts@plt>
jmp    1190 <main+0x40>
xor    %r14d,%r14d
mov    $0x1,%ebp
nopl   (%rax)
mov    %ebp,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11f0 <main+0xa0>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14d
mov    0xc(%rsp),%ebx
add    $0x1,%ebp
cmp    %ebx,%r14d
jl     11e0 <main+0x90>
jmp    124b <main+0xfb>
nopl   0x0(%rax,%rax,1)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1230 <main+0xe0>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1220 <main+0xd0>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Voer een getal in tussen 1 en 80: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"Ongeldige invoer\0A\00"
@.str.3 = [20 x i8] c"Voer een getal in.\0A\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
store i32 0, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %29, %0
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp slt i32 0, %12
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i32, i32* %2
%16 = icmp slt i32 %15, 81
br label %17
17: ; preds = %14, %11
%18 = phi i1 [ false, %11 ], [ %16, %14 ]
%19 = xor i1 %18, true
br label %20
20: ; preds = %17, %8
%21 = phi i1 [ true, %8 ], [ %19, %17 ]
br i1 %21, label %22, label %31
22: ; preds = %20
%23 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %24
24: ; preds = %28, %22
%25 = call signext i8 (...) @getchar()
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 10
br i1 %27, label %28, label %29
28: ; preds = %24
br label %24
29: ; preds = %24
%30 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %8
31: ; preds = %20
store i32 0, i32* %3
br label %32
32: ; preds = %48, %31
%33 = load i32, i32* %3
%34 = load i32, i32* %2
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %51
36: ; preds = %32
store i32 0, i32* %4
br label %37
37: ; preds = %43, %36
%38 = load i32, i32* %4
%39 = load i32, i32* %3
%40 = icmp sle i32 %38, %39
br i1 %40, label %41, label %46
41: ; preds = %37
%42 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %43
43: ; preds = %41
%44 = load i32, i32* %4
%45 = add nsw i32 %44, 1
store i32 %45, i32* %4
br label %37
46: ; preds = %37
%47 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %48
48: ; preds = %46
%49 = load i32, i32* %3
%50 = add nsw i32 %49, 1
store i32 %50, i32* %3
br label %32
51: ; preds = %32
%52 = load i32, i32* %2
%53 = sub nsw i32 %52, 1
store i32 %53, i32* %5
br label %54
54: ; preds = %66, %51
%55 = load i32, i32* %5
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %70
57: ; preds = %54
%58 = load i32, i32* %5
store i32 %58, i32* %6
br label %59
59: ; preds = %62, %57
%60 = load i32, i32* %6
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %66
62: ; preds = %59
%63 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%64 = load i32, i32* %6
%65 = add nsw i32 %64, -1
store i32 %65, i32* %6
br label %59
66: ; preds = %59
%67 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%68 = load i32, i32* %5
%69 = add nsw i32 %68, -1
store i32 %69, i32* %5
br label %54
70: ; preds = %54
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"Voer een getal in tussen 1 en 80: \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [17 x i8] c"Ongeldige invoer\00"
@str.6 = [19 x i8] c"Voer een getal in.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %16, %0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = icmp eq i32 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = load i32, i32* %1
%9 = add i32 %8, -81
%10 = icmp ult i32 %9, -80
br i1 %10, label %11, label %18
11: ; preds = %4, %7
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %13
13: ; preds = %13, %11
%14 = call signext i8 (...) @getchar()
%15 = icmp eq i8 %14, 10
br i1 %15, label %16, label %13
16: ; preds = %13
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.6, i64 0, i64 0))
br label %4
18: ; preds = %7, %24
%19 = phi i32 [ %29, %24 ], [ 1, %7 ]
%20 = phi i32 [ %26, %24 ], [ 0, %7 ]
br label %30
21: ; preds = %24
%22 = add nsw i32 %27, -1
%23 = icmp eq i32 %22, 0
br i1 %23, label %46, label %35
24: ; preds = %30
%25 = call i32 @putchar(i32 10)
%26 = add nuw nsw i32 %20, 1
%27 = load i32, i32* %1
%28 = icmp slt i32 %26, %27
%29 = add nuw i32 %19, 1
br i1 %28, label %18, label %21
30: ; preds = %18, %30
%31 = phi i32 [ 0, %18 ], [ %33, %30 ]
%32 = call i32 @putchar(i32 42)
%33 = add nuw nsw i32 %31, 1
%34 = icmp eq i32 %33, %19
br i1 %34, label %24, label %30
35: ; preds = %21, %42
%36 = phi i32 [ %44, %42 ], [ %22, %21 ]
br label %37
37: ; preds = %35, %37
%38 = phi i32 [ %36, %35 ], [ %40, %37 ]
%39 = call i32 @putchar(i32 42)
%40 = add nsw i32 %38, -1
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %37
42: ; preds = %37
%43 = call i32 @putchar(i32 10)
%44 = add nsw i32 %36, -1
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %35
46: ; preds = %42, %21
ret i32 0
}