#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 *, int *);
int main(void) {
  int n, items;
  int cpt = 0;
  int sum = 0;
  int max = -1;
  do {
    printf("Entrer un entier: ");
    items = scanf("%d", &n);
    if (items == 1 && n > 0) {
      cpt += 1;
      sum += n;
      if (n > max)
        max = n;
    }
  } while (items == 1 && n > 0);
  if (cpt > 0) {
    printf("Le maximum des %d nombres saisis est %d. La somme est %d.\n", cpt,
           max, sum);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0xffffffff,-0x18(%rbp)
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    11a2 <main+0x82>
cmpl   $0x0,-0x8(%rbp)
jle    11a2 <main+0x82>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    119d <main+0x7d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11a2 <main+0x82>
jmp    11a7 <main+0x87>
xor    %eax,%eax
cmpl   $0x1,-0xc(%rbp)
mov    %al,-0x19(%rbp)
jne    11c0 <main+0xa0>
cmpl   $0x0,-0x8(%rbp)
setg   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1144 <main+0x24>
cmpl   $0x0,-0x10(%rbp)
jle    11ec <main+0xcc>
mov    -0x10(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0xffffffff,%ebx
lea    0xedc(%rip),%r12
lea    0x4(%rsp),%r13
xor    %eax,%eax
mov    $0xffffffff,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebp,%r15d
mov    %eax,%r14d
lea    0xea3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
cmp    %ebp,%ecx
cmovg  %ecx,%ebp
add    $0x1,%ebx
cmp    $0x1,%eax
jne    1188 <main+0x68>
lea    (%rcx,%r14,1),%eax
test   %ecx,%ecx
jg     1150 <main+0x30>
test   %ebx,%ebx
je     11a2 <main+0x82>
lea    0xe83(%rip),%rdi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %r14d,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Entrer un entier: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [59 x i8] c"Le maximum des %d nombres saisis est %d. La somme est %d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
store i32 -1, i32* %6
br label %7
7: ; preds = %34, %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %27
12: ; preds = %7
%13 = load i32, i32* %2
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %27
15: ; preds = %12
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
%18 = load i32, i32* %2
%19 = load i32, i32* %5
%20 = add nsw i32 %19, %18
store i32 %20, i32* %5
%21 = load i32, i32* %2
%22 = load i32, i32* %6
%23 = icmp sgt i32 %21, %22
br i1 %23, label %24, label %26
24: ; preds = %15
%25 = load i32, i32* %2
store i32 %25, i32* %6
br label %26
26: ; preds = %24, %15
br label %27
27: ; preds = %26, %12, %7
br label %28
28: ; preds = %27
%29 = load i32, i32* %3
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = load i32, i32* %2
%33 = icmp sgt i32 %32, 0
br label %34
34: ; preds = %31, %28
%35 = phi i1 [ false, %28 ], [ %33, %31 ]
br i1 %35, label %7, label %36
36: ; preds = %34
%37 = load i32, i32* %4
%38 = icmp sgt i32 %37, 0
br i1 %38, label %39, label %44
39: ; preds = %36
%40 = load i32, i32* %4
%41 = load i32, i32* %6
%42 = load i32, i32* %5
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0), i32 %40, i32 %41, i32 %42)
br label %44
44: ; preds = %39, %36
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Entrer un entier: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [59 x i8] c"Le maximum des %d nombres saisis est %d. La somme est %d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = phi i32 [ 0, %0 ], [ %13, %3 ]
%5 = phi i32 [ 0, %0 ], [ %14, %3 ]
%6 = phi i32 [ -1, %0 ], [ %16, %3 ]
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = icmp eq i32 %8, 1
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 0
%12 = select i1 %9, i1 %11, i1 false
%13 = add nuw nsw i32 %4, 1
%14 = add nsw i32 %10, %5
%15 = icmp sgt i32 %10, %6
%16 = select i1 %15, i32 %10, i32 %6
br i1 %12, label %3, label %17
17: ; preds = %3
%18 = icmp eq i32 %4, 0
br i1 %18, label %21, label %19
19: ; preds = %17
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0), i32 %4, i32 %6, i32 %5)
br label %21
21: ; preds = %19, %17
ret i32 0
}