#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdin;
scalar_t__ strtol(char *, char **, int);
int main(void) {
  char stringa1[10];
  char stringa2[10];
  char stringa3[10];
  char stringa4[10];
  int sommaStringhe;
  memset(stringa1, 0, 10);
  memset(stringa2, 0, 10);
  memset(stringa3, 0, 10);
  memset(stringa4, 0, 10);
  printf("%s", "\nPrego inserire il valore della stringa1: ");
  fgets(stringa1, 10, stdin);
  printf("%s", "\nPrego inserire il valore della stringa2: ");
  fgets(stringa2, 10, stdin);
  printf("%s", "\nPrego inserire il valore della stringa3: ");
  fgets(stringa3, 10, stdin);
  printf("%s", "\nPrego inserire il valore della stringa4: ");
  fgets(stringa4, 10, stdin);
  puts("");
  sommaStringhe = 0;
  sommaStringhe += strtol(stringa1, (char **)NULL, 10);
  sommaStringhe += strtol(stringa2, (char **)NULL, 10);
  sommaStringhe += strtol(stringa3, (char **)NULL, 10);
  sommaStringhe += strtol(stringa4, (char **)NULL, 10);
  printf("La somma delle 4 stringhe e' pari a: %d", sommaStringhe);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <memset@plt>
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <memset@plt>
lea    -0x22(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <memset@plt>
lea    -0x2c(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <memset@plt>
lea    0xe5a(%rip),%rdi
lea    0xe56(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xe(%rbp),%rdi
mov    0x2e29(%rip),%rax
mov    (%rax),%edx
mov    $0xa,%esi
call   1060 <fgets@plt>
lea    0xe2e(%rip),%rdi
lea    0xe55(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x18(%rbp),%rdi
mov    0x2dfd(%rip),%rax
mov    (%rax),%edx
mov    $0xa,%esi
call   1060 <fgets@plt>
lea    0xe02(%rip),%rdi
lea    0xe54(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x22(%rbp),%rdi
mov    0x2dd1(%rip),%rax
mov    (%rax),%edx
mov    $0xa,%esi
call   1060 <fgets@plt>
lea    0xdd6(%rip),%rdi
lea    0xe53(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x2c(%rbp),%rdi
mov    0x2da5(%rip),%rax
mov    (%rax),%edx
mov    $0xa,%esi
call   1060 <fgets@plt>
lea    0xdd7(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x30(%rbp)
lea    -0xe(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,%rcx
movslq -0x30(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x30(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,%rcx
movslq -0x30(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x30(%rbp)
lea    -0x22(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,%rcx
movslq -0x30(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x30(%rbp)
lea    -0x2c(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,%rcx
movslq -0x30(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%esi
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0x1e(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <memset@plt>
lea    0x14(%rsp),%r13
mov    %r13,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <memset@plt>
lea    0xa(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <memset@plt>
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <memset@plt>
lea    0xe4d(%rip),%rbx
lea    0xe49(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e1d(%rip),%rbp
mov    0x0(%rbp),%edx
mov    %r12,%rdi
mov    $0xa,%esi
call   1060 <fgets@plt>
lea    0xe4c(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x0(%rbp),%edx
mov    %r13,%rdi
mov    $0xa,%esi
call   1060 <fgets@plt>
lea    0xe56(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x0(%rbp),%edx
mov    %r15,%rdi
mov    $0xa,%esi
call   1060 <fgets@plt>
lea    0xe60(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x0(%rbp),%edx
mov    %r14,%rdi
mov    $0xa,%esi
call   1060 <fgets@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,%rbx
mov    %r13,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
add    %eax,%ebx
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
add    %eax,%ebx
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
add    %eax,%ebx
lea    0xe1b(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [43 x i8] c"\0APrego inserire il valore della stringa1: \00"
@stdin = global i32 0
@.str.2 = [43 x i8] c"\0APrego inserire il valore della stringa2: \00"
@.str.3 = [43 x i8] c"\0APrego inserire il valore della stringa3: \00"
@.str.4 = [43 x i8] c"\0APrego inserire il valore della stringa4: \00"
@.str.5 = [1 x i8] zeroinitializer
@.str.6 = [40 x i8] c"La somma delle 4 stringhe e' pari a: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca [10 x i8]
%4 = alloca [10 x i8]
%5 = alloca [10 x i8]
%6 = alloca i32
store i32 0, i32* %1
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%8 = call i32 @memset(i8* %7, i32 0, i32 10)
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%10 = call i32 @memset(i8* %9, i32 0, i32 10)
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%12 = call i32 @memset(i8* %11, i32 0, i32 10)
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%14 = call i32 @memset(i8* %13, i32 0, i32 10)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%17 = load i32, i32* @stdin
%18 = call i32 @fgets(i8* %16, i32 10, i32 %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%20 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%21 = load i32, i32* @stdin
%22 = call i32 @fgets(i8* %20, i32 10, i32 %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%24 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%25 = load i32, i32* @stdin
%26 = call i32 @fgets(i8* %24, i32 10, i32 %25)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
%28 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%29 = load i32, i32* @stdin
%30 = call i32 @fgets(i8* %28, i32 10, i32 %29)
%31 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %6
%32 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%33 = call i64 @strtol(i8* %32, i8** null, i32 10)
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = add nsw i64 %35, %33
%37 = trunc i64 %36 to i32
store i32 %37, i32* %6
%38 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%39 = call i64 @strtol(i8* %38, i8** null, i32 10)
%40 = load i32, i32* %6
%41 = sext i32 %40 to i64
%42 = add nsw i64 %41, %39
%43 = trunc i64 %42 to i32
store i32 %43, i32* %6
%44 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%45 = call i64 @strtol(i8* %44, i8** null, i32 10)
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = add nsw i64 %47, %45
%49 = trunc i64 %48 to i32
store i32 %49, i32* %6
%50 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%51 = call i64 @strtol(i8* %50, i8** null, i32 10)
%52 = load i32, i32* %6
%53 = sext i32 %52 to i64
%54 = add nsw i64 %53, %51
%55 = trunc i64 %54 to i32
store i32 %55, i32* %6
%56 = load i32, i32* %6
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i32 %56)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [43 x i8] c"\0APrego inserire il valore della stringa1: \00"
@stdin = global i32 0
@.str.2 = [43 x i8] c"\0APrego inserire il valore della stringa2: \00"
@.str.3 = [43 x i8] c"\0APrego inserire il valore della stringa3: \00"
@.str.4 = [43 x i8] c"\0APrego inserire il valore della stringa4: \00"
@.str.6 = [40 x i8] c"La somma delle 4 stringhe e' pari a: %d\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [10 x i8]
%3 = alloca [10 x i8]
%4 = alloca [10 x i8]
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%9 = call i32 @memset(i8* %5, i32 0, i32 10)
%10 = call i32 @memset(i8* %6, i32 0, i32 10)
%11 = call i32 @memset(i8* %7, i32 0, i32 10)
%12 = call i32 @memset(i8* %8, i32 0, i32 10)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* @stdin
%15 = call i32 @fgets(i8* %5, i32 10, i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* @stdin
%18 = call i32 @fgets(i8* %6, i32 10, i32 %17)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%20 = load i32, i32* @stdin
%21 = call i32 @fgets(i8* %7, i32 10, i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
%23 = load i32, i32* @stdin
%24 = call i32 @fgets(i8* %8, i32 10, i32 %23)
%25 = call i32 @putchar(i32 10)
%26 = call i64 @strtol(i8* nocapture %5, i8** null, i32 10)
%27 = call i64 @strtol(i8* nocapture %6, i8** null, i32 10)
%28 = add i64 %27, %26
%29 = call i64 @strtol(i8* nocapture %7, i8** null, i32 10)
%30 = add i64 %28, %29
%31 = call i64 @strtol(i8* nocapture %8, i8** null, i32 10)
%32 = add i64 %30, %31
%33 = trunc i64 %32 to i32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i32 %33)
ret i32 0
}