#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*/ getstr(char *, char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
char *GetString(char *prompt, char *deflt, char *help) {
  static char s[200];
  while (1) {
    sprintf(s, "\n%s%s", prompt, (*help) ? " (Type ? for Help)" : "");
    getstr(s, deflt, s);
    if (*s == '?' && *help)
      printf(help);
    else
      return (s);
  }
}


x86 assembly (clang, -O0):
<GetString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x18(%rbp),%rax
movsbl (%rax),%esi
lea    0xec2(%rip),%rcx
lea    0xea9(%rip),%rax
cmp    $0x0,%esi
cmovne %rax,%rcx
lea    0x2ee5(%rip),%rdi
lea    0xe8e(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x10(%rbp),%rsi
lea    0x2ece(%rip),%rdx
mov    %rdx,%rdi
call   1040 <getstr@plt>
movsbl 0x2ebf(%rip),%eax
cmp    $0x3f,%eax
jne    11b8 <GetString+0x88>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11b8 <GetString+0x88>
mov    -0x18(%rbp),%rdi
call   1030 <printf@plt>
jmp    11c5 <GetString+0x95>
lea    0x2e91(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret
jmp    1144 <GetString+0x14>

x86 assembly (clang, -O2):
<GetString>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
cmpb   $0x0,(%rdx)
lea    0xeca(%rip),%rax
lea    0xeb1(%rip),%rbp
mov    %rbp,%rcx
cmove  %rax,%rcx
lea    0x2eed(%rip),%r12
lea    0xe96(%rip),%rsi
mov    %r12,%rdi
mov    %r15,%rdx
call   1050 <sprintf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1040 <getstr@plt>
cmpb   $0x3f,0x2ec6(%rip)
jne    11e3 <GetString+0xb3>
lea    0x2ebd(%rip),%r12
lea    0xe66(%rip),%r13
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,(%rbx)
je     11e3 <GetString+0xb3>
mov    %rbx,%rdi
call   1030 <printf@plt>
cmpb   $0x0,(%rbx)
mov    %rbp,%rcx
lea    0xe5e(%rip),%rax
cmove  %rax,%rcx
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
call   1050 <sprintf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1040 <getstr@plt>
cmpb   $0x3f,0x2e6f(%rip)
je     11a0 <GetString+0x70>
lea    0x2e66(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@GetString.s = internal global [200 x i8] zeroinitializer
@.str = [6 x i8] c"\0A%s%s\00"
@.str.1 = [19 x i8] c" (Type ? for Help)\00"
@.str.2 = [1 x i8] zeroinitializer
define i8* @GetString(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
br label %7
7: ; preds = %3, %30
%8 = load i8*, i8** %4
%9 = load i8*, i8** %6
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%15 = call i32 @sprintf(i8* getelementptr inbounds ([200 x i8], [200 x i8]* @GetString.s, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %14)
%16 = load i8*, i8** %5
%17 = call i32 @getstr(i8* getelementptr inbounds ([200 x i8], [200 x i8]* @GetString.s, i64 0, i64 0), i8* %16, i8* getelementptr inbounds ([200 x i8], [200 x i8]* @GetString.s, i64 0, i64 0))
%18 = load i8, i8* getelementptr inbounds ([200 x i8], [200 x i8]* @GetString.s, i64 0, i64 0)
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 63
br i1 %20, label %21, label %29
21: ; preds = %7
%22 = load i8*, i8** %6
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %21
%27 = load i8*, i8** %6
%28 = call i32 @printf(i8* %27)
br label %30
29: ; preds = %21, %7
ret i8* getelementptr inbounds ([200 x i8], [200 x i8]* @GetString.s, i64 0, i64 0)
30: ; preds = %26
br label %7
}

LLVM IR (-O2):
@GetString.s = internal global [200 x i8] zeroinitializer
@.str = [6 x i8] c"\0A%s%s\00"
@.str.1 = [19 x i8] c" (Type ? for Help)\00"
@.str.2 = [1 x i8] zeroinitializer
define i8* @GetString(i8* %0, i8* %1, i8* nocapture %2) {
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 0
%6 = select i1 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0)
%7 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([200 x i8], [200 x i8]* @GetString.s, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %6)
%8 = tail call i32 @getstr(i8* getelementptr inbounds ([200 x i8], [200 x i8]* @GetString.s, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([200 x i8], [200 x i8]* @GetString.s, i64 0, i64 0))
%9 = load i8, i8* getelementptr inbounds ([200 x i8], [200 x i8]* @GetString.s, i64 0, i64 0)
%10 = icmp eq i8 %9, 63
br i1 %10, label %11, label %23
11: ; preds = %3, %14
%12 = load i8, i8* %2
%13 = icmp eq i8 %12, 0
br i1 %13, label %23, label %14
14: ; preds = %11
%15 = tail call i32 @printf(i8* %2)
%16 = load i8, i8* %2
%17 = icmp eq i8 %16, 0
%18 = select i1 %17, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0)
%19 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([200 x i8], [200 x i8]* @GetString.s, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %18)
%20 = tail call i32 @getstr(i8* getelementptr inbounds ([200 x i8], [200 x i8]* @GetString.s, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([200 x i8], [200 x i8]* @GetString.s, i64 0, i64 0))
%21 = load i8, i8* getelementptr inbounds ([200 x i8], [200 x i8]* @GetString.s, i64 0, i64 0)
%22 = icmp eq i8 %21, 63
br i1 %22, label %11, label %23
23: ; preds = %14, %11, %3
ret i8* getelementptr inbounds ([200 x i8], [200 x i8]* @GetString.s, i64 0, i64 0)
}