#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 scanf(char *, char *);
int do_next_entry() {
  int resp, ok = 0, i;
  char ans;
  char possible[4] = {'N', 'Y', 'n', 'y'};
  do {
    printf("Sledeci unos? [Y/n]: ");
    resp = scanf("%c", &ans);
    if (resp == 0)
      return 1;
    if (resp != 1)
      break;
    for (i = 0; i < 4; i++) {
      if (ans == possible[i]) {
        ok = i;
        break;
      }
    }
  } while (!ok);
  return ans % 2;
}


x86 assembly (clang, -O0):
<do_next_entry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0xc(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0x15(%rbp)
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    -0x11(%rbp),%rsi
call   1040 <scanf@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    116d <do_next_entry+0x4d>
movl   $0x1,-0x4(%rbp)
jmp    11e5 <do_next_entry+0xc5>
cmpl   $0x1,-0x8(%rbp)
je     117c <do_next_entry+0x5c>
jmp    11d6 <do_next_entry+0xb6>
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    11c0 <do_next_entry+0xa0>
movsbl -0x11(%rbp),%eax
movslq -0x10(%rbp),%rcx
movsbl -0x15(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    11ad <do_next_entry+0x8d>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11c0 <do_next_entry+0xa0>
jmp    11b2 <do_next_entry+0x92>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1183 <do_next_entry+0x63>
jmp    11c5 <do_next_entry+0xa5>
cmpl   $0x0,-0xc(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1138 <do_next_entry+0x18>
movsbl -0x11(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_next_entry>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%r14
lea    0xedf(%rip),%r15
lea    0xf(%rsp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x1,%ecx
jne    1175 <do_next_entry+0x55>
movzbl 0xf(%rsp),%ecx
cmp    $0x79,%cl
je     1190 <do_next_entry+0x70>
cmp    $0x6e,%cl
je     118e <do_next_entry+0x6e>
cmp    $0x59,%cl
jne    1140 <do_next_entry+0x20>
jmp    1190 <do_next_entry+0x70>
test   %ecx,%ecx
je     1190 <do_next_entry+0x70>
mov    0xf(%rsp),%al
mov    %eax,%ecx
shr    $0x7,%cl
add    %al,%cl
and    $0xfe,%cl
sub    %cl,%al
movsbl %al,%eax
jmp    1190 <do_next_entry+0x70>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.do_next_entry.possible = [4 x i8] c"NYny"
@.str = [22 x i8] c"Sledeci unos? [Y/n]: \00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @do_next_entry() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = alloca [4 x i8]
store i32 0, i32* %3
%7 = bitcast [4 x i8]* %6 to i8*
br label %8
8: ; preds = %38, %0
%9 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %8
store i32 1, i32* %1
br label %46
14: ; preds = %8
%15 = load i32, i32* %2
%16 = icmp ne i32 %15, 1
br i1 %16, label %17, label %18
17: ; preds = %14
br label %42
18: ; preds = %14
store i32 0, i32* %4
br label %19
19: ; preds = %34, %18
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 4
br i1 %21, label %22, label %37
22: ; preds = %19
%23 = load i8, i8* %5
%24 = sext i8 %23 to i32
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %24, %29
br i1 %30, label %31, label %33
31: ; preds = %22
%32 = load i32, i32* %4
store i32 %32, i32* %3
br label %37
33: ; preds = %22
br label %34
34: ; preds = %33
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
br label %19
37: ; preds = %31, %19
br label %38
38: ; preds = %37
%39 = load i32, i32* %3
%40 = icmp ne i32 %39, 0
%41 = xor i1 %40, true
br i1 %41, label %8, label %42
42: ; preds = %38, %17
%43 = load i8, i8* %5
%44 = sext i8 %43 to i32
%45 = srem i32 %44, 2
store i32 %45, i32* %1
br label %46
46: ; preds = %42, %13
%47 = load i32, i32* %1
ret i32 %47
}

LLVM IR (-O2):
@.str = [22 x i8] c"Sledeci unos? [Y/n]: \00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @do_next_entry() {
%1 = alloca i8
br label %2
2: ; preds = %9, %0
%3 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 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), i8* %1)
switch i32 %4, label %5 [
i32 0, label %11
i32 1, label %9
]
5: ; preds = %2
%6 = load i8, i8* %1
%7 = srem i8 %6, 2
%8 = sext i8 %7 to i32
br label %13
9: ; preds = %2
%10 = load i8, i8* %1
switch i8 %10, label %2 [
i8 121, label %13
i8 89, label %13
i8 110, label %11
]
11: ; preds = %9, %2
%12 = phi i32 [ 1, %2 ], [ 0, %9 ]
br label %13
13: ; preds = %9, %9, %11, %5
%14 = phi i32 [ %8, %5 ], [ %12, %11 ], [ 1, %9 ], [ 1, %9 ]
ret i32 %14
}