#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 *, char *);
int /*<<< orphan*/ puts(char *);
main() {
  char nome_completo[100];
  char nome[50];
  char sobrenome[50];
  int i = 0;
  puts("Por favor, digite nome e sobrenome: ");
  gets(nome_completo);
  while ((nome_completo[i] != ' ') && (nome_completo[i] != '\0')) {
    nome[i] = nome_completo[i];
    i++;
  }
  nome[i] = '\0';
  printf("Nome: %s", nome);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xf4(%rbp)
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
lea    -0x70(%rbp),%rdi
call   1050 <gets@plt>
movslq -0xf4(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0xf5(%rbp)
je     1196 <main+0x66>
movslq -0xf4(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0xf5(%rbp)
mov    -0xf5(%rbp),%al
test   $0x1,%al
jne    11a9 <main+0x79>
jmp    11d6 <main+0xa6>
movslq -0xf4(%rbp),%rax
mov    -0x70(%rbp,%rax,1),%cl
movslq -0xf4(%rbp),%rax
mov    %cl,-0xb0(%rbp,%rax,1)
mov    -0xf4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf4(%rbp)
jmp    1161 <main+0x31>
movslq -0xf4(%rbp),%rax
movb   $0x0,-0xb0(%rbp,%rax,1)
lea    -0xb0(%rbp),%rsi
lea    0xe32(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xa8,%rsp
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
lea    0x40(%rsp),%rdi
call   1050 <gets@plt>
xor    %eax,%eax
nop
movzbl 0x40(%rsp,%rax,1),%ecx
test   $0xdf,%cl
je     1163 <main+0x33>
mov    %cl,(%rsp,%rax,1)
add    $0x1,%rax
jmp    1150 <main+0x20>
mov    %eax,%eax
movb   $0x0,(%rsp,%rax,1)
lea    0xeb5(%rip),%rdi
mov    %rsp,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xa8,%rsp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Por favor, digite nome e sobrenome: \00"
@.str.1 = [9 x i8] c"Nome: %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [50 x i8]
%4 = alloca [50 x i8]
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
%6 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = call i32 @gets(i8* %7)
br label %9
9: ; preds = %25, %0
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [100 x i8], [100 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* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100 x i8], [100 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 %35
25: ; preds = %23
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = load i32, i32* %5
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 %31
store i8 %29, i8* %32
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
br label %9
35: ; preds = %23
%36 = load i32, i32* %5
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 %37
store i8 0, i8* %38
%39 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%40 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %39)
%41 = load i32, i32* %1
ret i32 %41
}

LLVM IR (-O2):
@.str = [37 x i8] c"Por favor, digite nome e sobrenome: \00"
@.str.1 = [9 x i8] c"Nome: %s\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [50 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @gets(i8* %3)
br label %7
7: ; preds = %11, %0
%8 = phi i64 [ %13, %11 ], [ 0, %0 ]
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %8
%10 = load i8, i8* %9
switch i8 %10, label %11 [
i8 32, label %14
i8 0, label %14
]
11: ; preds = %7
%12 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %8
store i8 %10, i8* %12
%13 = add nuw i64 %8, 1
br label %7
14: ; preds = %7, %7
%15 = and i64 %8, 4294967295
%16 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %15
store i8 0, i8* %16
%17 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}