#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 *, ...);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcpy(char *, char *);
int main(void) {
  char string_1[21];
  char string_2[21];
  printf("You want to say:");
  fgets(string_1, 21, stdin);
  int index = 0;
  while (string_1[index] != ' ' && string_1[index] != '\0') {
    index += 1;
  }
  strcpy(string_2, string_1 + index + 1);
  printf("I understood: %s", string_2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    0x2e90(%rip),%rax
mov    (%rax),%edx
mov    $0x15,%esi
call   1050 <fgets@plt>
movl   $0x0,-0x44(%rbp)
movslq -0x44(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x45(%rbp)
je     1194 <main+0x64>
movslq -0x44(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x45(%rbp)
mov    -0x45(%rbp),%al
test   $0x1,%al
jne    11a4 <main+0x74>
jmp    11b2 <main+0x82>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    116b <main+0x3b>
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
movslq -0x44(%rbp),%rax
add    %rax,%rsi
add    $0x1,%rsi
call   1030 <strcpy@plt>
lea    -0x40(%rbp),%rsi
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
lea    0xec4(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rdi
mov    $0x15,%esi
call   1050 <fgets@plt>
testb  $0xdf,(%rsp,%rbx,1)
je     117a <main+0x4a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
testb  $0xdf,(%rsp,%rbx,1)
jne    1170 <main+0x40>
mov    %ebx,%eax
lea    (%rsp,%rax,1),%rsi
add    $0x1,%rsi
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xe79(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"You want to say:\00"
@stdin = global i32 0
@.str.1 = [17 x i8] c"I understood: %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [21 x i8]
%3 = alloca [21 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %6, i32 21, i32 %7)
store i32 0, i32* %4
br label %9
9: ; preds = %25, %0
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 32
br i1 %15, label %16, label %23
16: ; preds = %9
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 0
br label %23
23: ; preds = %16, %9
%24 = phi i1 [ false, %9 ], [ %22, %16 ]
br i1 %24, label %25, label %28
25: ; preds = %23
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %9
28: ; preds = %23
%29 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%30 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = getelementptr inbounds i8, i8* %33, i64 1
%35 = call i32 @strcpy(i8* %29, i8* %34)
%36 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %36)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"You want to say:\00"
@stdin = global i32 0
@.str.1 = [17 x i8] c"I understood: %s\00"
define i32 @main() {
%1 = alloca [21 x i8]
%2 = alloca [21 x i8]
%3 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %3, i32 21, i32 %6)
br label %8
8: ; preds = %12, %0
%9 = phi i64 [ %13, %12 ], [ 0, %0 ]
%10 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 %9
%11 = load i8, i8* %10
switch i8 %11, label %12 [
i8 32, label %14
i8 0, label %14
]
12: ; preds = %8
%13 = add nuw i64 %9, 1
br label %8
14: ; preds = %8, %8
%15 = and i64 %9, 4294967295
%16 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 %15
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = call i32 @strcpy(i8* %4, i8* %17)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}