#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*/ memset(char *, char, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
char *strchr(char *, char);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
char toupper(char);
void getinput(char *verb, char *noun) {
  char *space;
  char command[255];
  int i;
  memset(verb, '\0', 255);
  memset(noun, '\0', 255);
  do {
    printf("What now? ");
    fgets(command, 250, stdin);
  } while (strlen(command) < 2);
  for (i = 0; i < strlen(command); i++) {
    command[i] = toupper(command[i]);
  }
  space = strchr(command, ' ');
  if (space == NULL) {
    strncpy(verb, command, strlen(command) - 1);
  } else {
    strncpy(verb, command, space - command);
    strncpy(noun, space + 1, strlen(space + 1) - 1);
  }
}


x86 assembly (clang, -O0):
<getinput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1080 <memset@plt>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1080 <memset@plt>
lea    0xe56(%rip),%rdi
call   1070 <printf@plt>
lea    -0x120(%rbp),%rdi
mov    0x2e2b(%rip),%rax
mov    (%rax),%edx
mov    $0xfa,%esi
call   1090 <fgets@plt>
lea    -0x120(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x2,%eax
jl     11a3 <getinput+0x33>
movl   $0x0,-0x124(%rbp)
mov    -0x124(%rbp),%eax
mov    %eax,-0x128(%rbp)
lea    -0x120(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x128(%rbp),%eax
cmp    %ecx,%eax
jge    1248 <getinput+0xd8>
movslq -0x124(%rbp),%rax
movsbl -0x120(%rbp,%rax,1),%edi
ff
call   1040 <toupper@plt>
mov    %al,%cl
movslq -0x124(%rbp),%rax
mov    %cl,-0x120(%rbp,%rax,1)
mov    -0x124(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x124(%rbp)
jmp    11e8 <getinput+0x78>
lea    -0x120(%rbp),%rdi
mov    $0x20,%esi
call   1060 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    12aa <getinput+0x13a>
mov    -0x8(%rbp),%rax
mov    %rax,-0x138(%rbp)
lea    -0x120(%rbp),%rax
mov    %rax,-0x130(%rbp)
lea    -0x120(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x138(%rbp),%rdi
mov    -0x130(%rbp),%rsi
mov    %eax,%edx
sub    $0x1,%edx
call   1030 <strncpy@plt>
jmp    1309 <getinput+0x199>
mov    -0x8(%rbp),%rdi
lea    -0x120(%rbp),%rsi
mov    -0x18(%rbp),%rax
lea    -0x120(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x148(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x140(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
call   1050 <strlen@plt>
mov    -0x148(%rbp),%rdi
mov    -0x140(%rbp),%rsi
mov    %eax,%edx
sub    $0x1,%edx
call   1030 <strncpy@plt>
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getinput>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x100,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
xor    %esi,%esi
mov    $0xff,%edx
call   1080 <memset@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1080 <memset@plt>
lea    0xe58(%rip),%r12
mov    0x2e39(%rip),%r13
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12,%rdi
call   1070 <printf@plt>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    $0xfa,%esi
call   1090 <fgets@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cmp    $0x2,%eax
jl     11c0 <getinput+0x50>
mov    %rsp,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    121f <getinput+0xaf>
xor    %ebx,%ebx
mov    %rsp,%r12
nopw   0x0(%rax,%rax,1)
movsbl (%rsp,%rbx,1),%edi
call   1040 <toupper@plt>
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
mov    %r12,%rdi
call   1050 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1200 <getinput+0x90>
mov    %rsp,%rdi
mov    $0x20,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     1257 <getinput+0xe7>
mov    %rax,%rbx
mov    %rsp,%rsi
mov    %ebx,%edx
sub    %esi,%edx
mov    %r15,%rdi
call   1030 <strncpy@plt>
add    $0x1,%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    -0x1(%rax),%edx
mov    %r14,%rdi
jmp    1268 <getinput+0xf8>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    -0x1(%rax),%edx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <strncpy@plt>
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"What now? \00"
@stdin = global i32 0
define void @getinput(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [255 x i8]
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = call i32 @memset(i8* %8, i8 signext 0, i32 255)
%10 = load i8*, i8** %4
%11 = call i32 @memset(i8* %10, i8 signext 0, i32 255)
br label %12
12: ; preds = %17, %2
%13 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%15 = load i32, i32* @stdin
%16 = call i32 @fgets(i8* %14, i32 250, i32 %15)
br label %17
17: ; preds = %12
%18 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%19 = call i32 @strlen(i8* %18)
%20 = icmp slt i32 %19, 2
br i1 %20, label %12, label %21
21: ; preds = %17
store i32 0, i32* %7
br label %22
22: ; preds = %36, %21
%23 = load i32, i32* %7
%24 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%25 = call i32 @strlen(i8* %24)
%26 = icmp slt i32 %23, %25
br i1 %26, label %27, label %39
27: ; preds = %22
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = call signext i8 @toupper(i8 signext %31)
%33 = load i32, i32* %7
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %34
store i8 %32, i8* %35
br label %36
36: ; preds = %27
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %22
39: ; preds = %22
%40 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%41 = call i8* @strchr(i8* %40, i8 signext 32)
store i8* %41, i8** %5
%42 = load i8*, i8** %5
%43 = icmp eq i8* %42, null
br i1 %43, label %44, label %51
44: ; preds = %39
%45 = load i8*, i8** %3
%46 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%47 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%48 = call i32 @strlen(i8* %47)
%49 = sub nsw i32 %48, 1
%50 = call i32 @strncpy(i8* %45, i8* %46, i32 %49)
br label %69
51: ; preds = %39
%52 = load i8*, i8** %3
%53 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%54 = load i8*, i8** %5
%55 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%56 = ptrtoint i8* %54 to i64
%57 = ptrtoint i8* %55 to i64
%58 = sub i64 %56, %57
%59 = trunc i64 %58 to i32
%60 = call i32 @strncpy(i8* %52, i8* %53, i32 %59)
%61 = load i8*, i8** %4
%62 = load i8*, i8** %5
%63 = getelementptr inbounds i8, i8* %62, i64 1
%64 = load i8*, i8** %5
%65 = getelementptr inbounds i8, i8* %64, i64 1
%66 = call i32 @strlen(i8* %65)
%67 = sub nsw i32 %66, 1
%68 = call i32 @strncpy(i8* %61, i8* %63, i32 %67)
br label %69
69: ; preds = %51, %44
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"What now? \00"
@stdin = global i32 0
define void @getinput(i8* %0, i8* %1) {
%3 = alloca [255 x i8]
%4 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @memset(i8* %0, i8 signext 0, i32 255)
%6 = tail call i32 @memset(i8* %1, i8 signext 0, i32 255)
br label %7
7: ; preds = %7, %2
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @stdin
%10 = call i32 @fgets(i8* %4, i32 250, i32 %9)
%11 = call i32 @strlen(i8* %4)
%12 = icmp slt i32 %11, 2
br i1 %12, label %7, label %13
13: ; preds = %7
%14 = call i32 @strlen(i8* %4)
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %25
16: ; preds = %13, %16
%17 = phi i64 [ %21, %16 ], [ 0, %13 ]
%18 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = call signext i8 @toupper(i8 signext %19)
store i8 %20, i8* %18
%21 = add nuw nsw i64 %17, 1
%22 = call i32 @strlen(i8* %4)
%23 = sext i32 %22 to i64
%24 = icmp slt i64 %21, %23
br i1 %24, label %16, label %25
25: ; preds = %16, %13
%26 = call i8* @strchr(i8* %4, i8 signext 32)
%27 = icmp eq i8* %26, null
br i1 %27, label %28, label %32
28: ; preds = %25
%29 = call i32 @strlen(i8* %4)
%30 = add nsw i32 %29, -1
%31 = call i32 @strncpy(i8* %0, i8* %4, i32 %30)
br label %42
32: ; preds = %25
%33 = ptrtoint i8* %26 to i64
%34 = ptrtoint [255 x i8]* %3 to i64
%35 = sub i64 %33, %34
%36 = trunc i64 %35 to i32
%37 = call i32 @strncpy(i8* %0, i8* %4, i32 %36)
%38 = getelementptr inbounds i8, i8* %26, i64 1
%39 = call i32 @strlen(i8* %38)
%40 = add nsw i32 %39, -1
%41 = call i32 @strncpy(i8* %1, i8* %38, i32 %40)
br label %42
42: ; preds = %32, %28
ret void
}