#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*/ printf(char *, char const *, ...);
int /*<<< orphan*/ stdin;
size_t strlen(char *);
char *inputStrings(char *buf, const char *name, int min, int max) {
  size_t length;
  while (1) {
    printf("%s: ", name);
    fgets(buf, 200, stdin);
    length = strlen(buf);
    buf[length - 1] = '\0';
    length--;
    if (length > max) {
      printf("%s must be less than %d characters.\n", name, max);
      continue;
    }
    if (length < min) {
      printf("%s must be more than %d characters.\n", name, min);
      continue;
    }
    break;
  }
  return buf;
}


x86 assembly (clang, -O0):
<inputStrings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e85(%rip),%rax
mov    (%rax),%edx
mov    $0xc8,%esi
call   1050 <fgets@plt>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmp    %rcx,%rax
jbe    11c3 <inputStrings+0x93>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1146 <inputStrings+0x16>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmp    %rcx,%rax
jae    11ee <inputStrings+0xbe>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1146 <inputStrings+0x16>
jmp    11f3 <inputStrings+0xc3>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inputStrings>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    %edx,0xc(%rsp)
movslq %edx,%rax
mov    %rax,0x10(%rsp)
mov    %ecx,%r13d
movslq %ecx,%r14
lea    0xea3(%rip),%r12
mov    0x2e84(%rip),%r15
jmp    1184 <inputStrings+0x54>
cs nopw 0x0(%rax,%rax,1)
lea    0xe8e(%rip),%rdi
mov    %rbx,%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%r15),%edx
mov    %rbp,%rdi
mov    $0xc8,%esi
call   1050 <fgets@plt>
mov    %rbp,%rdi
call   1030 <strlen@plt>
movb   $0x0,-0x1(%rbp,%rax,1)
add    $0xffffffffffffffff,%rax
cmp    %r14,%rax
ja     1170 <inputStrings+0x40>
cmp    0x10(%rsp),%rax
jae    11ce <inputStrings+0x9e>
lea    0xe65(%rip),%rdi
mov    %rbx,%rsi
mov    0xc(%rsp),%edx
jmp    117d <inputStrings+0x4d>
mov    %rbp,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s: \00"
@stdin = global i32 0
@.str.1 = [37 x i8] c"%s must be less than %d characters.\0A\00"
@.str.2 = [37 x i8] c"%s must be more than %d characters.\0A\00"
define i8* @inputStrings(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
br label %10
10: ; preds = %4, %28, %37
%11 = load i8*, i8** %6
%12 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = load i8*, i8** %5
%14 = load i32, i32* @stdin
%15 = call i32 @fgets(i8* %13, i32 200, i32 %14)
%16 = load i8*, i8** %5
%17 = call i64 @strlen(i8* %16)
store i64 %17, i64* %9
%18 = load i8*, i8** %5
%19 = load i64, i64* %9
%20 = sub i64 %19, 1
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 0, i8* %21
%22 = load i64, i64* %9
%23 = add i64 %22, -1
store i64 %23, i64* %9
%24 = load i64, i64* %9
%25 = load i32, i32* %8
%26 = sext i32 %25 to i64
%27 = icmp ugt i64 %24, %26
br i1 %27, label %28, label %32
28: ; preds = %10
%29 = load i8*, i8** %6
%30 = load i32, i32* %8
%31 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %29, i32 %30)
br label %10
32: ; preds = %10
%33 = load i64, i64* %9
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = icmp ult i64 %33, %35
br i1 %36, label %37, label %41
37: ; preds = %32
%38 = load i8*, i8** %6
%39 = load i32, i32* %7
%40 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8* %38, i32 %39)
br label %10
41: ; preds = %32
br label %42
42: ; preds = %41
%43 = load i8*, i8** %5
ret i8* %43
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s: \00"
@stdin = global i32 0
@.str.1 = [37 x i8] c"%s must be less than %d characters.\0A\00"
@.str.2 = [37 x i8] c"%s must be more than %d characters.\0A\00"
define i8* @inputStrings(i8* returned %0, i8* %1, i32 %2, i32 %3) {
%5 = sext i32 %2 to i64
%6 = sext i32 %3 to i64
br label %7
7: ; preds = %17, %4
%8 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1)
%9 = load i32, i32* @stdin
%10 = tail call i32 @fgets(i8* %0, i32 200, i32 %9)
%11 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%12 = add i64 %11, -1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
store i8 0, i8* %13
%14 = icmp ugt i64 %12, %6
br i1 %14, label %15, label %18
15: ; preds = %7
%16 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %1, i32 %3)
br label %17
17: ; preds = %15, %20
br label %7
18: ; preds = %7
%19 = icmp ult i64 %12, %5
br i1 %19, label %20, label %22
20: ; preds = %18
%21 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8* %1, i32 %2)
br label %17
22: ; preds = %18
ret i8* %0
}