#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 nome_c[30], sobre[15];
  int i = 0, j = 0;
  printf("Entre com um nome e sobrenome: ");
  gets(nome_c);
  while (nome_c[i] != ' ') {
    i++;
  }
  while (nome_c[i + 1] != '\0') {
    sobre[j] = nome_c[i + 1];
    i++;
    j++;
  }
  sobre[j] = '\0';
  printf("\n%s", sobre);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1040 <gets@plt>
movslq -0x44(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x20,%eax
je     1174 <main+0x54>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1154 <main+0x34>
jmp    1179 <main+0x59>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11ba <main+0x9a>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x30(%rbp,%rax,1),%cl
movslq -0x48(%rbp),%rax
mov    %cl,-0x3f(%rbp,%rax,1)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1179 <main+0x59>
movslq -0x48(%rbp),%rax
movb   $0x0,-0x3f(%rbp,%rax,1)
lea    -0x3f(%rbp),%rsi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xed4(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rdi
call   1040 <gets@plt>
nop
cmpb   $0x20,0x10(%rsp,%rbx,1)
lea    0x1(%rbx),%rbx
jne    1140 <main+0x20>
mov    %ebx,%eax
mov    0x10(%rsp,%rax,1),%al
test   %al,%al
je     1184 <main+0x64>
add    $0xffffffffffffffff,%rbx
mov    %ebx,%ecx
lea    (%rsp,%rcx,1),%rdx
add    $0x12,%rdx
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %al,0x1(%rsp,%rcx,1)
movzbl (%rdx,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    1170 <main+0x50>
mov    %ecx,%eax
jmp    1186 <main+0x66>
xor    %eax,%eax
movb   $0x0,0x1(%rsp,%rax,1)
lea    0xe8e(%rip),%rdi
lea    0x1(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Entre com um nome e sobrenome: \00"
@.str.1 = [4 x i8] c"\0A%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [30 x i8]
%3 = alloca [15 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%8 = call i32 @gets(i8* %7)
br label %9
9: ; preds = %16, %0
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [30 x i8], [30 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 %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
br label %20
20: ; preds = %28, %19
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %41
28: ; preds = %20
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 %35
store i8 %33, i8* %36
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
store i32 %38, i32* %4
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 1
store i32 %40, i32* %5
br label %20
41: ; preds = %20
%42 = load i32, i32* %5
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 %43
store i8 0, i8* %44
%45 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %45)
%47 = load i32, i32* %1
ret i32 %47
}

LLVM IR (-O2):
@.str = [32 x i8] c"Entre com um nome e sobrenome: \00"
@.str.1 = [4 x i8] c"\0A%s\00"
define i32 @main() {
%1 = alloca [30 x i8]
%2 = alloca [15 x i8]
%3 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @gets(i8* %3)
br label %7
7: ; preds = %7, %0
%8 = phi i64 [ %12, %7 ], [ 0, %0 ]
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 32
%12 = add nuw i64 %8, 1
br i1 %11, label %13, label %7
13: ; preds = %7
%14 = add i64 %8, 1
%15 = and i64 %14, 4294967295
%16 = getelementptr inbounds [30 x i8], [30 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 [15 x i8], [15 x i8]* %2, i64 0, i64 %23
store i8 %25, i8* %26
%27 = add nuw i64 %23, 1
%28 = add nuw i64 %24, 1
%29 = getelementptr inbounds [30 x i8], [30 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 [15 x i8], [15 x i8]* %2, i64 0, i64 %35
store i8 0, i8* %36
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}