#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 getnextdigit();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ state_0();
int /*<<< orphan*/ state_3();
void state_2(void) {
  int a;
  a = getnextdigit();
  if (-1 == a) {
    printf("You gave me an odd number of 0's.\n");
    printf("You gave me an even number of 1's.\n");
    printf("I therefore reject this input.\n");
    return;
  }
  if (0 == a) {
    state_0();
  }
  if (1 == a) {
    state_3();
  }
}


x86 assembly (clang, -O0):
<state_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getnextdigit@plt>
mov    %eax,-0x4(%rbp)
mov    $0xffffffff,%eax
cmp    -0x4(%rbp),%eax
jne    1189 <state_2+0x49>
lea    0xe99(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb0(%rip),%rdi
call   1050 <printf@plt>
lea    0xec8(%rip),%rdi
call   1050 <printf@plt>
jmp    11b0 <state_2+0x70>
xor    %eax,%eax
cmp    -0x4(%rbp),%eax
jne    119b <state_2+0x5b>
mov    $0x0,%al
call   1040 <state_0@plt>
mov    $0x1,%eax
cmp    -0x4(%rbp),%eax
jne    11b0 <state_2+0x70>
mov    $0x0,%al
call   1060 <state_3@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<state_2>:
push   %rax
xor    %eax,%eax
call   1030 <getnextdigit@plt>
cmp    $0x1,%eax
je     117b <state_2+0x3b>
test   %eax,%eax
je     1183 <state_2+0x43>
cmp    $0xffffffff,%eax
jne    118b <state_2+0x4b>
lea    0xea3(%rip),%rdi
call   1050 <puts@plt>
lea    0xeb9(%rip),%rdi
call   1050 <puts@plt>
lea    0xed0(%rip),%rdi
pop    %rax
jmp    1050 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <state_3@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <state_0@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [35 x i8] c"You gave me an odd number of 0's.\0A\00"
@.str.1 = [36 x i8] c"You gave me an even number of 1's.\0A\00"
@.str.2 = [32 x i8] c"I therefore reject this input.\0A\00"
define void @state_2() {
%1 = alloca i32
%2 = call i32 (...) @getnextdigit()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp eq i32 -1, %3
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
br label %19
9: ; preds = %0
%10 = load i32, i32* %1
%11 = icmp eq i32 0, %10
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 (...) @state_0()
br label %14
14: ; preds = %12, %9
%15 = load i32, i32* %1
%16 = icmp eq i32 1, %15
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 (...) @state_3()
br label %19
19: ; preds = %5, %17, %14
ret void
}

LLVM IR (-O2):
@str = [34 x i8] c"You gave me an odd number of 0's.\00"
@str.3 = [35 x i8] c"You gave me an even number of 1's.\00"
@str.4 = [31 x i8] c"I therefore reject this input.\00"
define void @state_2() {
%1 = tail call i32 (...) @getnextdigit()
switch i32 %1, label %10 [
i32 -1, label %2
i32 0, label %6
i32 1, label %8
]
2: ; preds = %0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.3, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.4, i64 0, i64 0))
br label %10
6: ; preds = %0
%7 = tail call i32 (...) @state_0()
br label %10
8: ; preds = %0
%9 = tail call i32 (...) @state_3()
br label %10
10: ; preds = %6, %8, %0, %2
ret void
}