#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*/ spaces(int);
void shapeB(void) {
  printf("Shape B: \n");
  int count = 1;
  int fspaces = 4;
  for (int i = 0; i < 5; i++) {
    spaces(fspaces);
    for (int h = 0; h < count; h++) {
      printf("*");
    }
    count++;
    fspaces--;
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<shapeB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    11b4 <shapeB+0x94>
mov    -0x8(%rbp),%edi
call   1040 <spaces@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1188 <shapeB+0x68>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1162 <shapeB+0x42>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1149 <shapeB+0x29>
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shapeB>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <puts@plt>
mov    $0x4,%edi
call   1050 <spaces@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x3,%edi
call   1050 <spaces@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2,%edi
call   1050 <spaces@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1050 <spaces@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1050 <spaces@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"Shape B: \0A\00"
@.str.1 = [2 x i8] c"*\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @shapeB() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
store i32 4, i32* %2
store i32 0, i32* %3
br label %6
6: ; preds = %27, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 5
br i1 %8, label %9, label %30
9: ; preds = %6
%10 = load i32, i32* %2
%11 = call i32 @spaces(i32 %10)
store i32 0, i32* %4
br label %12
12: ; preds = %18, %9
%13 = load i32, i32* %4
%14 = load i32, i32* %1
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %12
21: ; preds = %12
%22 = load i32, i32* %1
%23 = add nsw i32 %22, 1
store i32 %23, i32* %1
%24 = load i32, i32* %2
%25 = add nsw i32 %24, -1
store i32 %25, i32* %2
%26 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %27
27: ; preds = %21
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %6
30: ; preds = %6
%31 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [10 x i8] c"Shape B: \00"
define void @shapeB() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @spaces(i32 4)
%3 = tail call i32 @putchar(i32 42)
%4 = tail call i32 @putchar(i32 10)
%5 = tail call i32 @spaces(i32 3)
%6 = tail call i32 @putchar(i32 42)
%7 = tail call i32 @putchar(i32 42)
%8 = tail call i32 @putchar(i32 10)
%9 = tail call i32 @spaces(i32 2)
%10 = tail call i32 @putchar(i32 42)
%11 = tail call i32 @putchar(i32 42)
%12 = tail call i32 @putchar(i32 42)
%13 = tail call i32 @putchar(i32 10)
%14 = tail call i32 @spaces(i32 1)
%15 = tail call i32 @putchar(i32 42)
%16 = tail call i32 @putchar(i32 42)
%17 = tail call i32 @putchar(i32 42)
%18 = tail call i32 @putchar(i32 42)
%19 = tail call i32 @putchar(i32 10)
%20 = tail call i32 @spaces(i32 0)
%21 = tail call i32 @putchar(i32 42)
%22 = tail call i32 @putchar(i32 42)
%23 = tail call i32 @putchar(i32 42)
%24 = tail call i32 @putchar(i32 42)
%25 = tail call i32 @putchar(i32 42)
%26 = tail call i32 @putchar(i32 10)
%27 = tail call i32 @putchar(i32 10)
ret void
}