#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 *eval_string(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int getopt(int, char **, char *);
int moyenne(int *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  fputs("entiers + espace\n", stdout);
  if (getopt(argc, argv, "-1") != -1) {
    char chr[200];
    fgets(chr, 200, stdin);
    int *tab = eval_string(chr);
    printf("%d\n", moyenne(tab));
  } else {
    while (1) {
      char chr[200];
      fgets(chr, 200, stdin);
      int *tab = eval_string(chr);
      printf("%d\n", moyenne(tab));
    }
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e48(%rip),%rax
mov    (%rax),%esi
lea    0xe67(%rip),%rdi
call   1040 <fputs@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe66(%rip),%rdx
call   1080 <getopt@plt>
cmp    $0xffffffff,%eax
je     1206 <main+0x96>
lea    -0xe0(%rbp),%rdi
mov    0x2e20(%rip),%rax
mov    (%rax),%edx
mov    $0xc8,%esi
call   1060 <fgets@plt>
lea    -0xe0(%rbp),%rdi
call   1070 <eval_string@plt>
mov    %rax,-0xe8(%rbp)
mov    -0xe8(%rbp),%rdi
call   1050 <moyenne@plt>
mov    %eax,%esi
lea    0xe19(%rip),%rdi
call   1030 <printf@plt>
jmp    1257 <main+0xe7>
jmp    120b <main+0x9b>
lea    -0x1b0(%rbp),%rdi
mov    0x2dcf(%rip),%rax
mov    (%rax),%edx
mov    $0xc8,%esi
call   1060 <fgets@plt>
lea    -0x1b0(%rbp),%rdi
call   1070 <eval_string@plt>
mov    %rax,-0x1b8(%rbp)
mov    -0x1b8(%rbp),%rdi
call   1050 <moyenne@plt>
mov    %eax,%esi
lea    0xdc8(%rip),%rdi
call   1030 <printf@plt>
jmp    120b <main+0x9b>
xor    %edi,%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0xd0,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e51(%rip),%rax
mov    (%rax),%esi
lea    0xe70(%rip),%rdi
call   1040 <fputs@plt>
lea    0xe76(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1080 <getopt@plt>
cmp    $0xffffffff,%eax
jne    11ec <main+0x7c>
mov    0x2e36(%rip),%rbp
mov    %rsp,%rbx
lea    0xe59(%rip),%r14
nopl   0x0(%rax)
mov    0x0(%rbp),%edx
mov    %rbx,%rdi
mov    $0xc8,%esi
call   1060 <fgets@plt>
mov    %rbx,%rdi
call   1070 <eval_string@plt>
mov    %rax,%rdi
call   1050 <moyenne@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
jmp    11c0 <main+0x50>
mov    0x2df5(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xc8,%esi
call   1060 <fgets@plt>
mov    %rbx,%rdi
call   1070 <eval_string@plt>
mov    %rax,%rdi
call   1050 <moyenne@plt>
lea    0xdf9(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"entiers + espace\0A\00"
@stdout = global i32 0
@.str.1 = [3 x i8] c"-1\00"
@stdin = global i32 0
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [200 x i8]
%7 = alloca i32*
%8 = alloca [200 x i8]
%9 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* @stdout
%11 = call i32 @fputs(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %4
%13 = load i8**, i8*** %5
%14 = call i32 @getopt(i32 %12, i8** %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp ne i32 %14, -1
br i1 %15, label %16, label %25
16: ; preds = %2
%17 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%18 = load i32, i32* @stdin
%19 = call i32 @fgets(i8* %17, i32 200, i32 %18)
%20 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%21 = call i32* @eval_string(i8* %20)
store i32* %21, i32** %7
%22 = load i32*, i32** %7
%23 = call i32 @moyenne(i32* %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %23)
br label %35
25: ; preds = %2
br label %26
26: ; preds = %25, %26
%27 = getelementptr inbounds [200 x i8], [200 x i8]* %8, i64 0, i64 0
%28 = load i32, i32* @stdin
%29 = call i32 @fgets(i8* %27, i32 200, i32 %28)
%30 = getelementptr inbounds [200 x i8], [200 x i8]* %8, i64 0, i64 0
%31 = call i32* @eval_string(i8* %30)
store i32* %31, i32** %9
%32 = load i32*, i32** %9
%33 = call i32 @moyenne(i32* %32)
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %33)
br label %26
35: ; preds = %16
%36 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [18 x i8] c"entiers + espace\0A\00"
@stdout = global i32 0
@.str.1 = [3 x i8] c"-1\00"
@stdin = global i32 0
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [200 x i8]
%4 = alloca [200 x i8]
%5 = load i32, i32* @stdout
%6 = tail call i32 @fputs(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
br label %19
11: ; preds = %2
%12 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%13 = load i32, i32* @stdin
%14 = call i32 @fgets(i8* %12, i32 200, i32 %13)
%15 = call i32* @eval_string(i8* %12)
%16 = call i32 @moyenne(i32* %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = call i32 @exit(i32 0)
unreachable
19: ; preds = %9, %19
%20 = load i32, i32* @stdin
%21 = call i32 @fgets(i8* %10, i32 200, i32 %20)
%22 = call i32* @eval_string(i8* %10)
%23 = call i32 @moyenne(i32* %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %23)
br label %19
}