#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*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ getline(char **, size_t *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
scalar_t__ strlen(char *);
int user_confirmed(char *q, char *yes) {
  char *answer = 0;
  size_t n = 0;
  fprintf(stderr, "%s", q);
  if (getline(&answer, &n, stdin) != strlen(yes) || strcmp(yes, answer))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<user_confirmed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe8c(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e68(%rip),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1060 <getline@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
jne    11c3 <user_confirmed+0x83>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11cf <user_confirmed+0x8f>
movl   $0x0,-0x4(%rbp)
jmp    11d6 <user_confirmed+0x96>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<user_confirmed>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rdx
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
lea    0xe91(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edx
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1060 <getline@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rbx
jne    11b9 <user_confirmed+0x79>
mov    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
@stdin = global i32 0
define i32 @user_confirmed(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* null, i8** %6
store i64 0, i64* %7
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %4
%10 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i32, i32* @stdin
%12 = call i64 @getline(i8** %6, i64* %7, i32 %11)
%13 = load i8*, i8** %5
%14 = call i64 @strlen(i8* %13)
%15 = icmp ne i64 %12, %14
br i1 %15, label %21, label %16
16: ; preds = %2
%17 = load i8*, i8** %5
%18 = load i8*, i8** %6
%19 = call i64 @strcmp(i8* %17, i8* %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %16, %2
store i32 0, i32* %3
br label %23
22: ; preds = %16
store i32 1, i32* %3
br label %23
23: ; preds = %22, %21
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
@stdin = global i32 0
define i32 @user_confirmed(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%6 = bitcast i64* %4 to i8*
store i64 0, i64* %4
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%9 = load i32, i32* @stdin
%10 = call i64 @getline(i8** %3, i64* %4, i32 %9)
%11 = call i64 @strlen(i8* dereferenceable(1) %1)
%12 = icmp eq i64 %10, %11
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8*, i8** %3
%15 = call i64 @strcmp(i8* %1, i8* %14)
%16 = icmp eq i64 %15, 0
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %13, %2
%19 = phi i32 [ 0, %2 ], [ %17, %13 ]
ret i32 %19
}