#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 main() {
  int h, space, crh = -1, pr;
  char _char;
  printf("Enter the h:");
  scanf("%d", &h);
  printf("What char you want for your pyramide:");
  scanf("%c", &_char);
  scanf("%c", &_char);
  while (h > 0) {
    pr = 0;
    crh += 2;
    space = h - 1;
    while (space > 0) {
      printf(" ");
      space--;
    }
    while (pr < crh) {
      printf("%c", _char);
      pr++;
    }
    printf("\n");
    h--;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x10(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
lea    -0x15(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeb9(%rip),%rdi
lea    -0x15(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    121e <main+0xfe>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    11d1 <main+0xb1>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    11ab <main+0x8b>
jmp    11d6 <main+0xb6>
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1202 <main+0xe2>
movsbl -0x15(%rbp),%esi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11d6 <main+0xb6>
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1188 <main+0x68>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec0(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xeb0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec8(%rip),%rbx
lea    0xb(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%ebp
test   %ebp,%ebp
jle    120d <main+0xdd>
mov    $0x1,%r14d
nopl   0x0(%rax,%rax,1)
cmp    $0x2,%r14d
mov    $0x1,%ebx
cmovge %r14d,%ebx
cmp    $0x2,%ebp
jb     11e0 <main+0xb0>
add    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    $0x2,%ebp
ja     11c0 <main+0x90>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl 0xb(%rsp),%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11e0 <main+0xb0>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ebp
mov    %ebp,0xc(%rsp)
add    $0x2,%r14d
cmp    $0x1,%eax
jg     11a0 <main+0x70>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Enter the h:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [38 x i8] c"What char you want for your pyramide:\00"
@.str.3 = [3 x i8] c"%c\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 i8
store i32 0, i32* %1
store i32 -1, i32* %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %6)
br label %12
12: ; preds = %38, %0
%13 = load i32, i32* %2
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %42
15: ; preds = %12
store i32 0, i32* %5
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 2
store i32 %17, i32* %4
%18 = load i32, i32* %2
%19 = sub nsw i32 %18, 1
store i32 %19, i32* %3
br label %20
20: ; preds = %23, %15
%21 = load i32, i32* %3
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%25 = load i32, i32* %3
%26 = add nsw i32 %25, -1
store i32 %26, i32* %3
br label %20
27: ; preds = %20
br label %28
28: ; preds = %32, %27
%29 = load i32, i32* %5
%30 = load i32, i32* %4
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %38
32: ; preds = %28
%33 = load i8, i8* %6
%34 = sext i8 %33 to i32
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %28
38: ; preds = %28
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%40 = load i32, i32* %2
%41 = add nsw i32 %40, -1
store i32 %41, i32* %2
br label %12
42: ; preds = %12
%43 = load i32, i32* %1
ret i32 %43
}

LLVM IR (-O2):
@.str = [13 x i8] c"Enter the h:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [38 x i8] c"What char you want for your pyramide:\00"
@.str.3 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %35
11: ; preds = %0, %29
%12 = phi i32 [ %34, %29 ], [ 1, %0 ]
%13 = phi i32 [ %32, %29 ], [ %9, %0 ]
%14 = call i32 @llvm.smax.i32(i32 %12, i32 1)
%15 = icmp ugt i32 %13, 1
br i1 %15, label %16, label %21
16: ; preds = %11, %16
%17 = phi i32 [ %18, %16 ], [ %13, %11 ]
%18 = add nsw i32 %17, -1
%19 = call i32 @putchar(i32 32)
%20 = icmp ugt i32 %17, 2
br i1 %20, label %16, label %21
21: ; preds = %16, %11
br label %22
22: ; preds = %21, %22
%23 = phi i32 [ %27, %22 ], [ 0, %21 ]
%24 = load i8, i8* %2
%25 = sext i8 %24 to i32
%26 = call i32 @putchar(i32 %25)
%27 = add nuw nsw i32 %23, 1
%28 = icmp eq i32 %27, %14
br i1 %28, label %29, label %22
29: ; preds = %22
%30 = call i32 @putchar(i32 10)
%31 = load i32, i32* %1
%32 = add nsw i32 %31, -1
store i32 %32, i32* %1
%33 = icmp sgt i32 %31, 1
%34 = add i32 %12, 2
br i1 %33, label %11, label %35
35: ; preds = %29, %0
ret i32 0
}