#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 *, ...);
int strlen(char *);
char *strtok(char *, char *);
int main() {
  char *str, *word;
  printf("Vvedit text: (English only) \n");
  gets(str);
  printf("Result:\n");
  for (word = strtok(str, " "); word != 0; word = strtok(0, " ")) {
    if (strlen(word) % 2 == 1) {
      for (int currElem = strlen(word) / 2 + 1; currElem < strlen(word);
           currElem++)
        word[currElem - 1] = word[currElem];
      word[strlen(word) - 1] = '\0';
    }
    printf("%s ", word);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <gets@plt>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xeaa(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1255 <main+0x115>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    122a <main+0xea>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jge    1209 <main+0xc9>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11c4 <main+0x84>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rsi
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xde2(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,-0x18(%rbp)
jmp    1188 <main+0x48>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xea5(%rip),%rdi
call   1030 <puts@plt>
call   1060 <gets@plt>
lea    0xeb1(%rip),%rdi
call   1030 <puts@plt>
lea    0xea3(%rip),%rsi
call   1070 <strtok@plt>
test   %rax,%rax
je     1232 <main+0xe2>
mov    %rax,%r12
lea    0xe6c(%rip),%r14
lea    0xe84(%rip),%r15
jmp    11cf <main+0x7f>
nopl   (%rax)
mov    %r12,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r12,1)
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   1070 <strtok@plt>
mov    %rax,%r12
test   %rax,%rax
je     1232 <main+0xe2>
mov    %r12,%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%eax
cmp    $0x1,%eax
jne    11b0 <main+0x60>
mov    %r12,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
lea    0x1(%rbx),%ebp
mov    %r12,%rdi
call   1040 <strlen@plt>
cmp    %eax,%ebp
jge    11a0 <main+0x50>
movslq %ebx,%rbx
add    $0x1,%rbx
nop
movzbl (%r12,%rbx,1),%eax
mov    %al,-0x1(%r12,%rbx,1)
add    $0x1,%rbx
mov    %r12,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1210 <main+0xc0>
jmp    11a0 <main+0x50>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Vvedit text: (English only) \0A\00"
@.str.1 = [9 x i8] c"Result:\0A\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [4 x i8] c"%s \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %2
%7 = call i32 @gets(i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%9 = load i8*, i8** %2
%10 = call i8* @strtok(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i8* %10, i8** %3
br label %11
11: ; preds = %53, %0
%12 = load i8*, i8** %3
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %55
14: ; preds = %11
%15 = load i8*, i8** %3
%16 = call i32 @strlen(i8* %15)
%17 = srem i32 %16, 2
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %50
19: ; preds = %14
%20 = load i8*, i8** %3
%21 = call i32 @strlen(i8* %20)
%22 = sdiv i32 %21, 2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %24
24: ; preds = %40, %19
%25 = load i32, i32* %4
%26 = load i8*, i8** %3
%27 = call i32 @strlen(i8* %26)
%28 = icmp slt i32 %25, %27
br i1 %28, label %29, label %43
29: ; preds = %24
%30 = load i8*, i8** %3
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i8, i8* %33
%35 = load i8*, i8** %3
%36 = load i32, i32* %4
%37 = sub nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %35, i64 %38
store i8 %34, i8* %39
br label %40
40: ; preds = %29
%41 = load i32, i32* %4
%42 = add nsw i32 %41, 1
store i32 %42, i32* %4
br label %24
43: ; preds = %24
%44 = load i8*, i8** %3
%45 = load i8*, i8** %3
%46 = call i32 @strlen(i8* %45)
%47 = sub nsw i32 %46, 1
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %44, i64 %48
store i8 0, i8* %49
br label %50
50: ; preds = %43, %14
%51 = load i8*, i8** %3
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %51)
br label %53
53: ; preds = %50
%54 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i8* %54, i8** %3
br label %11
55: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [2 x i8] c" \00"
@.str.3 = [4 x i8] c"%s \00"
@str = [29 x i8] c"Vvedit text: (English only) \00"
@str.4 = [8 x i8] c"Result:\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @gets(i8* undef)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.4, i64 0, i64 0))
%4 = tail call i8* @strtok(i8* undef, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%5 = icmp eq i8* %4, null
br i1 %5, label %40, label %6
6: ; preds = %0, %36
%7 = phi i8* [ %38, %36 ], [ %4, %0 ]
%8 = tail call i32 @strlen(i8* %7)
%9 = srem i32 %8, 2
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %36
11: ; preds = %6
%12 = tail call i32 @strlen(i8* %7)
%13 = sdiv i32 %12, 2
%14 = add nsw i32 %13, 1
%15 = tail call i32 @strlen(i8* %7)
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %20
17: ; preds = %11
%18 = sext i32 %13 to i64
%19 = add nsw i64 %18, 1
br label %25
20: ; preds = %25, %11
%21 = tail call i32 @strlen(i8* %7)
%22 = add nsw i32 %21, -1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %7, i64 %23
store i8 0, i8* %24
br label %36
25: ; preds = %17, %25
%26 = phi i64 [ %18, %17 ], [ %28, %25 ]
%27 = phi i64 [ %19, %17 ], [ %32, %25 ]
%28 = add nsw i64 %26, 1
%29 = getelementptr inbounds i8, i8* %7, i64 %27
%30 = load i8, i8* %29
%31 = getelementptr inbounds i8, i8* %7, i64 %26
store i8 %30, i8* %31
%32 = add nsw i64 %27, 1
%33 = tail call i32 @strlen(i8* %7)
%34 = sext i32 %33 to i64
%35 = icmp slt i64 %32, %34
br i1 %35, label %25, label %20
36: ; preds = %20, %6
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%38 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%39 = icmp eq i8* %38, null
br i1 %39, label %40, label %6
40: ; preds = %36, %0
ret i32 0
}