#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 fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char const *,
                           char *, char const *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int _rm_confirm(char const *message, char const *type) {
  int c;
  int tmp;
  fprintf(stderr, "%s%s%s%s%s",
          "rm"
          ": ",
          message, ": Remove ", type, "? ");
  if ((c = fgetc(stdin)) == EOF)
    return 0;
  while (c != '\n' && (tmp = fgetc(stdin)) != EOF && tmp != '\n')
    ;
  return c == 'y';
}


x86 assembly (clang, -O0):
<_rm_confirm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r9
lea    0xeb8(%rip),%rsi
lea    0xebc(%rip),%rdx
lea    0xeba(%rip),%r8
lea    0xebd(%rip),%rax
mov    %rax,(%rsp)
call   1040 <fprintf@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2e62(%rip),%rcx
cmp    (%rcx),%eax
jne    1192 <_rm_confirm+0x72>
movl   $0x0,-0x4(%rbp)
jmp    11fb <_rm_confirm+0xdb>
jmp    1197 <_rm_confirm+0x77>
xor    %eax,%eax
cmpl   $0xa,-0x1c(%rbp)
mov    %al,-0x21(%rbp)
je     11d7 <_rm_confirm+0xb7>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
mov    %eax,%ecx
mov    %ecx,-0x20(%rbp)
xor    %eax,%eax
mov    0x2e1e(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x21(%rbp)
je     11d7 <_rm_confirm+0xb7>
cmpl   $0xa,-0x20(%rbp)
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    11e7 <_rm_confirm+0xc7>
jmp    11ec <_rm_confirm+0xcc>
jmp    1197 <_rm_confirm+0x77>
cmpl   $0x79,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_rm_confirm>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r9
mov    %rdi,%rcx
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rax
mov    %rax,(%rsp)
lea    0xeb7(%rip),%rsi
lea    0xebb(%rip),%rdx
lea    0xeb9(%rip),%r8
call   1040 <fprintf@plt>
mov    0x2e85(%rip),%rbx
mov    (%rbx),%edi
call   1030 <fgetc@plt>
mov    %eax,%r14d
mov    0x2e6c(%rip),%rbp
xor    %eax,%eax
cmp    0x0(%rbp),%r14d
je     11aa <_rm_confirm+0x8a>
cmp    $0xa,%r14d
je     11a1 <_rm_confirm+0x81>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rbx),%edi
call   1030 <fgetc@plt>
cmp    0x0(%rbp),%eax
je     11a1 <_rm_confirm+0x81>
cmp    $0xa,%eax
jne    1190 <_rm_confirm+0x70>
xor    %eax,%eax
cmp    $0x79,%r14d
sete   %al
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [11 x i8] c"%s%s%s%s%s\00"
@.str.1 = [5 x i8] c"rm: \00"
@.str.2 = [10 x i8] c": Remove \00"
@.str.3 = [3 x i8] c"? \00"
@stdin = global i32 0
@EOF = global i32 0
define i32 @_rm_confirm(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%12 = load i32, i32* @stdin
%13 = call i32 @fgetc(i32 %12)
store i32 %13, i32* %6
%14 = load i32, i32* @EOF
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %17
16: ; preds = %2
store i32 0, i32* %3
br label %36
17: ; preds = %2
br label %18
18: ; preds = %31, %17
%19 = load i32, i32* %6
%20 = icmp ne i32 %19, 10
br i1 %20, label %21, label %29
21: ; preds = %18
%22 = load i32, i32* @stdin
%23 = call i32 @fgetc(i32 %22)
store i32 %23, i32* %7
%24 = load i32, i32* @EOF
%25 = icmp ne i32 %23, %24
br i1 %25, label %26, label %29
26: ; preds = %21
%27 = load i32, i32* %7
%28 = icmp ne i32 %27, 10
br label %29
29: ; preds = %26, %21, %18
%30 = phi i1 [ false, %21 ], [ false, %18 ], [ %28, %26 ]
br i1 %30, label %31, label %32
31: ; preds = %29
br label %18
32: ; preds = %29
%33 = load i32, i32* %6
%34 = icmp eq i32 %33, 121
%35 = zext i1 %34 to i32
store i32 %35, i32* %3
br label %36
36: ; preds = %32, %16
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"%s%s%s%s%s\00"
@.str.1 = [5 x i8] c"rm: \00"
@.str.2 = [10 x i8] c": Remove \00"
@.str.3 = [3 x i8] c"? \00"
@stdin = global i32 0
@EOF = global i32 0
define i32 @_rm_confirm(i8* %0, i8* %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%5 = load i32, i32* @stdin
%6 = tail call i32 @fgetc(i32 %5)
%7 = load i32, i32* @EOF
%8 = icmp eq i32 %6, %7
br i1 %8, label %21, label %9
9: ; preds = %2
%10 = icmp eq i32 %6, 10
br i1 %10, label %18, label %11
11: ; preds = %9, %11
%12 = load i32, i32* @stdin
%13 = tail call i32 @fgetc(i32 %12)
%14 = load i32, i32* @EOF
%15 = icmp eq i32 %13, %14
%16 = icmp eq i32 %13, 10
%17 = or i1 %15, %16
br i1 %17, label %18, label %11
18: ; preds = %11, %9
%19 = icmp eq i32 %6, 121
%20 = zext i1 %19 to i32
br label %21
21: ; preds = %2, %18
%22 = phi i32 [ %20, %18 ], [ 0, %2 ]
ret i32 %22
}