#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*/ exit(int);
int /*<<< orphan*/ fixbadanswer(char *, int /*<<< orphan*/ (*)());
scalar_t__ isbadanswer(char *);
int /*<<< orphan*/ msg_continue();
int /*<<< orphan*/ msg_exit();
int /*<<< orphan*/ msg_help1();
int /*<<< orphan*/ msg_help2();
int /*<<< orphan*/ msg_welcome();
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
void flag_help() {
  char answer[127];
  msg_welcome();
  msg_help1();
  msg_help2();
  msg_continue();
  scanf("%s", answer);
  if (isbadanswer(answer))
    strcpy(answer, fixbadanswer(answer, msg_continue));
  if (!strcmp(answer, "no") || !strcmp(answer, "No")) {
    msg_exit();
    exit(1);
  }
  return;
}


x86 assembly (clang, -O0):
<flag_help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    $0x0,%al
call   1050 <msg_welcome@plt>
mov    $0x0,%al
call   1060 <msg_help1@plt>
mov    $0x0,%al
call   10a0 <msg_help2@plt>
mov    $0x0,%al
call   10d8 <msg_continue@plt>
lea    -0x80(%rbp),%rsi
lea    0xe2e(%rip),%rdi
call   1090 <scanf@plt>
lea    -0x80(%rbp),%rdi
call   10b0 <isbadanswer@plt>
cmp    $0x0,%rax
je     1213 <flag_help+0x73>
lea    -0x80(%rbp),%rax
mov    %rax,-0x88(%rbp)
lea    -0x80(%rbp),%rdi
mov    0x2df8(%rip),%rsi
call   1040 <fixbadanswer@plt>
mov    -0x88(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    -0x80(%rbp),%rdi
lea    0xde5(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
je     1245 <flag_help+0xa5>
lea    -0x80(%rbp),%rdi
lea    0xdcf(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    1256 <flag_help+0xb6>
mov    $0x0,%al
call   1080 <msg_exit@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flag_help>:
push   %rbx
sub    $0x80,%rsp
xor    %eax,%eax
call   1050 <msg_welcome@plt>
xor    %eax,%eax
call   1060 <msg_help1@plt>
xor    %eax,%eax
call   1090 <msg_help2@plt>
xor    %eax,%eax
call   10c8 <msg_continue@plt>
lea    0xe45(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1080 <scanf@plt>
mov    %rbx,%rdi
call   10a0 <isbadanswer@plt>
test   %rax,%rax
je     11ef <flag_help+0x5f>
mov    0x2e1e(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <fixbadanswer@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    $0x6f6e,%eax
xor    (%rsp),%eax
movzbl 0x2(%rsp),%ecx
or     %ax,%cx
je     121c <flag_help+0x8c>
mov    $0x6f4e,%eax
xor    (%rsp),%eax
movzbl 0x2(%rsp),%ecx
or     %ax,%cx
je     121c <flag_help+0x8c>
add    $0x80,%rsp
pop    %rbx
ret
xor    %eax,%eax
call   1070 <msg_exit@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"no\00"
@.str.2 = [3 x i8] c"No\00"
define void @flag_help() {
%1 = alloca [127 x i8]
%2 = call i32 (...) @msg_welcome()
%3 = call i32 (...) @msg_help1()
%4 = call i32 (...) @msg_help2()
%5 = call i32 (...) @msg_continue()
%6 = getelementptr inbounds [127 x i8], [127 x i8]* %1, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [127 x i8], [127 x i8]* %1, i64 0, i64 0
%9 = call i64 @isbadanswer(i8* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %0
%12 = getelementptr inbounds [127 x i8], [127 x i8]* %1, i64 0, i64 0
%13 = getelementptr inbounds [127 x i8], [127 x i8]* %1, i64 0, i64 0
%14 = call i32 @fixbadanswer(i8* %13, i32 (...)* @msg_continue)
%15 = call i32 @strcpy(i8* %12, i32 %14)
br label %16
16: ; preds = %11, %0
%17 = getelementptr inbounds [127 x i8], [127 x i8]* %1, i64 0, i64 0
%18 = call i32 @strcmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = getelementptr inbounds [127 x i8], [127 x i8]* %1, i64 0, i64 0
%22 = call i32 @strcmp(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp ne i32 %22, 0
br i1 %23, label %27, label %24
24: ; preds = %20, %16
%25 = call i32 (...) @msg_exit()
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %20
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"no\00"
@.str.2 = [3 x i8] c"No\00"
define void @flag_help() {
%1 = alloca [127 x i8]
%2 = getelementptr inbounds [127 x i8], [127 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @msg_welcome()
%4 = tail call i32 (...) @msg_help1()
%5 = tail call i32 (...) @msg_help2()
%6 = tail call i32 (...) @msg_continue()
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%8 = call i64 @isbadanswer(i8* %2)
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %0
%11 = call i32 @fixbadanswer(i8* %2, i32 (...)* @msg_continue)
%12 = call i32 @strcpy(i8* %2, i32 %11)
br label %13
13: ; preds = %10, %0
%14 = call i32 @bcmp(i8* dereferenceable(3) %2, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64 3)
%15 = icmp eq i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = call i32 @bcmp(i8* dereferenceable(3) %2, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 3)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16, %13
%20 = call i32 (...) @msg_exit()
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %16
ret void
}