#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 pattern10() {
  int i, j, k, c;
  for (i = 1; i < 8; i++) {
    c = i <= 4 ? i : 8 - i;
    for (j = 1; j <= 4 - c; j++)
      printf(" ");
    for (k = 1; k <= 2 * c - 1; k++) {
      if (k % 2 == 0)
        printf(" ");
      else
        printf("*");
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<pattern10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x1,-0x4(%rbp)
cmpl   $0x8,-0x4(%rbp)
jge    11fc <pattern10+0xec>
cmpl   $0x4,-0x4(%rbp)
jg     113e <pattern10+0x2e>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1149 <pattern10+0x39>
mov    $0x8,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
sub    -0x10(%rbp),%ecx
cmp    %ecx,%eax
jg     1183 <pattern10+0x73>
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1156 <pattern10+0x46>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11e2 <pattern10+0xd2>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11c3 <pattern10+0xb3>
lea    0xe47(%rip),%rdi
call   1030 <printf@plt>
jmp    11cf <pattern10+0xbf>
lea    0xe38(%rip),%rdi
call   1030 <printf@plt>
jmp    11d4 <pattern10+0xc4>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118a <pattern10+0x7a>
lea    0xe1b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <pattern10+0xf>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pattern10>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0x1,%r15d
mov    $0x2,%r14d
mov    $0x20,%r12d
jmp    1144 <pattern10+0x34>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
cmp    $0x8,%r15d
je     11ab <pattern10+0x9b>
mov    $0x8,%ebx
sub    %r15d,%ebx
cmp    $0x5,%r15d
cmovb  %r15d,%ebx
cmp    $0x3,%ebx
ja     1175 <pattern10+0x65>
mov    $0x4,%ebp
xchg   %ax,%ax
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    %ebp,%ebx
jne    1160 <pattern10+0x50>
test   %ebx,%ebx
jle    1130 <pattern10+0x20>
add    %ebx,%ebx
cmp    $0x3,%ebx
cmovl  %r14d,%ebx
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
test   $0x1,%bpl
mov    $0x2a,%edi
cmove  %r12d,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1190 <pattern10+0x80>
jmp    1130 <pattern10+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"*\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @pattern10() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 1, i32* %1
br label %5
5: ; preds = %49, %0
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 8
br i1 %7, label %8, label %52
8: ; preds = %5
%9 = load i32, i32* %1
%10 = icmp sle i32 %9, 4
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = load i32, i32* %1
br label %16
13: ; preds = %8
%14 = load i32, i32* %1
%15 = sub nsw i32 8, %14
br label %16
16: ; preds = %13, %11
%17 = phi i32 [ %12, %11 ], [ %15, %13 ]
store i32 %17, i32* %4
store i32 1, i32* %2
br label %18
18: ; preds = %25, %16
%19 = load i32, i32* %2
%20 = load i32, i32* %4
%21 = sub nsw i32 4, %20
%22 = icmp sle i32 %19, %21
br i1 %22, label %23, label %28
23: ; preds = %18
%24 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %25
25: ; preds = %23
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %18
28: ; preds = %18
store i32 1, i32* %3
br label %29
29: ; preds = %44, %28
%30 = load i32, i32* %3
%31 = load i32, i32* %4
%32 = mul nsw i32 2, %31
%33 = sub nsw i32 %32, 1
%34 = icmp sle i32 %30, %33
br i1 %34, label %35, label %47
35: ; preds = %29
%36 = load i32, i32* %3
%37 = srem i32 %36, 2
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %35
%40 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %43
41: ; preds = %35
%42 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %43
43: ; preds = %41, %39
br label %44
44: ; preds = %43
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
store i32 %46, i32* %3
br label %29
47: ; preds = %29
%48 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %49
49: ; preds = %47
%50 = load i32, i32* %1
%51 = add nsw i32 %50, 1
store i32 %51, i32* %1
br label %5
52: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @pattern10() {
br label %1
1: ; preds = %0, %27
%2 = phi i32 [ 1, %0 ], [ %29, %27 ]
%3 = icmp ult i32 %2, 5
%4 = sub nuw nsw i32 8, %2
%5 = select i1 %3, i32 %2, i32 %4
%6 = icmp ugt i32 %5, 3
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = sub nuw nsw i32 4, %5
br label %14
9: ; preds = %14
%10 = icmp sgt i32 %5, 0
br i1 %10, label %11, label %27
11: ; preds = %1, %9
%12 = shl nuw i32 %5, 1
%13 = call i32 @llvm.smax.i32(i32 %12, i32 2)
br label %19
14: ; preds = %7, %14
%15 = phi i32 [ %17, %14 ], [ 1, %7 ]
%16 = tail call i32 @putchar(i32 32)
%17 = add nuw i32 %15, 1
%18 = icmp eq i32 %15, %8
br i1 %18, label %9, label %14
19: ; preds = %11, %19
%20 = phi i32 [ %25, %19 ], [ 1, %11 ]
%21 = and i32 %20, 1
%22 = icmp eq i32 %21, 0
%23 = select i1 %22, i32 32, i32 42
%24 = tail call i32 @putchar(i32 %23)
%25 = add nuw nsw i32 %20, 1
%26 = icmp eq i32 %25, %13
br i1 %26, label %27, label %19
27: ; preds = %19, %9
%28 = tail call i32 @putchar(i32 10)
%29 = add nuw nsw i32 %2, 1
%30 = icmp eq i32 %29, 8
br i1 %30, label %31, label %1
31: ; preds = %27
ret void
}