#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__ strtold(char *, char **);
int main(void) {
  char stringa1[10];
  char stringa2[10];
  char stringa3[10];
  char stringa4[10];
  double 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 += strtold(stringa1, (char **)NULL);
  sommaStringhe += strtold(stringa2, (char **)NULL);
  sommaStringhe += strtold(stringa3, (char **)NULL);
  sommaStringhe += strtold(stringa4, (char **)NULL);
  printf("La somma delle 4 stringhe e' pari a: %lf", sommaStringhe);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%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>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    -0xe(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <strtold@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <strtold@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    -0x22(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <strtold@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    -0x2c(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <strtold@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
lea    0xdd0(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0x2e(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <memset@plt>
lea    0x24(%rsp),%r13
mov    %r13,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <memset@plt>
lea    0x1a(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <memset@plt>
lea    0x10(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <memset@plt>
lea    0xe4b(%rip),%rbx
lea    0xe47(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e1b(%rip),%rbp
mov    0x0(%rbp),%edx
mov    %r12,%rdi
mov    $0xa,%esi
call   1060 <fgets@plt>
lea    0xe4a(%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    0xe54(%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    0xe5e(%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
call   1070 <strtold@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r13,%rdi
xor    %esi,%esi
call   1070 <strtold@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r15,%rdi
xor    %esi,%esi
call   1070 <strtold@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
xor    %esi,%esi
call   1070 <strtold@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0x8(%rsp),%xmm0
lea    0xdf5(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x38,%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 = [41 x i8] c"La somma delle 4 stringhe e' pari a: %lf\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 double
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 double 0.000000e+00, double* %6
%32 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%33 = call i64 @strtold(i8* %32, i8** null)
%34 = sitofp i64 %33 to double
%35 = load double, double* %6
%36 = fadd double %35, %34
store double %36, double* %6
%37 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%38 = call i64 @strtold(i8* %37, i8** null)
%39 = sitofp i64 %38 to double
%40 = load double, double* %6
%41 = fadd double %40, %39
store double %41, double* %6
%42 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%43 = call i64 @strtold(i8* %42, i8** null)
%44 = sitofp i64 %43 to double
%45 = load double, double* %6
%46 = fadd double %45, %44
store double %46, double* %6
%47 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%48 = call i64 @strtold(i8* %47, i8** null)
%49 = sitofp i64 %48 to double
%50 = load double, double* %6
%51 = fadd double %50, %49
store double %51, double* %6
%52 = load double, double* %6
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0), double %52)
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 = [41 x i8] c"La somma delle 4 stringhe e' pari a: %lf\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 @strtold(i8* nocapture %5, i8** null)
%27 = sitofp i64 %26 to double
%28 = call i64 @strtold(i8* nocapture %6, i8** null)
%29 = sitofp i64 %28 to double
%30 = fadd double %27, %29
%31 = call i64 @strtold(i8* nocapture %7, i8** null)
%32 = sitofp i64 %31 to double
%33 = fadd double %30, %32
%34 = call i64 @strtold(i8* nocapture %8, i8** null)
%35 = sitofp i64 %34 to double
%36 = fadd double %33, %35
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0), double %36)
ret i32 0
}