#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 *);
void ters_ucgen_ciz(int x) {
  int i, j;
  for (i = 1; i <= x; i++) {
    for (j = 1; j <= x - i + 1; j++) {
      printf("*");
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<ters_ucgen_ciz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     117d <ters_ucgen_ciz+0x6d>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     1163 <ters_ucgen_ciz+0x53>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1135 <ters_ucgen_ciz+0x25>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <ters_ucgen_ciz+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ters_ucgen_ciz>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
jle    1171 <ters_ucgen_ciz+0x61>
mov    %edi,%r15d
lea    0x1(%r15),%r14d
mov    $0x1,%r12d
mov    %edi,%ebp
jmp    114a <ters_ucgen_ciz+0x3a>
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r12),%eax
add    $0xffffffff,%ebp
cmp    %r15d,%r12d
mov    %eax,%r12d
je     1171 <ters_ucgen_ciz+0x61>
mov    %r14d,%eax
sub    %r12d,%eax
test   %eax,%eax
jle    1130 <ters_ucgen_ciz+0x20>
mov    %ebp,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1160 <ters_ucgen_ciz+0x50>
jmp    1130 <ters_ucgen_ciz+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @ters_ucgen_ciz(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %20, label %3
3: ; preds = %1
%4 = add nuw i32 %0, 1
br label %5
5: ; preds = %3, %15
%6 = phi i32 [ %4, %3 ], [ %18, %15 ]
%7 = phi i32 [ 1, %3 ], [ %17, %15 ]
%8 = sub i32 %4, %7
%9 = icmp slt i32 %8, 1
br i1 %9, label %15, label %10
10: ; preds = %5, %10
%11 = phi i32 [ %13, %10 ], [ 1, %5 ]
%12 = tail call i32 @putchar(i32 42)
%13 = add nuw i32 %11, 1
%14 = icmp eq i32 %13, %6
br i1 %14, label %15, label %10
15: ; preds = %10, %5
%16 = tail call i32 @putchar(i32 10)
%17 = add nuw i32 %7, 1
%18 = add i32 %6, -1
%19 = icmp eq i32 %7, %0
br i1 %19, label %20, label %5
20: ; preds = %15, %1
ret void
}