#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 */
typedef int /*<<< orphan*/ result;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fgets(unsigned char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stdin;
int strlen(unsigned char *);
unsigned char *getInput() {
  static unsigned char result[81];
  putchar('?');
  putchar(' ');
  if (!fgets(result, sizeof(result), stdin))
    exit(1);
  result[strlen(result) - 1] = '\0';
  return result;
}


x86 assembly (clang, -O0):
<getInput>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3f,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x2e89(%rip),%rax
mov    (%rax),%edx
lea    0x2ee8(%rip),%rdi
mov    $0x51,%esi
call   1050 <fgets@plt>
cmp    $0x0,%eax
jne    1185 <getInput+0x45>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    0x2ec4(%rip),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
movslq %eax,%rcx
lea    0x2eb2(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
lea    0x2ea7(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getInput>:
push   %rbx
mov    $0x3f,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edx
lea    0x2eeb(%rip),%rbx
mov    %rbx,%rdi
mov    $0x51,%esi
call   1050 <fgets@plt>
test   %eax,%eax
je     118a <getInput+0x4a>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rax
pop    %rbx
ret
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@getInput.result = internal global [81 x i8] zeroinitializer
@stdin = global i32 0
define i8* @getInput() {
%1 = call i32 @putchar(i8 signext 63)
%2 = call i32 @putchar(i8 signext 32)
%3 = load i32, i32* @stdin
%4 = call i32 @fgets(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @getInput.result, i64 0, i64 0), i32 81, i32 %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 @exit(i32 1)
unreachable
8: ; preds = %0
%9 = call i32 @strlen(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @getInput.result, i64 0, i64 0))
%10 = sub nsw i32 %9, 1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [81 x i8], [81 x i8]* @getInput.result, i64 0, i64 %11
store i8 0, i8* %12
ret i8* getelementptr inbounds ([81 x i8], [81 x i8]* @getInput.result, i64 0, i64 0)
}

LLVM IR (-O2):
@getInput.result = internal global [81 x i8] zeroinitializer
@stdin = global i32 0
define i8* @getInput() {
%1 = tail call i32 @putchar(i8 signext 63)
%2 = tail call i32 @putchar(i8 signext 32)
%3 = load i32, i32* @stdin
%4 = tail call i32 @fgets(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @getInput.result, i64 0, i64 0), i32 81, i32 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %0
%9 = tail call i32 @strlen(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @getInput.result, i64 0, i64 0))
%10 = add nsw i32 %9, -1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [81 x i8], [81 x i8]* @getInput.result, i64 0, i64 %11
store i8 0, i8* %12
ret i8* getelementptr inbounds ([81 x i8], [81 x i8]* @getInput.result, i64 0, i64 0)
}