#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 EOF;
int getchar();
int rand();
int /*<<< orphan*/ recogniser1();
int /*<<< orphan*/ recogniser2();
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/);
int main() {
  int input;
  while ((input = getchar()) != EOF) {
    ungetc(input, stdin);
    int recogniser = rand() % 2;
    switch (recogniser) {
    case 0:
      recogniser1();
      break;
    case 1:
      recogniser2();
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e70(%rip),%rcx
cmp    (%rcx),%eax
je     11dd <main+0x8d>
mov    -0x8(%rbp),%edi
mov    0x2e66(%rip),%rax
mov    (%rax),%esi
call   1050 <ungetc@plt>
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%edx
shr    $0x1f,%edx
mov    %eax,%ecx
add    %edx,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     11c5 <main+0x75>
jmp    11b4 <main+0x64>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     11d1 <main+0x81>
jmp    11d8 <main+0x88>
mov    $0x0,%al
call   1060 <recogniser1@plt>
jmp    11d8 <main+0x88>
mov    $0x0,%al
call   1030 <recogniser2@plt>
jmp    115f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2e7e(%rip),%rbx
cmp    (%rbx),%eax
jne    1170 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e71(%rip),%r14
jmp    1192 <main+0x42>
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <recogniser2@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%eax
je     1166 <main+0x16>
mov    (%r14),%esi
mov    %eax,%edi
call   1050 <ungetc@plt>
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%eax
cmp    $0x1,%eax
je     1180 <main+0x30>
test   %eax,%eax
jne    1187 <main+0x37>
xor    %eax,%eax
call   1060 <recogniser1@plt>
jmp    1187 <main+0x37>

LLVM IR (-O0):
@EOF = global i32 0
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %19, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %2
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %20
8: ; preds = %4
%9 = load i32, i32* %2
%10 = load i32, i32* @stdin
%11 = call i32 @ungetc(i32 %9, i32 %10)
%12 = call i32 (...) @rand()
%13 = srem i32 %12, 2
store i32 %13, i32* %3
%14 = load i32, i32* %3
switch i32 %14, label %19 [
i32 0, label %15
i32 1, label %17
]
15: ; preds = %8
%16 = call i32 (...) @recogniser1()
br label %19
17: ; preds = %8
%18 = call i32 (...) @recogniser2()
br label %19
19: ; preds = %8, %17, %15
br label %4
20: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@stdin = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %18, label %4
4: ; preds = %0, %14
%5 = phi i32 [ %15, %14 ], [ %1, %0 ]
%6 = load i32, i32* @stdin
%7 = tail call i32 @ungetc(i32 %5, i32 %6)
%8 = tail call i32 (...) @rand()
%9 = srem i32 %8, 2
switch i32 %9, label %14 [
i32 0, label %10
i32 1, label %12
]
10: ; preds = %4
%11 = tail call i32 (...) @recogniser1()
br label %14
12: ; preds = %4
%13 = tail call i32 (...) @recogniser2()
br label %14
14: ; preds = %4, %12, %10
%15 = tail call i32 (...) @getchar()
%16 = load i32, i32* @EOF
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %4
18: ; preds = %14, %0
ret i32 0
}