#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);
char getchar();
int /*<<< orphan*/ printf(char *, char *);
long strlen(char *);
char tolower(char);
void clapt_confirm(char *prog) {
  long s;
  char cnf;
  printf(
      "%s: Running updates, upgrade, virus scan and cleaning. Continue? (Y/n) ",
      prog);
  cnf = getchar();
  if ((s = strlen(&cnf)) > 0) {
    if (tolower(cnf) == 'n' && tolower(cnf) != 'y') {
      printf("%s: Exiting...\n", prog);
      exit(1);
    }
  }
}


x86 assembly (clang, -O0):
<clapt_confirm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x11(%rbp)
lea    -0x11(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jle    11d6 <clapt_confirm+0x86>
movsbl -0x11(%rbp),%edi
call   1060 <tolower@plt>
movsbl %al,%eax
cmp    $0x6e,%eax
jne    11d1 <clapt_confirm+0x81>
movsbl -0x11(%rbp),%edi
call   1060 <tolower@plt>
movsbl %al,%eax
cmp    $0x79,%eax
je     11d1 <clapt_confirm+0x81>
mov    -0x8(%rbp),%rsi
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
jmp    11d6 <clapt_confirm+0x86>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clapt_confirm>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xea2(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
mov    %al,0x7(%rsp)
lea    0x7(%rsp),%rdi
call   1030 <strlen@plt>
test   %rax,%rax
jle    119b <clapt_confirm+0x4b>
movsbl %bl,%ebx
mov    %ebx,%edi
call   1060 <tolower@plt>
cmp    $0x6e,%al
jne    119b <clapt_confirm+0x4b>
mov    %ebx,%edi
call   1060 <tolower@plt>
cmp    $0x79,%al
jne    11a3 <clapt_confirm+0x53>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe9e(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [72 x i8] c"%s: Running updates, upgrade, virus scan and cleaning. Continue? (Y/n) \00"
@.str.1 = [16 x i8] c"%s: Exiting...\0A\00"
define void @clapt_confirm(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = call signext i8 (...) @getchar()
store i8 %7, i8* %4
%8 = call i64 @strlen(i8* %4)
store i64 %8, i64* %3
%9 = icmp sgt i64 %8, 0
br i1 %9, label %10, label %25
10: ; preds = %1
%11 = load i8, i8* %4
%12 = call signext i8 @tolower(i8 signext %11)
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 110
br i1 %14, label %15, label %24
15: ; preds = %10
%16 = load i8, i8* %4
%17 = call signext i8 @tolower(i8 signext %16)
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 121
br i1 %19, label %20, label %24
20: ; preds = %15
%21 = load i8*, i8** %2
%22 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %21)
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %15, %10
br label %25
25: ; preds = %24, %1
ret void
}

LLVM IR (-O2):
@.str = [72 x i8] c"%s: Running updates, upgrade, virus scan and cleaning. Continue? (Y/n) \00"
@.str.1 = [16 x i8] c"%s: Exiting...\0A\00"
define void @clapt_confirm(i8* %0) {
%2 = alloca i8
%3 = tail call i32 @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call signext i8 (...) @getchar()
store i8 %4, i8* %2
%5 = call i64 @strlen(i8* %2)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = tail call signext i8 @tolower(i8 signext %4)
%9 = icmp eq i8 %8, 110
br i1 %9, label %10, label %16
10: ; preds = %7
%11 = tail call signext i8 @tolower(i8 signext %4)
%12 = icmp eq i8 %11, 121
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %7, %10, %1
ret void
}