#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_s(char *, int *);
int /*<<< orphan*/ system(char *);
void main() {
  int i = 0, ogr_durum;
  int gecen_toplam = 0, kalan_toplam = 0;
  while (i < 10) {
    printf("Durumu giriniz: ");
    scanf_s("%d", &ogr_durum);
    if (ogr_durum == 0)
      kalan_toplam = kalan_toplam + 1;
    if (ogr_durum == 1)
      gecen_toplam = gecen_toplam + 1;
    else {
      printf("Hatali giris:");
      i--;
    }
    i++;
  }
  printf("Gecenlerin sayisi: %d", gecen_toplam);
  printf("Kalanlarin sayisi: %d", kalan_toplam);
  system("pause");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    11c5 <main+0x95>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xedc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf_s@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1188 <main+0x58>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11a0 <main+0x70>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b7 <main+0x87>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    114d <main+0x1d>
mov    -0xc(%rbp),%esi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe5d(%rip),%rdi
call   1030 <system@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%r14
lea    0xeff(%rip),%r15
lea    0x4(%rsp),%r12
xor    %ebx,%ebx
xor    %ebp,%ebp
xor    %r13d,%r13d
jmp    117f <main+0x4f>
nopw   0x0(%rax,%rax,1)
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%r13d
lea    0x1(%r13),%eax
cmp    $0x9,%r13d
mov    %eax,%r13d
jge    11a8 <main+0x78>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf_s@plt>
mov    0x4(%rsp),%eax
cmp    $0x1,%eax
adc    $0x0,%ebx
cmp    $0x1,%eax
jne    1160 <main+0x30>
add    $0x1,%ebp
jmp    1172 <main+0x42>
lea    0xe70(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe76(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe7c(%rip),%rdi
call   1030 <system@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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