#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*/ printf(char *, ...);
int scanf(char *, float *);
int main(int argc, char *argv[], char *env[]) {
  float M = 0, x, i = 0;
  printf("Rentrez vos nombres :\n");
  int continuer = scanf("%f", &x);
  while (continuer) {
    M += x;
    continuer = scanf("%f", &x);
    i++;
  }
  printf("La moyenne est de %f\n", (M / i));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     11ae <main+0x8e>
movss  -0x20(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
lea    0xe90(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
mov    %eax,-0x28(%rbp)
movss  0xe61(%rip),%xmm0
addss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    116b <main+0x4b>
movss  -0x1c(%rbp),%xmm0
divss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
lea    0xec2(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
test   %eax,%eax
je     11b2 <main+0x82>
xorps  %xmm0,%xmm0
lea    0xeaa(%rip),%r14
lea    0xc(%rsp),%rbx
xorps  %xmm1,%xmm1
nopw   0x0(%rax,%rax,1)
movss  %xmm0,0x14(%rsp)
addss  0xc(%rsp),%xmm1
movss  %xmm1,0x10(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
movss  0x10(%rsp),%xmm1
movss  0x14(%rsp),%xmm0
addss  0xe67(%rip),%xmm0
test   %eax,%eax
jne    1170 <main+0x40>
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
jmp    11ba <main+0x8a>
movsd  0xe46(%rip),%xmm0
lea    0xe4e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Rentrez vos nombres :\0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [22 x i8] c"La moyenne est de %f\0A\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca i32
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store float 0.000000e+00, float* %8
store float 0.000000e+00, float* %10
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %9)
store i32 %13, i32* %11
br label %14
14: ; preds = %17, %3
%15 = load i32, i32* %11
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %24
17: ; preds = %14
%18 = load float, float* %9
%19 = load float, float* %8
%20 = fadd float %19, %18
store float %20, float* %8
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %9)
store i32 %21, i32* %11
%22 = load float, float* %10
%23 = fadd float %22, 1.000000e+00
store float %23, float* %10
br label %14
24: ; preds = %14
%25 = load float, float* %8
%26 = load float, float* %10
%27 = fdiv float %25, %26
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), double %28)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [22 x i8] c"La moyenne est de %f\0A\00"
@str = [22 x i8] c"Rentrez vos nombres :\00"
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = alloca float
%5 = bitcast float* %4 to i8*
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%8 = icmp eq i32 %7, 0
br i1 %8, label %20, label %9
9: ; preds = %3, %9
%10 = phi float [ %15, %9 ], [ 0.000000e+00, %3 ]
%11 = phi float [ %13, %9 ], [ 0.000000e+00, %3 ]
%12 = load float, float* %4
%13 = fadd float %11, %12
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%15 = fadd float %10, 1.000000e+00
%16 = icmp eq i32 %14, 0
br i1 %16, label %17, label %9
17: ; preds = %9
%18 = fdiv float %13, %15
%19 = fpext float %18 to double
br label %20
20: ; preds = %17, %3
%21 = phi double [ %19, %17 ], [ 0x7FF8000000000000, %3 ]
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), double %21)
ret i32 0
}