#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 /*<<< orphan*/ sorgulama(int *, int, int);
int main() {
  int sayi_sayisi, i, sorgulanacak;
  int dizi[20];
  int deney = 0;
  printf("Kac sayi: ");
  scanf("%d", &sayi_sayisi);
  while (sayi_sayisi > 20) {
    printf("Hata!! En fazla 20 sayi girebilir\n");
    printf("Kac sayi: ");
    scanf("%d", &sayi_sayisi);
    deney++;
    if (deney > 2 && sayi_sayisi <= 20) {
      printf("Aferim!\n");
    } else if (deney > 10) {
      printf("Kullanci aptal!!\n");
      return 0;
    } else
      ;
  }
  for (i = 1; i <= sayi_sayisi; i++) {
    printf("%d sayi girin: ", i);
    scanf("%d", &dizi[i - 1]);
  }
  printf("Girilen sayilar:\n");
  for (i = 1; i <= sayi_sayisi; i++) {
    printf("%d\t\n", dizi[i - 1]);
  }
  printf("Sorgulanacak sayi: ");
  scanf("%d", &sorgulanacak);
  sorgulama(dizi, sayi_sayisi, sorgulanacak);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x64(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x14,-0x8(%rbp)
jle    11fd <main+0xcd>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe7a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
cmpl   $0x2,-0x64(%rbp)
jle    11ca <main+0x9a>
cmpl   $0x14,-0x8(%rbp)
jg     11ca <main+0x9a>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11f8 <main+0xc8>
cmpl   $0xa,-0x64(%rbp)
jle    11ee <main+0xbe>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12cb <main+0x19b>
jmp    11f3 <main+0xc3>
jmp    11f8 <main+0xc8>
jmp    1164 <main+0x34>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     124e <main+0x11e>
mov    -0xc(%rbp),%esi
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cltq
lea    -0x60(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xdd0(%rip),%rdi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1204 <main+0xd4>
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1297 <main+0x167>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x60(%rbp,%rax,4),%esi
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1263 <main+0x133>
lea    0xdd5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd5f(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <sorgulama@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xeab(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea8(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    $0x15,%eax
jl     11ea <main+0xaa>
lea    0xecb(%rip),%r14
lea    0xe7c(%rip),%r15
lea    0xe80(%rip),%r12
lea    0x8(%rsp),%rbx
lea    0xee4(%rip),%r13
xor    %ebp,%ebp
jmp    11b1 <main+0x71>
nopl   0x0(%rax,%rax,1)
cmp    $0xa,%ebp
jae    12be <main+0x17e>
add    $0x1,%ebp
cmp    $0x14,%eax
jle    11ea <main+0xaa>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    $0x2,%ebp
jb     11a0 <main+0x60>
cmp    $0x14,%eax
jg     11a0 <main+0x60>
mov    %r13,%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%eax
jmp    11a9 <main+0x69>
test   %eax,%eax
jle    1239 <main+0xf9>
lea    0x10(%rsp),%r12
lea    0xe14(%rip),%r14
lea    0xe0a(%rip),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <scanf@plt>
movslq 0x8(%rsp),%rax
add    $0x4,%r12
cmp    %rax,%rbx
jl     1210 <main+0xd0>
lea    0xdf7(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0x8(%rsp)
jle    127c <main+0x13c>
lea    0xdcb(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x10(%rsp,%rbp,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movslq 0x8(%rsp),%rax
add    $0x1,%rbp
cmp    %rax,%rbp
jl     1260 <main+0x120>
lea    0xda0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd7a(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
lea    0x10(%rsp),%rdi
call   1030 <sorgulama@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xda5(%rip),%rdi
call   1040 <puts@plt>
jmp    12ad <main+0x16d>

LLVM IR (-O0):
@.str = [11 x i8] c"Kac sayi: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [35 x i8] c"Hata!! En fazla 20 sayi girebilir\0A\00"
@.str.3 = [9 x i8] c"Aferim!\0A\00"
@.str.4 = [18 x i8] c"Kullanci aptal!!\0A\00"
@.str.5 = [16 x i8] c"%d sayi girin: \00"
@.str.6 = [18 x i8] c"Girilen sayilar:\0A\00"
@.str.7 = [5 x i8] c"%d\09\0A\00"
@.str.8 = [20 x i8] c"Sorgulanacak sayi: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [20 x i32]
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %9
9: ; preds = %32, %0
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 20
br i1 %11, label %12, label %33
12: ; preds = %9
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%16 = load i32, i32* %6
%17 = add nsw i32 %16, 1
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = icmp sgt i32 %18, 2
br i1 %19, label %20, label %25
20: ; preds = %12
%21 = load i32, i32* %2
%22 = icmp sle i32 %21, 20
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %32
25: ; preds = %20, %12
%26 = load i32, i32* %6
%27 = icmp sgt i32 %26, 10
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %1
br label %72
30: ; preds = %25
br label %31
31: ; preds = %30
br label %32
32: ; preds = %31, %23
br label %9
33: ; preds = %9
store i32 1, i32* %3
br label %34
34: ; preds = %46, %33
%35 = load i32, i32* %3
%36 = load i32, i32* %2
%37 = icmp sle i32 %35, %36
br i1 %37, label %38, label %49
38: ; preds = %34
%39 = load i32, i32* %3
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %39)
%41 = load i32, i32* %3
%42 = sub nsw i32 %41, 1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [20 x i32], [20 x i32]* %5, i64 0, i64 %43
%45 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %44)
br label %46
46: ; preds = %38
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 1
store i32 %48, i32* %3
br label %34
49: ; preds = %34
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %3
br label %51
51: ; preds = %62, %49
%52 = load i32, i32* %3
%53 = load i32, i32* %2
%54 = icmp sle i32 %52, %53
br i1 %54, label %55, label %65
55: ; preds = %51
%56 = load i32, i32* %3
%57 = sub nsw i32 %56, 1
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [20 x i32], [20 x i32]* %5, i64 0, i64 %58
%60 = load i32, i32* %59
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %60)
br label %62
62: ; preds = %55
%63 = load i32, i32* %3
%64 = add nsw i32 %63, 1
store i32 %64, i32* %3
br label %51
65: ; preds = %51
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%67 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%68 = getelementptr inbounds [20 x i32], [20 x i32]* %5, i64 0, i64 0
%69 = load i32, i32* %2
%70 = load i32, i32* %4
%71 = call i32 @sorgulama(i32* %68, i32 %69, i32 %70)
store i32 0, i32* %1
br label %72
72: ; preds = %65, %28
%73 = load i32, i32* %1
ret i32 %73
}

LLVM IR (-O2):
@.str = [11 x i8] c"Kac sayi: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.5 = [16 x i8] c"%d sayi girin: \00"
@.str.7 = [5 x i8] c"%d\09\0A\00"
@.str.8 = [20 x i8] c"Sorgulanacak sayi: \00"
@str = [17 x i8] c"Girilen sayilar:\00"
@str.9 = [34 x i8] c"Hata!! En fazla 20 sayi girebilir\00"
@str.10 = [17 x i8] c"Kullanci aptal!!\00"
@str.11 = [8 x i8] c"Aferim!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [20 x i32]
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast [20 x i32]* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 20
br i1 %10, label %14, label %11
11: ; preds = %31, %0
%12 = phi i32 [ %9, %0 ], [ %32, %31 ]
%13 = icmp slt i32 %12, 1
br i1 %13, label %45, label %34
14: ; preds = %0, %31
%15 = phi i32 [ %19, %31 ], [ 0, %0 ]
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.9, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%19 = add nuw nsw i32 %15, 1
%20 = icmp ugt i32 %15, 1
%21 = load i32, i32* %1
%22 = icmp slt i32 %21, 21
%23 = select i1 %20, i1 %22, i1 false
br i1 %23, label %24, label %27
24: ; preds = %14
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.11, i64 0, i64 0))
%26 = load i32, i32* %1
br label %31
27: ; preds = %14
%28 = icmp ugt i32 %15, 9
br i1 %28, label %29, label %31
29: ; preds = %27
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.10, i64 0, i64 0))
br label %66
31: ; preds = %27, %24
%32 = phi i32 [ %21, %27 ], [ %26, %24 ]
%33 = icmp sgt i32 %32, 20
br i1 %33, label %14, label %11
34: ; preds = %11, %34
%35 = phi i64 [ %41, %34 ], [ 1, %11 ]
%36 = trunc i64 %35 to i32
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %36)
%38 = add nsw i64 %35, -1
%39 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %38
%40 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %39)
%41 = add nuw nsw i64 %35, 1
%42 = load i32, i32* %1
%43 = sext i32 %42 to i64
%44 = icmp slt i64 %35, %43
br i1 %44, label %34, label %45
45: ; preds = %34, %11
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%47 = load i32, i32* %1
%48 = icmp slt i32 %47, 1
br i1 %48, label %59, label %49
49: ; preds = %45, %49
%50 = phi i64 [ %55, %49 ], [ 1, %45 ]
%51 = add nsw i64 %50, -1
%52 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %51
%53 = load i32, i32* %52
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %53)
%55 = add nuw nsw i64 %50, 1
%56 = load i32, i32* %1
%57 = sext i32 %56 to i64
%58 = icmp slt i64 %50, %57
br i1 %58, label %49, label %59
59: ; preds = %49, %45
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%61 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%62 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
%63 = load i32, i32* %1
%64 = load i32, i32* %2
%65 = call i32 @sorgulama(i32* %62, i32 %63, i32 %64)
br label %66
66: ; preds = %59, %29
ret i32 0
}