#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*/ print_table(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ str_to_table(int *, char *, int);
int main() {
  int array[27] = {0};
  char input[257] = {0};
  printf("Enter string without spaces (maximum length %d symbols):\n", 257);
  scanf("%s", input);
  str_to_table(array, input, 257);
  printf("Result (char and count number):\n");
  print_table(array, 27);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x6c,%edx
call   1050 <memset@plt>
lea    -0x180(%rbp),%rdi
xor    %esi,%esi
mov    $0x101,%edx
call   1050 <memset@plt>
lea    0xe74(%rip),%rdi
mov    $0x101,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x180(%rbp),%rsi
lea    0xe94(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x70(%rbp),%rdi
lea    -0x180(%rbp),%rsi
mov    $0x101,%edx
call   1060 <str_to_table@plt>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    $0x1b,%esi
call   1030 <print_table@plt>
xor    %eax,%eax
add    $0x180,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x178,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0x5c(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0x70(%rsp),%r14
mov    $0x101,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
lea    0xe56(%rip),%rdi
mov    $0x101,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe7d(%rip),%rdi
mov    %r14,%rsi
call   1080 <scanf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x101,%edx
call   1070 <str_to_table@plt>
lea    0xe5e(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x1b,%esi
call   1030 <print_table@plt>
xor    %eax,%eax
add    $0x178,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [58 x i8] c"Enter string without spaces (maximum length %d symbols):\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [33 x i8] c"Result (char and count number):\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [27 x i32]
%3 = alloca [257 x i8]
store i32 0, i32* %1
%4 = bitcast [27 x i32]* %2 to i8*
%5 = bitcast [257 x i8]* %3 to i8*
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 257)
%7 = getelementptr inbounds [257 x i8], [257 x i8]* %3, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [27 x i32], [27 x i32]* %2, i64 0, i64 0
%10 = getelementptr inbounds [257 x i8], [257 x i8]* %3, i64 0, i64 0
%11 = call i32 @str_to_table(i32* %9, i8* %10, i32 257)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%13 = getelementptr inbounds [27 x i32], [27 x i32]* %2, i64 0, i64 0
%14 = call i32 @print_table(i32* %13, i32 27)
ret i32 0
}

LLVM IR (-O2):
@.str = [58 x i8] c"Enter string without spaces (maximum length %d symbols):\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@str = [32 x i8] c"Result (char and count number):\00"
define i32 @main() {
%1 = alloca [27 x i32]
%2 = alloca [257 x i8]
%3 = bitcast [27 x i32]* %1 to i8*
%4 = getelementptr inbounds [257 x i8], [257 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 257)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%7 = getelementptr inbounds [27 x i32], [27 x i32]* %1, i64 0, i64 0
%8 = call i32 @str_to_table(i32* %7, i8* %4, i32 257)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%10 = call i32 @print_table(i32* %7, i32 27)
ret i32 0
}