#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*/ printf(char *, char *);
int /*<<< orphan*/ readpass(char *, char *, int);
int /*<<< orphan*/ readtext(char *, char *, int);
int uq_txt(char *preface, char *prompt, int echo, char **help, char *buf,
           int buflen, char *dflt, int timer) {
  int rc;
  if (buflen < 1 || !buf)
    return (0);
  if (preface)
    printf("%s\n", preface);
  if (echo == 1)
    readtext(prompt, buf, buflen);
  else
    readpass(prompt, buf, buflen);
  return (1);
}


x86 assembly (clang, -O0):
<uq_txt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
jl     116b <uq_txt+0x3b>
cmpq   $0x0,-0x30(%rbp)
jne    1177 <uq_txt+0x47>
movl   $0x0,-0x4(%rbp)
jmp    11c8 <uq_txt+0x98>
cmpq   $0x0,-0x10(%rbp)
je     1192 <uq_txt+0x62>
mov    -0x10(%rbp),%rsi
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x1,-0x1c(%rbp)
jne    11b1 <uq_txt+0x81>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x34(%rbp),%edx
call   1050 <readtext@plt>
jmp    11c1 <uq_txt+0x91>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x34(%rbp),%edx
call   1040 <readpass@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uq_txt>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
test   %r8,%r8
je     1182 <uq_txt+0x52>
mov    %r9d,%ebp
test   %r9d,%r9d
jle    1182 <uq_txt+0x52>
mov    %r8,%rbx
mov    %edx,%r15d
mov    %rsi,%r14
mov    %rdi,%rsi
test   %rdi,%rdi
je     1163 <uq_txt+0x33>
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
cmp    $0x1,%r15d
jne    1178 <uq_txt+0x48>
call   1050 <readtext@plt>
jmp    117d <uq_txt+0x4d>
call   1040 <readpass@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @uq_txt(i8* %0, i8* %1, i32 %2, i8** %3, i8* %4, i32 %5, i8* %6, i32 %7) {
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i8**
%14 = alloca i8*
%15 = alloca i32
%16 = alloca i8*
%17 = alloca i32
%18 = alloca i32
store i8* %0, i8** %10
store i8* %1, i8** %11
store i32 %2, i32* %12
store i8** %3, i8*** %13
store i8* %4, i8** %14
store i32 %5, i32* %15
store i8* %6, i8** %16
store i32 %7, i32* %17
%19 = load i32, i32* %15
%20 = icmp slt i32 %19, 1
br i1 %20, label %24, label %21
21: ; preds = %8
%22 = load i8*, i8** %14
%23 = icmp ne i8* %22, null
br i1 %23, label %25, label %24
24: ; preds = %21, %8
store i32 0, i32* %9
br label %45
25: ; preds = %21
%26 = load i8*, i8** %10
%27 = icmp ne i8* %26, null
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i8*, i8** %10
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %28, %25
%32 = load i32, i32* %12
%33 = icmp eq i32 %32, 1
br i1 %33, label %34, label %39
34: ; preds = %31
%35 = load i8*, i8** %11
%36 = load i8*, i8** %14
%37 = load i32, i32* %15
%38 = call i32 @readtext(i8* %35, i8* %36, i32 %37)
br label %44
39: ; preds = %31
%40 = load i8*, i8** %11
%41 = load i8*, i8** %14
%42 = load i32, i32* %15
%43 = call i32 @readpass(i8* %40, i8* %41, i32 %42)
br label %44
44: ; preds = %39, %34
store i32 1, i32* %9
br label %45
45: ; preds = %44, %24
%46 = load i32, i32* %9
ret i32 %46
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @uq_txt(i8* %0, i8* %1, i32 %2, i8** nocapture readnone %3, i8* %4, i32 %5, i8* nocapture readnone %6, i32 %7) {
%9 = icmp sgt i32 %5, 0
%10 = icmp ne i8* %4, null
%11 = and i1 %10, %9
br i1 %11, label %12, label %22
12: ; preds = %8
%13 = icmp eq i8* %0, null
br i1 %13, label %16, label %14
14: ; preds = %12
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %16
16: ; preds = %14, %12
%17 = icmp eq i32 %2, 1
br i1 %17, label %18, label %20
18: ; preds = %16
%19 = tail call i32 @readtext(i8* %1, i8* %4, i32 %5)
br label %22
20: ; preds = %16
%21 = tail call i32 @readpass(i8* %1, i8* %4, i32 %5)
br label %22
22: ; preds = %18, %20, %8
%23 = phi i32 [ 0, %8 ], [ 1, %20 ], [ 1, %18 ]
ret i32 %23
}