#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ prompt(char *);
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
size_t strcspn(char *, char *);
void input(char *str, size_t size) {
  do {
    fgets(str, (int)size, stdin);
    str[strcspn(str, "\n")] = '\0';
  } while (strcmp(str, "") == 0 && !prompt("Please Retry."));
}


x86 assembly (clang, -O0):
<input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %eax,%esi
mov    0x2e87(%rip),%rax
mov    (%rax),%edx
call   1050 <fgets@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe85(%rip),%rsi
call   1040 <strcspn@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
lea    0xe6b(%rip),%rsi
call   1060 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x19(%rbp)
jne    11c4 <input+0x84>
lea    0xe4e(%rip),%rdi
call   1030 <prompt@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1150 <input+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2e90(%rip),%rbp
lea    0xea1(%rip),%r15
lea    0xe9b(%rip),%r12
lea    0xe95(%rip),%r13
nopl   (%rax)
mov    0x0(%rbp),%edx
mov    %rbx,%rdi
mov    %r14d,%esi
call   1050 <fgets@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcspn@plt>
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    11a9 <input+0x69>
mov    %r13,%rdi
call   1030 <prompt@plt>
test   %eax,%eax
je     1170 <input+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [14 x i8] c"Please Retry.\00"
define void @input(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
br label %5
5: ; preds = %23, %2
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = trunc i64 %7 to i32
%9 = load i32, i32* @stdin
%10 = call i32 @fgets(i8* %6, i32 %8, i32 %9)
%11 = load i8*, i8** %3
%12 = load i8*, i8** %3
%13 = call i64 @strcspn(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds i8, i8* %11, i64 %13
store i8 0, i8* %14
br label %15
15: ; preds = %5
%16 = load i8*, i8** %3
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = call i32 @prompt(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp ne i32 %20, 0
%22 = xor i1 %21, true
br label %23
23: ; preds = %19, %15
%24 = phi i1 [ false, %15 ], [ %22, %19 ]
br i1 %24, label %5, label %25
25: ; preds = %23
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [14 x i8] c"Please Retry.\00"
define void @input(i8* %0, i64 %1) {
%3 = trunc i64 %1 to i32
br label %4
4: ; preds = %11, %2
%5 = load i32, i32* @stdin
%6 = tail call i32 @fgets(i8* %0, i32 %3, i32 %5)
%7 = tail call i64 @strcspn(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds i8, i8* %0, i64 %7
store i8 0, i8* %8
%9 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %4
%12 = tail call i32 @prompt(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %4, label %14
14: ; preds = %4, %11
ret void
}