#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*/ LC_ALL;
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
scalar_t__ strlen(char *);
int main() {
  setlocale(LC_ALL, "RUS");
  char current_sym, previous_sym;
  char word[80];
  int index, word_index;
  printf("Введите предложение:\n");
  for (index = 0, current_sym = ' ', word_index = 0; index < 80; index++) {
    previous_sym = current_sym;
    current_sym = getchar();
    if (current_sym == ' ')
      continue;
    if (current_sym == '.')
      break;
    if (previous_sym == ' ')
      word_index = 0;
    word[word_index++] = current_sym;
  }
  word[word_index] = '\0';
  if (strlen(word) == 0)
    printf("Что-то пошло не так");
  else
    printf("Последнее слово: %s", word);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
lea    0xea1(%rip),%rsi
call   1060 <setlocale@plt>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x64(%rbp)
movb   $0x20,-0x5(%rbp)
movl   $0x0,-0x68(%rbp)
cmpl   $0x50,-0x64(%rbp)
jge    11f8 <main+0xb8>
mov    -0x5(%rbp),%al
mov    %al,-0x6(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jne    11b0 <main+0x70>
jmp    11ea <main+0xaa>
movsbl -0x5(%rbp),%eax
cmp    $0x2e,%eax
jne    11c2 <main+0x82>
jmp    11f8 <main+0xb8>
movsbl -0x6(%rbp),%eax
cmp    $0x20,%eax
jne    11d6 <main+0x96>
movl   $0x0,-0x68(%rbp)
mov    -0x5(%rbp),%cl
mov    -0x68(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x68(%rbp)
cltq
mov    %cl,-0x60(%rbp,%rax,1)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1184 <main+0x44>
movslq -0x68(%rbp),%rax
movb   $0x0,-0x60(%rbp,%rax,1)
lea    -0x60(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jne    1227 <main+0xe7>
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1239 <main+0xf9>
lea    -0x60(%rbp),%rsi
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
lea    0xea6(%rip),%rsi
call   1060 <setlocale@plt>
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
mov    $0x20,%bl
xor    %r14d,%r14d
mov    $0x50,%ebp
xor    %r15d,%r15d
jmp    1198 <main+0x58>
nopw   0x0(%rax,%rax,1)
cmp    $0x20,%bl
cmove  %r14d,%r15d
movslq %r15d,%rcx
add    $0x1,%r15d
mov    %al,(%rsp,%rcx,1)
mov    %eax,%ebx
add    $0xffffffff,%ebp
je     11a7 <main+0x67>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0x20,%al
je     1191 <main+0x51>
cmp    $0x2e,%al
jne    1180 <main+0x40>
movslq %r15d,%rax
movb   $0x0,(%rsp,%rax,1)
cmpb   $0x0,(%rsp)
je     11c7 <main+0x87>
lea    0xe6c(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11d5 <main+0x95>
lea    0xe36(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [4 x i8] c"RUS\00"
@.str.1 = [40 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D0\BF\D1\80\D0\B5\D0\B4\D0\BB\D0\BE\D0\B6\D0\B5\D0\BD\D0\B8\D0\B5:\0A\00"
@.str.2 = [35 x i8] c"\D0\A7\D1\82\D0\BE-\D1\82\D0\BE \D0\BF\D0\BE\D1\88\D0\BB\D0\BE \D0\BD\D0\B5 \D1\82\D0\B0\D0\BA\00"
@.str.3 = [34 x i8] c"\D0\9F\D0\BE\D1\81\D0\BB\D0\B5\D0\B4\D0\BD\D0\B5\D0\B5 \D1\81\D0\BB\D0\BE\D0\B2\D0\BE: %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = alloca [80 x i8]
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = load i32, i32* @LC_ALL
%8 = call i32 @setlocale(i32 %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
store i8 32, i8* %2
store i32 0, i32* %6
br label %10
10: ; preds = %36, %0
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 80
br i1 %12, label %13, label %39
13: ; preds = %10
%14 = load i8, i8* %2
store i8 %14, i8* %3
%15 = call signext i8 (...) @getchar()
store i8 %15, i8* %2
%16 = load i8, i8* %2
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 32
br i1 %18, label %19, label %20
19: ; preds = %13
br label %36
20: ; preds = %13
%21 = load i8, i8* %2
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 46
br i1 %23, label %24, label %25
24: ; preds = %20
br label %39
25: ; preds = %20
%26 = load i8, i8* %3
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 32
br i1 %28, label %29, label %30
29: ; preds = %25
store i32 0, i32* %6
br label %30
30: ; preds = %29, %25
%31 = load i8, i8* %2
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
%34 = sext i32 %32 to i64
%35 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %34
store i8 %31, i8* %35
br label %36
36: ; preds = %30, %19
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %10
39: ; preds = %24, %10
%40 = load i32, i32* %6
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %41
store i8 0, i8* %42
%43 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%44 = call i64 @strlen(i8* %43)
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %39
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
br label %51
48: ; preds = %39
%49 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %49)
br label %51
51: ; preds = %48, %46
ret i32 0
}

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [4 x i8] c"RUS\00"
@.str.2 = [35 x i8] c"\D0\A7\D1\82\D0\BE-\D1\82\D0\BE \D0\BF\D0\BE\D1\88\D0\BB\D0\BE \D0\BD\D0\B5 \D1\82\D0\B0\D0\BA\00"
@.str.3 = [34 x i8] c"\D0\9F\D0\BE\D1\81\D0\BB\D0\B5\D0\B4\D0\BD\D0\B5\D0\B5 \D1\81\D0\BB\D0\BE\D0\B2\D0\BE: %s\00"
@str = [39 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D0\BF\D1\80\D0\B5\D0\B4\D0\BB\D0\BE\D0\B6\D0\B5\D0\BD\D0\B8\D0\B5:\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = load i32, i32* @LC_ALL
%3 = tail call i32 @setlocale(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %0, %17
%7 = phi i32 [ 0, %0 ], [ %18, %17 ]
%8 = phi i32 [ 0, %0 ], [ %19, %17 ]
%9 = phi i8 [ 32, %0 ], [ %10, %17 ]
%10 = tail call signext i8 (...) @getchar()
switch i8 %10, label %11 [
i8 32, label %17
i8 46, label %21
]
11: ; preds = %6
%12 = icmp eq i8 %9, 32
%13 = select i1 %12, i32 0, i32 %7
%14 = add nsw i32 %13, 1
%15 = sext i32 %13 to i64
%16 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %15
store i8 %10, i8* %16
br label %17
17: ; preds = %6, %11
%18 = phi i32 [ %7, %6 ], [ %14, %11 ]
%19 = add nuw nsw i32 %8, 1
%20 = icmp eq i32 %19, 80
br i1 %20, label %21, label %6
21: ; preds = %6, %17
%22 = phi i32 [ %7, %6 ], [ %18, %17 ]
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %23
store i8 0, i8* %24
%25 = load i8, i8* %4
%26 = icmp eq i8 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %21
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
br label %31
29: ; preds = %21
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %4)
br label %31
31: ; preds = %29, %27
ret i32 0
}