#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*/ finishedState();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ startState();
void finishingState() {
  printf("Thank You For Buying Our Item\n");
  printf("Do You Want Another Item- Y(Yes) or N(No):");
  char choice;
  scanf(" %c", &choice);
  if (choice == 'Y')
    startState();
  if (choice == 'N')
    finishedState();
}


x86 assembly (clang, -O0):
<finishingState>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x59,%eax
jne    1184 <finishingState+0x44>
mov    $0x0,%al
call   1050 <startState@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x4e,%eax
jne    1198 <finishingState+0x58>
mov    $0x0,%al
call   1060 <finishedState@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<finishingState>:
push   %rax
lea    0xed7(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
lea    0xebb(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x7(%rsp),%al
cmp    $0x59,%al
je     1188 <finishingState+0x38>
cmp    $0x4e,%al
je     1197 <finishingState+0x47>
pop    %rax
ret
xor    %eax,%eax
call   1060 <startState@plt>
mov    0x7(%rsp),%al
cmp    $0x4e,%al
jne    1186 <finishingState+0x36>
xor    %eax,%eax
call   1070 <finishedState@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Thank You For Buying Our Item\0A\00"
@.str.1 = [43 x i8] c"Do You Want Another Item- Y(Yes) or N(No):\00"
@.str.2 = [4 x i8] c" %c\00"
define void @finishingState() {
%1 = alloca i8
%2 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 89
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (...) @startState()
br label %10
10: ; preds = %8, %0
%11 = load i8, i8* %1
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 78
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 (...) @finishedState()
br label %16
16: ; preds = %14, %10
ret void
}

LLVM IR (-O2):
@.str.1 = [43 x i8] c"Do You Want Another Item- Y(Yes) or N(No):\00"
@.str.2 = [4 x i8] c" %c\00"
@str = [30 x i8] c"Thank You For Buying Our Item\00"
define void @finishingState() {
%1 = alloca i8
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%5 = load i8, i8* %1
%6 = icmp eq i8 %5, 89
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = call i32 (...) @startState()
%9 = load i8, i8* %1
br label %10
10: ; preds = %7, %0
%11 = phi i8 [ %9, %7 ], [ %5, %0 ]
%12 = icmp eq i8 %11, 78
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 (...) @finishedState()
br label %15
15: ; preds = %13, %10
ret void
}