#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, j = 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++;
  }
  i++;
  while (nome_completo[i] != '\0') {
    sobrenome[j] = nome_completo[i];
    j++;
    i++;
  }
  nome[i] = '\0';
  sobrenome[j] = '\0';
  printf("Sobre nome: %s", sobrenome);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xf4(%rbp)
movl   $0x0,-0xf8(%rbp)
lea    0xea3(%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,-0xf9(%rbp)
je     11a0 <main+0x70>
movslq -0xf4(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0xf9(%rbp)
mov    -0xf9(%rbp),%al
test   $0x1,%al
jne    11b3 <main+0x83>
jmp    11e0 <main+0xb0>
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    116b <main+0x3b>
mov    -0xf4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf4(%rbp)
movslq -0xf4(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1240 <main+0x110>
movslq -0xf4(%rbp),%rax
mov    -0x70(%rbp,%rax,1),%cl
movslq -0xf8(%rbp),%rax
mov    %cl,-0xf0(%rbp,%rax,1)
mov    -0xf8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf8(%rbp)
mov    -0xf4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf4(%rbp)
jmp    11ef <main+0xbf>
movslq -0xf4(%rbp),%rax
movb   $0x0,-0xb0(%rbp,%rax,1)
movslq -0xf8(%rbp),%rax
movb   $0x0,-0xf0(%rbp,%rax,1)
lea    -0xf0(%rbp),%rsi
lea    0xdb9(%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
testb  $0xdf,0x40(%rsp,%rax,1)
je     116b <main+0x3b>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rax
testb  $0xdf,0x40(%rsp,%rax,1)
jne    1160 <main+0x30>
lea    0x1(%rax),%ecx
mov    0x40(%rsp,%rcx,1),%cl
test   %cl,%cl
je     11a3 <main+0x73>
mov    %eax,%eax
lea    (%rsp,%rax,1),%rdx
add    $0x42,%rdx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %cl,(%rsp,%rax,1)
movzbl (%rdx,%rax,1),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1190 <main+0x60>
mov    %eax,%eax
jmp    11a5 <main+0x75>
xor    %eax,%eax
movb   $0x0,(%rsp,%rax,1)
lea    0xe75(%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 = [15 x i8] c"Sobre 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
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
store i32 0, i32* %6
%7 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%9 = call i32 @gets(i8* %8)
br label %10
10: ; preds = %26, %0
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [100 x i8], [100 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 %24
17: ; preds = %10
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 0
br label %24
24: ; preds = %17, %10
%25 = phi i1 [ false, %10 ], [ %23, %17 ]
br i1 %25, label %26, label %36
26: ; preds = %24
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 %32
store i8 %30, i8* %33
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 1
store i32 %35, i32* %5
br label %10
36: ; preds = %24
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %39
39: ; preds = %46, %36
%40 = load i32, i32* %5
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %58
46: ; preds = %39
%47 = load i32, i32* %5
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %48
%50 = load i8, i8* %49
%51 = load i32, i32* %6
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 %52
store i8 %50, i8* %53
%54 = load i32, i32* %6
%55 = add nsw i32 %54, 1
store i32 %55, i32* %6
%56 = load i32, i32* %5
%57 = add nsw i32 %56, 1
store i32 %57, i32* %5
br label %39
58: ; preds = %39
%59 = load i32, i32* %5
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 %60
store i8 0, i8* %61
%62 = load i32, i32* %6
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 %63
store i8 0, i8* %64
%65 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%66 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %65)
%67 = load i32, i32* %1
ret i32 %67
}

LLVM IR (-O2):
@.str = [37 x i8] c"Por favor, digite nome e sobrenome: \00"
@.str.1 = [15 x i8] c"Sobre 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 [ %12, %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 %13
i8 0, label %13
]
11: ; preds = %7
%12 = add nuw i64 %8, 1
br label %7
13: ; preds = %7, %7
%14 = add i64 %8, 1
%15 = and i64 %14, 4294967295
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %34, label %19
19: ; preds = %13
%20 = and i64 %8, 4294967295
%21 = add nuw nsw i64 %20, 1
br label %22
22: ; preds = %19, %22
%23 = phi i64 [ 0, %19 ], [ %27, %22 ]
%24 = phi i64 [ %21, %19 ], [ %28, %22 ]
%25 = phi i8 [ %17, %19 ], [ %30, %22 ]
%26 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %23
store i8 %25, i8* %26
%27 = add nuw i64 %23, 1
%28 = add nuw nsw i64 %24, 1
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = icmp eq i8 %30, 0
br i1 %31, label %32, label %22
32: ; preds = %22
%33 = and i64 %27, 4294967295
br label %34
34: ; preds = %32, %13
%35 = phi i64 [ 0, %13 ], [ %33, %32 ]
%36 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %35
store i8 0, i8* %36
%37 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}