#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*/ dik_ucgen(int, char);
int /*<<< orphan*/ ici_bos_kare(int, char);
int /*<<< orphan*/ kare(int, char);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, int *, char *);
int main() {
  printf("Programdan cikmak icin -1 giriniz\n");
  int sonsuz_dongu = 0;
  while (sonsuz_dongu < 1) {
    printf("1-Kare\n");
    printf("2-Ici Bos Kare\n");
    printf("3-Dik Ucgen\n");
    int sekil_numarasi = 0;
    int boyut = 0;
    char desen;
    printf("Cizilmesi istediginiz seklin numarasini boyutunu ve hangi "
           "karakterle cizilcegini giriniz(Ornek girdi formati:1 10 a): ");
    scanf("%d%d %c", &sekil_numarasi, &boyut, &desen);
    if ((sekil_numarasi == -1) || (boyut == -1)) {
      printf("Programdan basariyla ciktiniz :)");
      break;
    }
    switch (sekil_numarasi) {
    case 1: {
      kare(boyut, desen);
      break;
    }
    case 2: {
      ici_bos_kare(boyut, desen);
      break;
    }
    case 3: {
      dik_ucgen(boyut, desen);
      break;
    }
    default: {
      printf("Yanlis sekil numarasi girdiniz!!\n");
      break;
    }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    1271 <main+0x121>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
lea    0xefe(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x11(%rbp),%rcx
call   1070 <scanf@plt>
cmpl   $0xffffffff,-0xc(%rbp)
je     11e6 <main+0x96>
cmpl   $0xffffffff,-0x10(%rbp)
jne    11f7 <main+0xa7>
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
jmp    1271 <main+0x121>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x1,%eax
je     122d <main+0xdd>
jmp    120b <main+0xbb>
mov    -0x18(%rbp),%eax
sub    $0x2,%eax
je     123e <main+0xee>
jmp    121c <main+0xcc>
mov    -0x18(%rbp),%eax
sub    $0x3,%eax
je     124f <main+0xff>
jmp    1260 <main+0x110>
mov    -0x10(%rbp),%edi
movsbl -0x11(%rbp),%esi
call   1050 <kare@plt>
jmp    126c <main+0x11c>
mov    -0x10(%rbp),%edi
movsbl -0x11(%rbp),%esi
call   1060 <ici_bos_kare@plt>
jmp    126c <main+0x11c>
mov    -0x10(%rbp),%edi
movsbl -0x11(%rbp),%esi
call   1040 <dik_ucgen@plt>
jmp    126c <main+0x11c>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
jmp    1172 <main+0x22>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xf2b(%rip),%rdi
call   1030 <puts@plt>
lea    0xf57(%rip),%r12
lea    0xe78(%rip),%r13
lea    0xee8(%rip),%rbx
lea    0x14(%rsp),%rbp
lea    0x10(%rsp),%r14
lea    0xf(%rsp),%r15
jmp    11aa <main+0x4a>
movsbl 0xf(%rsp),%esi
call   1050 <dik_ucgen@plt>
lea    0xf11(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0c(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
mov    %r13,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
call   1080 <scanf@plt>
mov    0x14(%rsp),%eax
cmp    $0xffffffff,%eax
je     1241 <main+0xe1>
mov    0x10(%rsp),%edi
cmp    $0xffffffff,%edi
je     1241 <main+0xe1>
cmp    $0x3,%eax
je     11a0 <main+0x40>
cmp    $0x2,%eax
je     1220 <main+0xc0>
cmp    $0x1,%eax
jne    1230 <main+0xd0>
movsbl 0xf(%rsp),%esi
call   1060 <kare@plt>
jmp    11aa <main+0x4a>
movsbl 0xf(%rsp),%esi
call   1070 <ici_bos_kare@plt>
jmp    11aa <main+0x4a>
nop
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
jmp    11aa <main+0x4a>
lea    0xe37(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Programdan cikmak icin -1 giriniz\0A\00"
@.str.1 = [8 x i8] c"1-Kare\0A\00"
@.str.2 = [16 x i8] c"2-Ici Bos Kare\0A\00"
@.str.3 = [13 x i8] c"3-Dik Ucgen\0A\00"
@.str.4 = [119 x i8] c"Cizilmesi istediginiz seklin numarasini boyutunu ve hangi karakterle cizilcegini giriniz(Ornek girdi formati:1 10 a): \00"
@.str.5 = [8 x i8] c"%d%d %c\00"
@.str.6 = [33 x i8] c"Programdan basariyla ciktiniz :)\00"
@.str.7 = [34 x i8] c"Yanlis sekil numarasi girdiniz!!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i32 0, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %7
7: ; preds = %39, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 1
br i1 %9, label %10, label %40
10: ; preds = %7
%11 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
store i32 0, i32* %4
%14 = call i32 @printf(i8* getelementptr inbounds ([119 x i8], [119 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32* %3, i32* %4, i8* %5)
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, -1
br i1 %17, label %21, label %18
18: ; preds = %10
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %23
21: ; preds = %18, %10
%22 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
br label %40
23: ; preds = %18
%24 = load i32, i32* %3
switch i32 %24, label %37 [
i32 1, label %25
i32 2, label %29
i32 3, label %33
]
25: ; preds = %23
%26 = load i32, i32* %4
%27 = load i8, i8* %5
%28 = call i32 @kare(i32 %26, i8 signext %27)
br label %39
29: ; preds = %23
%30 = load i32, i32* %4
%31 = load i8, i8* %5
%32 = call i32 @ici_bos_kare(i32 %30, i8 signext %31)
br label %39
33: ; preds = %23
%34 = load i32, i32* %4
%35 = load i8, i8* %5
%36 = call i32 @dik_ucgen(i32 %34, i8 signext %35)
br label %39
37: ; preds = %23
%38 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
br label %39
39: ; preds = %37, %33, %29, %25
br label %7
40: ; preds = %21, %7
ret i32 0
}

LLVM IR (-O2):
@.str.4 = [119 x i8] c"Cizilmesi istediginiz seklin numarasini boyutunu ve hangi karakterle cizilcegini giriniz(Ornek girdi formati:1 10 a): \00"
@.str.5 = [8 x i8] c"%d%d %c\00"
@.str.6 = [33 x i8] c"Programdan basariyla ciktiniz :)\00"
@str = [34 x i8] c"Programdan cikmak icin -1 giriniz\00"
@str.8 = [7 x i8] c"1-Kare\00"
@str.9 = [15 x i8] c"2-Ici Bos Kare\00"
@str.10 = [12 x i8] c"3-Dik Ucgen\00"
@str.11 = [33 x i8] c"Yanlis sekil numarasi girdiniz!!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
br label %7
7: ; preds = %30, %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.8, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.9, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.10, i64 0, i64 0))
store i32 0, i32* %1
store i32 0, i32* %2
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([119 x i8], [119 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32* %1, i32* %2, i8* %3)
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, -1
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, -1
%17 = select i1 %14, i1 true, i1 %16
br i1 %17, label %31, label %18
18: ; preds = %7
switch i32 %13, label %28 [
i32 1, label %19
i32 2, label %22
i32 3, label %25
]
19: ; preds = %18
%20 = load i8, i8* %3
%21 = call i32 @kare(i32 %15, i8 signext %20)
br label %30
22: ; preds = %18
%23 = load i8, i8* %3
%24 = call i32 @ici_bos_kare(i32 %15, i8 signext %23)
br label %30
25: ; preds = %18
%26 = load i8, i8* %3
%27 = call i32 @dik_ucgen(i32 %15, i8 signext %26)
br label %30
28: ; preds = %18
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.11, i64 0, i64 0))
br label %30
30: ; preds = %19, %22, %25, %28
br label %7
31: ; preds = %7
%32 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}