#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 EXIT_SUCCESS;
int count_spaces(char *);
int /*<<< orphan*/ printf(char *, ...);
int read_line(char *, int);
int /*<<< orphan*/ strlen(char *);
int vect_count_spaces(char *);
int /*<<< orphan*/ view_char_by_char(char *, int /*<<< orphan*/);
int main(int argc, char *argv[], char *envp[]) {
  char str[32 + 1];
  printf("Totale caratteri: %d\n", read_line(str, 32 + 1));
  printf("Stringa: %s\n", str);
  view_char_by_char(str, strlen(str));
  printf("Conteggio degli spazi bianchi: %d\n", count_spaces(str));
  printf("Conteggio degli spazi bianchi (vettori): %d\n",
         vect_count_spaces(str));
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x40(%rbp),%rdi
mov    $0x21,%esi
call   1080 <read_line@plt>
mov    %eax,%esi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x48(%rbp),%rdi
mov    %eax,%esi
call   1070 <view_char_by_char@plt>
lea    -0x40(%rbp),%rdi
call   1060 <count_spaces@plt>
mov    %eax,%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
call   1030 <vect_count_spaces@plt>
mov    %eax,%esi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x21,%esi
call   1080 <read_line@plt>
lea    0xe84(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe8a(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1070 <view_char_by_char@plt>
mov    %rbx,%rdi
call   1060 <count_spaces@plt>
lea    0xe6c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <vect_count_spaces@plt>
lea    0xe77(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2e01(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Totale caratteri: %d\0A\00"
@.str.1 = [13 x i8] c"Stringa: %s\0A\00"
@.str.2 = [35 x i8] c"Conteggio degli spazi bianchi: %d\0A\00"
@.str.3 = [45 x i8] c"Conteggio degli spazi bianchi (vettori): %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca [33 x i8]
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%9 = getelementptr inbounds [33 x i8], [33 x i8]* %8, i64 0, i64 0
%10 = call i32 @read_line(i8* %9, i32 33)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [33 x i8], [33 x i8]* %8, i64 0, i64 0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [33 x i8], [33 x i8]* %8, i64 0, i64 0
%15 = getelementptr inbounds [33 x i8], [33 x i8]* %8, i64 0, i64 0
%16 = call i32 @strlen(i8* %15)
%17 = call i32 @view_char_by_char(i8* %14, i32 %16)
%18 = getelementptr inbounds [33 x i8], [33 x i8]* %8, i64 0, i64 0
%19 = call i32 @count_spaces(i8* %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds [33 x i8], [33 x i8]* %8, i64 0, i64 0
%22 = call i32 @vect_count_spaces(i8* %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%24 = load i32, i32* @EXIT_SUCCESS
ret i32 %24
}

LLVM IR (-O2):
@.str = [22 x i8] c"Totale caratteri: %d\0A\00"
@.str.1 = [13 x i8] c"Stringa: %s\0A\00"
@.str.2 = [35 x i8] c"Conteggio degli spazi bianchi: %d\0A\00"
@.str.3 = [45 x i8] c"Conteggio degli spazi bianchi (vettori): %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = alloca [33 x i8]
%5 = getelementptr inbounds [33 x i8], [33 x i8]* %4, i64 0, i64 0
%6 = call i32 @read_line(i8* %5, i32 33)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%9 = call i32 @strlen(i8* %5)
%10 = call i32 @view_char_by_char(i8* %5, i32 %9)
%11 = call i32 @count_spaces(i8* %5)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = call i32 @vect_count_spaces(i8* %5)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = load i32, i32* @EXIT_SUCCESS
ret i32 %15
}