#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;
double Media(double, double);
int Potenza(int, int);
int SommaElementi(int *, int);
int /*<<< orphan*/ StampaGiorno(int);
scalar_t__ VerificaData(int);
int /*<<< orphan*/ printf(char *, int, ...);
int main(int argc, char *argv[]) {
  double x = 10.8, y = 89.90;
  int val = 2, n = 5;
  int vettore[10], tot_elem;
  int data = 5;
  printf("La media di %g + %g = %g\n", x, y, Media(x, y));
  printf("Potenza %d^%d = %d\n", val, n, Potenza(val, n));
  printf("Valori degli argomenti nel main val=%d n=%d\n", val, n);
  tot_elem = SommaElementi(vettore, 10);
  printf("Somma elementi vettore = %d\n", tot_elem);
  StampaGiorno(31);
  StampaGiorno(-1);
  StampaGiorno(32);
  while (data--) {
    if (VerificaData(data) > 0)
      printf("%d e' una data valida\n", data);
    else
      printf("%d non e' una data valida\n", data);
  }
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xe8a(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe75(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x2,-0x24(%rbp)
movl   $0x5,-0x28(%rbp)
movl   $0x5,-0x58(%rbp)
cvttsd2si -0x18(%rbp),%eax
mov    %eax,-0x6c(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1070 <Media@plt>
mov    -0x6c(%rbp),%esi
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
lea    0xe38(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
call   1060 <Potenza@plt>
mov    -0x60(%rbp),%esi
mov    -0x5c(%rbp),%edx
mov    %eax,%ecx
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0xa,%esi
call   1030 <SommaElementi@plt>
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%esi
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1f,%edi
call   1080 <StampaGiorno@plt>
mov    $0xffffffff,%edi
call   1080 <StampaGiorno@plt>
mov    $0x20,%edi
call   1080 <StampaGiorno@plt>
mov    -0x58(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x58(%rbp)
cmp    $0x0,%eax
je     12b2 <main+0x152>
mov    -0x58(%rbp),%edi
call   1040 <VerificaData@plt>
cmp    $0x0,%rax
jle    129c <main+0x13c>
mov    -0x58(%rbp),%esi
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12ad <main+0x14d>
mov    -0x58(%rbp),%esi
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1260 <main+0x100>
mov    0x2d27(%rip),%rax
mov    (%rax),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movsd  0xe91(%rip),%xmm0
movsd  0xe91(%rip),%xmm1
call   1070 <Media@plt>
movaps %xmm0,%xmm1
lea    0xe8a(%rip),%rdi
mov    $0xa,%esi
movsd  0xe75(%rip),%xmm0
mov    $0x2,%al
call   1050 <printf@plt>
mov    $0x2,%edi
mov    $0x5,%esi
call   1060 <Potenza@plt>
lea    0xe7a(%rip),%rdi
mov    $0x2,%esi
mov    $0x5,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe74(%rip),%rdi
mov    $0x2,%esi
mov    $0x5,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rsp,%rdi
mov    $0xa,%esi
call   1030 <SommaElementi@plt>
lea    0xe7c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1f,%edi
call   1080 <StampaGiorno@plt>
mov    $0xffffffff,%edi
call   1080 <StampaGiorno@plt>
mov    $0x20,%edi
call   1080 <StampaGiorno@plt>
mov    $0x4,%edi
call   1040 <VerificaData@plt>
test   %rax,%rax
lea    0xe5e(%rip),%r14
lea    0xe6e(%rip),%rbx
mov    %rbx,%rdi
cmovg  %r14,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x3,%edi
call   1040 <VerificaData@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmovg  %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x2,%edi
call   1040 <VerificaData@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmovg  %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
call   1040 <VerificaData@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmovg  %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
call   1040 <VerificaData@plt>
test   %rax,%rax
cmovg  %r14,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2d1b(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [26 x i8] c"La media di %g + %g = %g\0A\00"
@.str.1 = [20 x i8] c"Potenza %d^%d = %d\0A\00"
@.str.2 = [45 x i8] c"Valori degli argomenti nel main val=%d n=%d\0A\00"
@.str.3 = [29 x i8] c"Somma elementi vettore = %d\0A\00"
@.str.4 = [23 x i8] c"%d e' una data valida\0A\00"
@.str.5 = [27 x i8] c"%d non e' una data valida\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
%10 = alloca [10 x i32]
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 1.080000e+01, double* %6
store double 8.990000e+01, double* %7
store i32 2, i32* %8
store i32 5, i32* %9
store i32 5, i32* %12
%13 = load double, double* %6
%14 = fptosi double %13 to i32
%15 = load double, double* %7
%16 = load double, double* %6
%17 = load double, double* %7
%18 = call double @Media(double %16, double %17)
%19 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %14, double %15, double %18)
%20 = load i32, i32* %8
%21 = load i32, i32* %9
%22 = load i32, i32* %8
%23 = load i32, i32* %9
%24 = call i32 @Potenza(i32 %22, i32 %23)
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %20, i32 %21, i32 %24)
%26 = load i32, i32* %8
%27 = load i32, i32* %9
%28 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i32 %26, i32 %27)
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %10, i64 0, i64 0
%30 = call i32 @SommaElementi(i32* %29, i32 10)
store i32 %30, i32* %11
%31 = load i32, i32* %11
%32 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %31)
%33 = call i32 @StampaGiorno(i32 31)
%34 = call i32 @StampaGiorno(i32 -1)
%35 = call i32 @StampaGiorno(i32 32)
br label %36
36: ; preds = %50, %2
%37 = load i32, i32* %12
%38 = add nsw i32 %37, -1
store i32 %38, i32* %12
%39 = icmp ne i32 %37, 0
br i1 %39, label %40, label %51
40: ; preds = %36
%41 = load i32, i32* %12
%42 = call i64 @VerificaData(i32 %41)
%43 = icmp sgt i64 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %40
%45 = load i32, i32* %12
%46 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %45)
br label %50
47: ; preds = %40
%48 = load i32, i32* %12
%49 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 %48)
br label %50
50: ; preds = %47, %44
br label %36
51: ; preds = %36
%52 = load i32, i32* @EXIT_SUCCESS
ret i32 %52
}

