#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[20];
  char string_2[20];
  printf("You want to say:");
  fgets(string_1, 20, stdin);
  int index = 0;
  while (string_1[index] == ' ') {
    index += 1;
  }
  strcpy(string_2, string_1 + index);
  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    $0x14,%esi
call   1050 <fgets@plt>
movl   $0x0,-0x44(%rbp)
movslq -0x44(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x20,%eax
jne    118b <main+0x5b>
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
call   1030 <strcpy@plt>
lea    -0x40(%rbp),%rsi
lea    0xe67(%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    %eax,%eax
call   1040 <printf@plt>
mov    0x2e9e(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rdi
mov    $0x14,%esi
call   1050 <fgets@plt>
mov    $0xffffffffffffffff,%rax
cmpb   $0x20,0x1(%rsp,%rax,1)
lea    0x1(%rax),%rax
je     1160 <main+0x30>
mov    %eax,%eax
lea    (%rsp,%rax,1),%rsi
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xe8c(%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 [20 x i8]
%3 = alloca [20 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 [20 x i8], [20 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %6, i32 20, i32 %7)
store i32 0, i32* %4
br label %9
9: ; preds = %16, %0
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 32
br i1 %15, label %16, label %19
16: ; preds = %9
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %9
19: ; preds = %9
%20 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%21 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = call i32 @strcpy(i8* %20, i8* %24)
%26 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %26)
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 [20 x i8]
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [20 x i8], [20 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 20, i32 %6)
br label %8
8: ; preds = %8, %0
%9 = phi i64 [ %13, %8 ], [ 0, %0 ]
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 32
%13 = add nuw i64 %9, 1
br i1 %12, label %8, label %14
14: ; preds = %8
%15 = and i64 %9, 4294967295
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %15
%17 = call i32 @strcpy(i8* %4, i8* %16)
%18 = 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
}