#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 c40_getchar();
int /*<<< orphan*/ c40_printf(char *, ...);
unsigned long parity_enable(void) {
  c40_printf("\n\nEnable parity (y/n)?");
  while (1) {
    switch (c40_getchar()) {
    case 'Y':
    case 'y':
      c40_printf("\n");
      return (1);
    case 'N':
    case 'n':
      c40_printf("\n");
      return (0);
    default:
      c40_printf("%c", 7);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<parity_enable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1040 <c40_printf@plt>
xor    %eax,%eax
call   1030 <c40_getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0xc(%rbp)
sub    $0x4e,%eax
je     119e <parity_enable+0x7e>
jmp    1150 <parity_enable+0x30>
mov    -0xc(%rbp),%eax
sub    $0x59,%eax
je     1183 <parity_enable+0x63>
jmp    1161 <parity_enable+0x41>
mov    -0xc(%rbp),%eax
sub    $0x6e,%eax
je     119e <parity_enable+0x7e>
jmp    1172 <parity_enable+0x52>
mov    -0xc(%rbp),%eax
sub    $0x79,%eax
jne    11b9 <parity_enable+0x99>
jmp    1183 <parity_enable+0x63>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1040 <c40_printf@plt>
movq   $0x1,-0x8(%rbp)
jmp    11d1 <parity_enable+0xb1>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <c40_printf@plt>
movq   $0x0,-0x8(%rbp)
jmp    11d1 <parity_enable+0xb1>
lea    0xe59(%rip),%rdi
mov    $0x7,%esi
mov    $0x0,%al
call   1040 <c40_printf@plt>
jmp    1136 <parity_enable+0x16>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parity_enable>:
push   %rbx
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1040 <c40_printf@plt>
lea    0xee3(%rip),%rbx
jmp    114f <parity_enable+0x2f>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <c40_printf@plt>
xor    %eax,%eax
call   1030 <c40_getchar@plt>
cmp    $0x6d,%eax
jg     1170 <parity_enable+0x50>
cmp    $0x4e,%eax
je     1181 <parity_enable+0x61>
cmp    $0x59,%eax
jne    1140 <parity_enable+0x20>
jmp    117a <parity_enable+0x5a>
nopw   0x0(%rax,%rax,1)
cmp    $0x6e,%eax
je     1181 <parity_enable+0x61>
cmp    $0x79,%eax
jne    1140 <parity_enable+0x20>
mov    $0x1,%ebx
jmp    1183 <parity_enable+0x63>
xor    %ebx,%ebx
lea    0xe8d(%rip),%rdi
xor    %eax,%eax
call   1040 <c40_printf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\0A\0AEnable parity (y/n)?\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [3 x i8] c"%c\00"
define i64 @parity_enable() {
%1 = alloca i64
%2 = call i32 (i8*, ...) @c40_printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %0, %11
%4 = call i32 (...) @c40_getchar()
switch i32 %4, label %9 [
i32 89, label %5
i32 121, label %5
i32 78, label %7
i32 110, label %7
]
5: ; preds = %3, %3
%6 = call i32 (i8*, ...) @c40_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i64 1, i64* %1
br label %12
7: ; preds = %3, %3
%8 = call i32 (i8*, ...) @c40_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i64 0, i64* %1
br label %12
9: ; preds = %3
%10 = call i32 (i8*, ...) @c40_printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 7)
br label %11
11: ; preds = %9
br label %3
12: ; preds = %7, %5
%13 = load i64, i64* %1
ret i64 %13
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0A\0AEnable parity (y/n)?\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [3 x i8] c"%c\00"
define i64 @parity_enable() {
%1 = tail call i32 (i8*, ...) @c40_printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %4
%3 = tail call i32 (...) @c40_getchar()
switch i32 %3, label %4 [
i32 89, label %7
i32 121, label %7
i32 78, label %6
i32 110, label %6
]
4: ; preds = %2
%5 = tail call i32 (i8*, ...) @c40_printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 7)
br label %2
6: ; preds = %2, %2
br label %7
7: ; preds = %2, %2, %6
%8 = phi i64 [ 0, %6 ], [ 1, %2 ], [ 1, %2 ]
%9 = tail call i32 (i8*, ...) @c40_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i64 %8
}