#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 */
char getchar();
scalar_t__ huiwen(char *);
int mystrlen(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ reverse(char *, char *);
int /*<<< orphan*/ squeeze(char *, char *);
int main() {
  char s[1024 + 1], sqz[1024 + 1], r[1024 + 1];
  int i = 0;
  while ((s[i] = getchar()) != '\n' && i < 1024)
    i++;
  s[i] = '\0';
  printf("String: %s, length: %d.\n", s, mystrlen(s));
  squeeze(s, sqz);
  printf("Squeezed: %s, length: %d.\n", sqz, mystrlen(sqz));
  if (huiwen(sqz)) {
    printf("No!\n");
    reverse(s, r);
    printf("Reversed: %s, length: %d.\n", r, mystrlen(r));
  } else {
    printf("Yes!\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc34(%rbp)
mov    $0x0,%al
call   1060 <getchar@plt>
movslq -0xc34(%rbp),%rcx
mov    %al,-0x410(%rbp,%rcx,1)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0xc35(%rbp)
je     11b8 <main+0x58>
cmpl   $0x400,-0xc34(%rbp)
setl   %al
mov    %al,-0xc35(%rbp)
mov    -0xc35(%rbp),%al
test   $0x1,%al
jne    11cb <main+0x6b>
jmp    11df <main+0x7f>
mov    -0xc34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc34(%rbp)
jmp    117c <main+0x1c>
movslq -0xc34(%rbp),%rax
movb   $0x0,-0x410(%rbp,%rax,1)
lea    -0x410(%rbp),%rax
mov    %rax,-0xc48(%rbp)
lea    -0x410(%rbp),%rdi
call   1070 <mystrlen@plt>
mov    -0xc48(%rbp),%rsi
mov    %eax,%edx
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x410(%rbp),%rdi
lea    -0x820(%rbp),%rsi
call   1030 <squeeze@plt>
lea    -0x820(%rbp),%rax
mov    %rax,-0xc40(%rbp)
lea    -0x820(%rbp),%rdi
call   1070 <mystrlen@plt>
mov    -0xc40(%rbp),%rsi
mov    %eax,%edx
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x820(%rbp),%rdi
call   1080 <huiwen@plt>
cmp    $0x0,%rax
je     12d0 <main+0x170>
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x410(%rbp),%rdi
lea    -0xc30(%rbp),%rsi
call   1040 <reverse@plt>
lea    -0xc30(%rbp),%rax
mov    %rax,-0xc50(%rbp)
lea    -0xc30(%rbp),%rdi
call   1070 <mystrlen@plt>
mov    -0xc50(%rbp),%rsi
mov    %eax,%edx
lea    0xd75(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12de <main+0x17e>
lea    0xd7d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0xc50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xc28,%rsp
xor    %ebx,%ebx
nopl   0x0(%rax)
xor    %eax,%eax
call   1070 <getchar@plt>
mov    %al,(%rsp,%rbx,1)
lea    0x1(%rbx),%rcx
cmp    $0xa,%al
je     119e <main+0x2e>
cmp    $0x400,%rbx
mov    %rcx,%rbx
jb     1180 <main+0x10>
movb   $0x0,-0x1(%rsp,%rcx,1)
mov    %rsp,%r14
mov    %r14,%rdi
call   1080 <mystrlen@plt>
lea    0xe4b(%rip),%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x820(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <squeeze@plt>
mov    %rbx,%rdi
call   1080 <mystrlen@plt>
lea    0xe36(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1090 <huiwen@plt>
test   %rax,%rax
je     1238 <main+0xc8>
lea    0xe51(%rip),%rdi
call   1050 <puts@plt>
mov    %rsp,%rdi
lea    0x410(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <reverse@plt>
mov    %rbx,%rdi
call   1080 <mystrlen@plt>
lea    0xe0a(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1244 <main+0xd4>
lea    0xe10(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0xc28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"String: %s, length: %d.\0A\00"
@.str.1 = [27 x i8] c"Squeezed: %s, length: %d.\0A\00"
@.str.2 = [5 x i8] c"No!\0A\00"
@.str.3 = [27 x i8] c"Reversed: %s, length: %d.\0A\00"
@.str.4 = [6 x i8] c"Yes!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1025 x i8]
%3 = alloca [1025 x i8]
%4 = alloca [1025 x i8]
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
br label %6
6: ; preds = %18, %0
%7 = call signext i8 (...) @getchar()
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [1025 x i8], [1025 x i8]* %2, i64 0, i64 %9
store i8 %7, i8* %10
%11 = sext i8 %7 to i32
%12 = icmp ne i32 %11, 10
br i1 %12, label %13, label %16
13: ; preds = %6
%14 = load i32, i32* %5
%15 = icmp slt i32 %14, 1024
br label %16
16: ; preds = %13, %6
%17 = phi i1 [ false, %6 ], [ %15, %13 ]
br i1 %17, label %18, label %21
18: ; preds = %16
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %16
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [1025 x i8], [1025 x i8]* %2, i64 0, i64 %23
store i8 0, i8* %24
%25 = getelementptr inbounds [1025 x i8], [1025 x i8]* %2, i64 0, i64 0
%26 = getelementptr inbounds [1025 x i8], [1025 x i8]* %2, i64 0, i64 0
%27 = call i32 @mystrlen(i8* %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %25, i32 %27)
%29 = getelementptr inbounds [1025 x i8], [1025 x i8]* %2, i64 0, i64 0
%30 = getelementptr inbounds [1025 x i8], [1025 x i8]* %3, i64 0, i64 0
%31 = call i32 @squeeze(i8* %29, i8* %30)
%32 = getelementptr inbounds [1025 x i8], [1025 x i8]* %3, i64 0, i64 0
%33 = getelementptr inbounds [1025 x i8], [1025 x i8]* %3, i64 0, i64 0
%34 = call i32 @mystrlen(i8* %33)
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %32, i32 %34)
%36 = getelementptr inbounds [1025 x i8], [1025 x i8]* %3, i64 0, i64 0
%37 = call i64 @huiwen(i8* %36)
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %48
39: ; preds = %21
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%41 = getelementptr inbounds [1025 x i8], [1025 x i8]* %2, i64 0, i64 0
%42 = getelementptr inbounds [1025 x i8], [1025 x i8]* %4, i64 0, i64 0
%43 = call i32 @reverse(i8* %41, i8* %42)
%44 = getelementptr inbounds [1025 x i8], [1025 x i8]* %4, i64 0, i64 0
%45 = getelementptr inbounds [1025 x i8], [1025 x i8]* %4, i64 0, i64 0
%46 = call i32 @mystrlen(i8* %45)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %44, i32 %46)
br label %50
48: ; preds = %21
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %50
50: ; preds = %48, %39
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"String: %s, length: %d.\0A\00"
@.str.1 = [27 x i8] c"Squeezed: %s, length: %d.\0A\00"
@.str.3 = [27 x i8] c"Reversed: %s, length: %d.\0A\00"
@str = [5 x i8] c"Yes!\00"
@str.5 = [4 x i8] c"No!\00"
define i32 @main() {
%1 = alloca [1025 x i8]
%2 = alloca [1025 x i8]
%3 = alloca [1025 x i8]
%4 = getelementptr inbounds [1025 x i8], [1025 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [1025 x i8], [1025 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [1025 x i8], [1025 x i8]* %3, i64 0, i64 0
br label %7
7: ; preds = %7, %0
%8 = phi i64 [ %14, %7 ], [ 0, %0 ]
%9 = tail call signext i8 (...) @getchar()
%10 = getelementptr inbounds [1025 x i8], [1025 x i8]* %1, i64 0, i64 %8
store i8 %9, i8* %10
%11 = icmp ne i8 %9, 10
%12 = icmp ult i64 %8, 1024
%13 = select i1 %11, i1 %12, i1 false
%14 = add nuw nsw i64 %8, 1
br i1 %13, label %7, label %15
15: ; preds = %7
%16 = getelementptr inbounds [1025 x i8], [1025 x i8]* %1, i64 0, i64 %8
store i8 0, i8* %16
%17 = call i32 @mystrlen(i8* %4)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %17)
%19 = call i32 @squeeze(i8* %4, i8* %5)
%20 = call i32 @mystrlen(i8* %5)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %5, i32 %20)
%22 = call i64 @huiwen(i8* %5)
%23 = icmp eq i64 %22, 0
br i1 %23, label %29, label %24
24: ; preds = %15
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.5, i64 0, i64 0))
%26 = call i32 @reverse(i8* %4, i8* %6)
%27 = call i32 @mystrlen(i8* %6)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %6, i32 %27)
br label %31
29: ; preds = %15
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %31
31: ; preds = %29, %24
ret i32 0
}