#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 *);
int main() {
  int kalan, sayi, sutun, satir;
  printf("Bir sayi giriniz:");
  scanf("%d", &sayi);
  satir = 1;
  while (satir <= sayi) {
    sutun = 1;
    while (sutun <= sayi) {
      kalan = satir % 2;
      if (kalan == 1) {
        printf("* ");
      } else {
        printf(" *");
      }
      sutun++;
    }
    printf("\n");
    satir++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11ce <main+0xae>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11b4 <main+0x94>
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    119a <main+0x7a>
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
jmp    11a6 <main+0x86>
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1165 <main+0x45>
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1152 <main+0x32>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
lea    0xec3(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11c3 <main+0x93>
mov    $0x1,%r15d
lea    0xeaa(%rip),%r14
lea    0xea0(%rip),%r12
jmp    119a <main+0x6a>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r15),%ecx
mov    0xc(%rsp),%eax
cmp    %eax,%r15d
mov    %ecx,%r15d
jge    11c3 <main+0x93>
test   %eax,%eax
jle    1180 <main+0x50>
test   $0x1,%r15b
mov    %r12,%rbx
cmove  %r14,%rbx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jl     11b0 <main+0x80>
jmp    1180 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [18 x i8] c"Bir sayi giriniz:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [3 x i8] c"* \00"
@.str.3 = [3 x i8] c" *\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 1
br i1 %6, label %26, label %7
7: ; preds = %0, %21
%8 = phi i32 [ %24, %21 ], [ %5, %0 ]
%9 = phi i32 [ %23, %21 ], [ 1, %0 ]
%10 = icmp slt i32 %8, 1
br i1 %10, label %21, label %11
11: ; preds = %7
%12 = and i32 %9, 1
%13 = icmp eq i32 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
br label %15
15: ; preds = %11, %15
%16 = phi i32 [ 1, %11 ], [ %18, %15 ]
%17 = call i32 @printf(i8* dereferenceable(1) %14)
%18 = add nuw nsw i32 %16, 1
%19 = load i32, i32* %1
%20 = icmp slt i32 %16, %19
br i1 %20, label %15, label %21
21: ; preds = %15, %7
%22 = call i32 @putchar(i32 10)
%23 = add nuw nsw i32 %9, 1
%24 = load i32, i32* %1
%25 = icmp slt i32 %9, %24
br i1 %25, label %7, label %26
26: ; preds = %21, %0
ret i32 0
}