#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 diament(int linia) {
  if (linia == 0 || linia == 5) {
    printf("  *  \n");
  } else if (linia == 1 || linia == 4) {
    printf(" * * \n");
  } else {
    printf("*   *\n");
  }
}


x86 assembly (clang, -O0):
<diament>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     112f <diament+0x1f>
cmpl   $0x5,-0x4(%rbp)
jne    1140 <diament+0x30>
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
jmp    1176 <diament+0x66>
cmpl   $0x1,-0x4(%rbp)
je     1154 <diament+0x44>
cmpl   $0x4,-0x4(%rbp)
jne    1165 <diament+0x55>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
jmp    1171 <diament+0x61>
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
jmp    1176 <diament+0x66>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<diament>:
cmp    $0x5,%edi
ja     112b <diament+0x1b>
movslq %edi,%rax
lea    0xef5(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    1030 <puts@plt>
lea    0xece(%rip),%rdi
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [6 x i8] c"* *\00"
@str.3 = [6 x i8] c" * * \00"
@str.4 = [6 x i8] c" * \00"
@reltable.diament = [6 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @str.4 to i64), i64 ptrtoint ([6 x i32]* @reltable.diament to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @str.3 to i64), i64 ptrtoint ([6 x i32]* @reltable.diament to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @str to i64), i64 ptrtoint ([6 x i32]* @reltable.diament to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @str to i64), i64 ptrtoint ([6 x i32]* @reltable.diament to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @str.3 to i64), i64 ptrtoint ([6 x i32]* @reltable.diament to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @str.4 to i64), i64 ptrtoint ([6 x i32]* @reltable.diament to i64)) to i32)]
define void @diament(i32 %0) {
%2 = icmp ult i32 %0, 6
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = shl i64 %4, 2
%6 = call i8* @llvm.load.relative.i64(i8* bitcast ([6 x i32]* @reltable.diament to i8*), i64 %5)
br label %7
7: ; preds = %1, %3
%8 = phi i8* [ %6, %3 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0), %1 ]
%9 = tail call i32 @puts(i8* dereferenceable(1) %8)
ret void
}