#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 main() {
  int i, j;
  for (i = 0; i < 10; i++) {
    for (j = 0; j < i; j++) {
      if (i % 2 == 0)
        printf("*");
      else
        printf("#");
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11a1 <main+0x91>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1187 <main+0x77>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1168 <main+0x58>
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
jmp    1174 <main+0x64>
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
jmp    1179 <main+0x69>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1137 <main+0x27>
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %r15d,%r15d
mov    $0x2a,%r14d
jmp    1144 <main+0x34>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
cmp    $0xa,%r15d
je     116e <main+0x5e>
test   %r15d,%r15d
je     1130 <main+0x20>
test   $0x1,%r15b
mov    $0x23,%ebx
cmove  %r14d,%ebx
mov    %r15d,%ebp
nopl   0x0(%rax)
mov    %ebx,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1160 <main+0x50>
jmp    1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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