#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 */
char *GetArg(char *);
int strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
char *collect_conf_name(char *input) {
  int i;
  void correct_conf_name(char *);
  for (i = 1; input[i] != ' ' && input[i] != '\0'; i++)
    ;
  while (input[i] == ' ')
    i++;
  if (input[i] == '\0') {
    input = GetArg("\nConference name: ");
    i = 0;
  }
  while (input[i] == ' ')
    i++;
  switch (input[i]) {
  case 'q':
    if (input[i + 1] != ' ' && strncmp(&input[i], "quit", 4) != 0)
      break;
  case '\0':
  case '?':
    i = -1;
    break;
  default:
    break;
  }
  if (i == -1)
    return NULL;
  if (strlen(&input[i]) > 80 - 1)
    input[80] = '\0';
  correct_conf_name(&input[i]);
  return &input[i];
}


x86 assembly (clang, -O0):
<collect_conf_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x15(%rbp)
je     1182 <collect_conf_name+0x42>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1192 <collect_conf_name+0x52>
jmp    11a5 <collect_conf_name+0x65>
jmp    1197 <collect_conf_name+0x57>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1153 <collect_conf_name+0x13>
jmp    11aa <collect_conf_name+0x6a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    11cd <collect_conf_name+0x8d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11aa <collect_conf_name+0x6a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    11f9 <collect_conf_name+0xb9>
lea    0xe17(%rip),%rdi
call   1040 <GetArg@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
jmp    11fe <collect_conf_name+0xbe>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    1221 <collect_conf_name+0xe1>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11fe <collect_conf_name+0xbe>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x1c(%rbp)
test   %eax,%eax
je     12a8 <collect_conf_name+0x168>
jmp    123d <collect_conf_name+0xfd>
mov    -0x1c(%rbp),%eax
sub    $0x3f,%eax
je     12a8 <collect_conf_name+0x168>
jmp    124e <collect_conf_name+0x10e>
mov    -0x1c(%rbp),%eax
sub    $0x71,%eax
jne    12b4 <collect_conf_name+0x174>
jmp    125f <collect_conf_name+0x11f>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
je     12a3 <collect_conf_name+0x163>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    0xd88(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
je     12a3 <collect_conf_name+0x163>
jmp    12b9 <collect_conf_name+0x179>
jmp    12a8 <collect_conf_name+0x168>
movl   $0xffffffff,-0x14(%rbp)
jmp    12b9 <collect_conf_name+0x179>
jmp    12b9 <collect_conf_name+0x179>
cmpl   $0xffffffff,-0x14(%rbp)
jne    12d0 <collect_conf_name+0x190>
movq   $0x0,-0x8(%rbp)
jmp    1310 <collect_conf_name+0x1d0>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
call   1050 <strlen@plt>
cmp    $0x4f,%eax
jle    12f1 <collect_conf_name+0x1b1>
mov    -0x10(%rbp),%rax
movb   $0x0,0x50(%rax)
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
call   1060 <correct_conf_name@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<collect_conf_name>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r15
mov    $0x1,%eax
testb  $0xdf,(%r15,%rax,1)
je     116b <collect_conf_name+0x2b>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rax
testb  $0xdf,(%r15,%rax,1)
jne    1160 <collect_conf_name+0x20>
mov    %eax,%r13d
lea    (%r15,%r13,1),%rax
shl    $0x20,%r13
movabs $0x100000000,%rcx
movzbl (%rax),%edx
cmp    $0x20,%dl
jne    1191 <collect_conf_name+0x51>
add    %rcx,%r13
add    $0x1,%rax
jmp    1180 <collect_conf_name+0x40>
test   %dl,%dl
jne    11a9 <collect_conf_name+0x69>
lea    0xe64(%rip),%rdi
call   1040 <GetArg@plt>
mov    %rax,%r15
xor    %r13d,%r13d
jmp    11ad <collect_conf_name+0x6d>
sar    $0x20,%r13
movabs $0xffffffff00000000,%r12
ff ff ff
lea    (%r15,%r13,1),%rdi
add    $0xffffffffffffffff,%rdi
mov    %r13,%rbx
imul   %r12,%rbx
cs nopw 0x0(%rax,%rax,1)
movsbl 0x1(%rdi),%eax
add    $0x1,%rdi
add    $0x1,%r13d
add    %r12,%rbx
cmp    $0x20,%eax
je     11d0 <collect_conf_name+0x90>
xor    %r14d,%r14d
test   %eax,%eax
je     1256 <collect_conf_name+0x116>
cmp    $0x3f,%eax
je     1256 <collect_conf_name+0x116>
cmp    $0x71,%eax
jne    1225 <collect_conf_name+0xe5>
mov    %rbx,%rax
neg    %rax
sar    $0x20,%rax
cmpb   $0x20,(%r15,%rax,1)
je     1253 <collect_conf_name+0x113>
lea    0xe06(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
xor    %r14d,%r14d
test   %eax,%eax
je     1256 <collect_conf_name+0x116>
test   %r13d,%r13d
jne    122a <collect_conf_name+0xea>
jmp    1256 <collect_conf_name+0x116>
test   %r13d,%r13d
je     1253 <collect_conf_name+0x113>
sub    %rbx,%r12
sar    $0x20,%r12
mov    %r12,%r14
add    %r15,%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
cmp    $0x50,%eax
jl     1249 <collect_conf_name+0x109>
movb   $0x0,0x50(%r15)
mov    %r14,%rdi
call   1060 <correct_conf_name@plt>
jmp    1256 <collect_conf_name+0x116>
xor    %r14d,%r14d
mov    %r14,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c"\0AConference name: \00"
@.str.1 = [5 x i8] c"quit\00"
define i8* @collect_conf_name(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 1, i32* %4
br label %5
5: ; preds = %24, %1
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 32
br i1 %12, label %13, label %21
13: ; preds = %5
%14 = load i8*, i8** %3
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 0
br label %21
21: ; preds = %13, %5
%22 = phi i1 [ false, %5 ], [ %20, %13 ]
br i1 %22, label %23, label %27
23: ; preds = %21
br label %24
24: ; preds = %23
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %5
27: ; preds = %21
br label %28
28: ; preds = %36, %27
%29 = load i8*, i8** %3
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 32
br i1 %35, label %36, label %39
36: ; preds = %28
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
store i32 %38, i32* %4
br label %28
39: ; preds = %28
%40 = load i8*, i8** %3
%41 = load i32, i32* %4
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %40, i64 %42
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %39
%48 = call i8* @GetArg(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i8* %48, i8** %3
store i32 0, i32* %4
br label %49
49: ; preds = %47, %39
br label %50
50: ; preds = %58, %49
%51 = load i8*, i8** %3
%52 = load i32, i32* %4
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %51, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 32
br i1 %57, label %58, label %61
58: ; preds = %50
%59 = load i32, i32* %4
%60 = add nsw i32 %59, 1
store i32 %60, i32* %4
br label %50
61: ; preds = %50
%62 = load i8*, i8** %3
%63 = load i32, i32* %4
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8, i8* %62, i64 %64
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
switch i32 %67, label %87 [
i32 113, label %68
i32 0, label %86
i32 63, label %86
]
68: ; preds = %61
%69 = load i8*, i8** %3
%70 = load i32, i32* %4
%71 = add nsw i32 %70, 1
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8, i8* %69, i64 %72
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = icmp ne i32 %75, 32
br i1 %76, label %77, label %85
77: ; preds = %68
%78 = load i8*, i8** %3
%79 = load i32, i32* %4
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i8, i8* %78, i64 %80
%82 = call i32 @strncmp(i8* %81, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%83 = icmp ne i32 %82, 0
br i1 %83, label %84, label %85
84: ; preds = %77
br label %88
85: ; preds = %77, %68
br label %86
86: ; preds = %61, %61, %85
store i32 -1, i32* %4
br label %88
87: ; preds = %61
br label %88
88: ; preds = %87, %86, %84
%89 = load i32, i32* %4
%90 = icmp eq i32 %89, -1
br i1 %90, label %91, label %92
91: ; preds = %88
store i8* null, i8** %2
br label %111
92: ; preds = %88
%93 = load i8*, i8** %3
%94 = load i32, i32* %4
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds i8, i8* %93, i64 %95
%97 = call i32 @strlen(i8* %96)
%98 = icmp sgt i32 %97, 79
br i1 %98, label %99, label %102
99: ; preds = %92
%100 = load i8*, i8** %3
%101 = getelementptr inbounds i8, i8* %100, i64 80
store i8 0, i8* %101
br label %102
102: ; preds = %99, %92
%103 = load i8*, i8** %3
%104 = load i32, i32* %4
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds i8, i8* %103, i64 %105
%107 = load i8*, i8** %3
%108 = load i32, i32* %4
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds i8, i8* %107, i64 %109
store i8* %110, i8** %2
br label %111
111: ; preds = %102, %91
%112 = load i8*, i8** %2
ret i8* %112
}

LLVM IR (-O2):
@.str = [19 x i8] c"\0AConference name: \00"
@.str.1 = [5 x i8] c"quit\00"
define i8* @collect_conf_name(i8* %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i64 [ %7, %6 ], [ 1, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
switch i8 %5, label %6 [
i8 32, label %8
i8 0, label %8
]
6: ; preds = %2
%7 = add nuw i64 %3, 1
br label %2
8: ; preds = %2, %2
%9 = and i64 %3, 4294967295
br label %10
10: ; preds = %14, %8
%11 = phi i64 [ %15, %14 ], [ %9, %8 ]
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
switch i8 %13, label %18 [
i8 32, label %14
i8 0, label %16
]
14: ; preds = %10
%15 = add nuw i64 %11, 1
br label %10
16: ; preds = %10
%17 = tail call i8* @GetArg(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %21
18: ; preds = %10
%19 = shl i64 %11, 32
%20 = ashr exact i64 %19, 32
br label %21
21: ; preds = %18, %16
%22 = phi i8* [ %17, %16 ], [ %0, %18 ]
%23 = phi i64 [ 0, %16 ], [ %20, %18 ]
br label %24
24: ; preds = %24, %21
%25 = phi i64 [ %29, %24 ], [ %23, %21 ]
%26 = getelementptr inbounds i8, i8* %22, i64 %25
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 32
%29 = add i64 %25, 1
br i1 %28, label %24, label %30
30: ; preds = %24
%31 = getelementptr inbounds i8, i8* %22, i64 %25
%32 = trunc i64 %25 to i32
%33 = sext i8 %27 to i32
switch i32 %33, label %46 [
i32 113, label %34
i32 0, label %57
i32 63, label %57
]
34: ; preds = %30
%35 = shl i64 %25, 32
%36 = add i64 %35, 4294967296
%37 = ashr exact i64 %36, 32
%38 = getelementptr inbounds i8, i8* %22, i64 %37
%39 = load i8, i8* %38
%40 = icmp eq i8 %39, 32
br i1 %40, label %57, label %41
41: ; preds = %34
%42 = tail call i32 @strncmp(i8* %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%43 = icmp eq i32 %42, 0
%44 = icmp eq i32 %32, -1
%45 = select i1 %43, i1 true, i1 %44
br i1 %45, label %57, label %48
46: ; preds = %30
%47 = icmp eq i32 %32, -1
br i1 %47, label %57, label %48
48: ; preds = %41, %46
%49 = shl i64 %25, 32
%50 = ashr exact i64 %49, 32
%51 = getelementptr inbounds i8, i8* %22, i64 %50
%52 = tail call i32 @strlen(i8* %51)
%53 = icmp sgt i32 %52, 79
br i1 %53, label %54, label %56
54: ; preds = %48
%55 = getelementptr inbounds i8, i8* %22, i64 80
store i8 0, i8* %55
br label %56
56: ; preds = %54, %48
tail call void @correct_conf_name(i8* %51)
br label %57
57: ; preds = %34, %41, %30, %30, %46, %56
%58 = phi i8* [ %51, %56 ], [ null, %46 ], [ null, %30 ], [ null, %30 ], [ null, %41 ], [ null, %34 ]
ret i8* %58
}