LLVM IR (-O2):
@.str = [26 x i8] c"La media di %g + %g = %g\0A\00"
@.str.1 = [20 x i8] c"Potenza %d^%d = %d\0A\00"
@.str.2 = [45 x i8] c"Valori degli argomenti nel main val=%d n=%d\0A\00"
@.str.3 = [29 x i8] c"Somma elementi vettore = %d\0A\00"
@.str.4 = [23 x i8] c"%d e' una data valida\0A\00"
@.str.5 = [27 x i8] c"%d non e' una data valida\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i32]
%4 = bitcast [10 x i32]* %3 to i8*
%5 = tail call double @Media(double 1.080000e+01, double 8.990000e+01)
%6 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 10, double 8.990000e+01, double %5)
%7 = tail call i32 @Potenza(i32 2, i32 5)
%8 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 5, i32 %7)
%9 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i32 2, i32 5)
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%11 = call i32 @SommaElementi(i32* %10, i32 10)
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%13 = call i32 @StampaGiorno(i32 31)
%14 = call i32 @StampaGiorno(i32 -1)
%15 = call i32 @StampaGiorno(i32 32)
%16 = call i64 @VerificaData(i32 4)
%17 = icmp sgt i64 %16, 0
%18 = select i1 %17, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0)
%19 = call i32 (i8*, i32, ...) @printf(i8* %18, i32 4)
%20 = call i64 @VerificaData(i32 3)
%21 = icmp sgt i64 %20, 0
%22 = select i1 %21, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0)
%23 = call i32 (i8*, i32, ...) @printf(i8* %22, i32 3)
%24 = call i64 @VerificaData(i32 2)
%25 = icmp sgt i64 %24, 0
%26 = select i1 %25, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0)
%27 = call i32 (i8*, i32, ...) @printf(i8* %26, i32 2)
%28 = call i64 @VerificaData(i32 1)
%29 = icmp sgt i64 %28, 0
%30 = select i1 %29, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0)
%31 = call i32 (i8*, i32, ...) @printf(i8* %30, i32 1)
%32 = call i64 @VerificaData(i32 0)
%33 = icmp sgt i64 %32, 0
%34 = select i1 %33, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0)
%35 = call i32 (i8*, i32, ...) @printf(i8* %34, i32 0)
%36 = load i32, i32* @EXIT_SUCCESS
ret i32 %36
}