#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*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
main() {
  char nomecompleto[30];
  char nome[10];
  char sobrenome[10];
  int i, j = 0;
  printf("Entre com seu nome e sobrenome: ");
  gets(nomecompleto);
  while (nomecompleto[i] != ' ') {
    nome[i] = nomecompleto[i];
    i++;
  }
  printf("%s", nome);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x4c(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1040 <gets@plt>
movslq -0x48(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x20,%eax
je     117d <main+0x5d>
movslq -0x48(%rbp),%rax
mov    -0x30(%rbp,%rax,1),%cl
movslq -0x48(%rbp),%rax
mov    %cl,-0x3a(%rbp,%rax,1)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    114d <main+0x2d>
lea    -0x3a(%rbp),%rsi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rdi
call   1040 <gets@plt>
mov    0x10(%rsp),%al
cmp    $0x20,%al
je     1161 <main+0x41>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
mov    %al,0x6(%rsp,%rcx,1)
movzbl 0x11(%rsp,%rcx,1),%eax
add    $0x1,%rcx
cmp    $0x20,%al
jne    1150 <main+0x30>
lea    0xeb9(%rip),%rdi
lea    0x6(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Entre com seu nome e sobrenome: \00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [30 x i8]
%3 = alloca [10 x i8]
%4 = alloca [10 x i8]
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%9 = call i32 @gets(i8* %8)
br label %10
10: ; preds = %17, %0
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 32
br i1 %16, label %17, label %27
17: ; preds = %10
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %23
store i8 %21, i8* %24
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %10
27: ; preds = %10
%28 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %28)
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
@.str = [33 x i8] c"Entre com seu nome e sobrenome: \00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [30 x i8]
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @gets(i8* %3)
%7 = load i8, i8* %3
%8 = icmp eq i8 %7, 32
br i1 %8, label %17, label %9
9: ; preds = %0, %9
%10 = phi i64 [ %13, %9 ], [ 0, %0 ]
%11 = phi i8 [ %15, %9 ], [ %7, %0 ]
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %10
store i8 %11, i8* %12
%13 = add i64 %10, 1
%14 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 32
br i1 %16, label %17, label %9
17: ; preds = %9, %0
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}