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


x86 assembly (clang, -O0):
<_cp_confirm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rcx
lea    0xec0(%rip),%rsi
lea    0xec0(%rip),%rdx
lea    0xebe(%rip),%r8
call   1040 <fprintf@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e75(%rip),%rcx
cmp    (%rcx),%eax
jne    117f <_cp_confirm+0x5f>
movl   $0x0,-0x4(%rbp)
jmp    11e8 <_cp_confirm+0xc8>
jmp    1184 <_cp_confirm+0x64>
xor    %eax,%eax
cmpl   $0xa,-0x14(%rbp)
mov    %al,-0x19(%rbp)
je     11c4 <_cp_confirm+0xa4>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
mov    %eax,%ecx
mov    %ecx,-0x18(%rbp)
xor    %eax,%eax
mov    0x2e31(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x19(%rbp)
je     11c4 <_cp_confirm+0xa4>
cmpl   $0xa,-0x18(%rbp)
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11d4 <_cp_confirm+0xb4>
jmp    11d9 <_cp_confirm+0xb9>
jmp    1184 <_cp_confirm+0x64>
cmpl   $0x79,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cp_confirm>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rcx
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
lea    0xec9(%rip),%rdx
lea    0xec7(%rip),%r8
call   1040 <fprintf@plt>
mov    0x2e97(%rip),%rbx
mov    (%rbx),%edi
call   1030 <fgetc@plt>
mov    %eax,%r14d
mov    0x2e7e(%rip),%rbp
xor    %eax,%eax
cmp    0x0(%rbp),%r14d
je     118a <_cp_confirm+0x6a>
cmp    $0xa,%r14d
je     1181 <_cp_confirm+0x61>
mov    (%rbx),%edi
call   1030 <fgetc@plt>
cmp    0x0(%rbp),%eax
je     1181 <_cp_confirm+0x61>
cmp    $0xa,%eax
jne    1170 <_cp_confirm+0x50>
xor    %eax,%eax
cmp    $0x79,%r14d
sete   %al
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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