#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 EOF;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char);
int scanf(char *, ...);
int /*<<< orphan*/ stdout;
int traitement(int);
int /*<<< orphan*/ write(int, char *, int);
int main() {
  int x;
  char c;
  int res;
  while (1) {
    res = scanf("%d", &x);
    if (res == EOF) {
      write(2, "Do nothing c'est ce n'est pas bon!", 36);
      exit(1);
    } else if (res == 1) {
      printf("%d\n", traitement(x));
      fflush(stdout);
    } else {
      scanf("%c", &c);
      if (c == '\n') {
        printf("%c", c);
        fflush(stdout);
      } else
        write(2, "Erreure ...", 12);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    0x2e5a(%rip),%rcx
cmp    (%rcx),%eax
jne    11b6 <main+0x56>
mov    $0x2,%edi
lea    0xe61(%rip),%rsi
mov    $0x24,%edx
call   1040 <write@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
cmpl   $0x1,-0x10(%rbp)
jne    11ea <main+0x8a>
mov    -0x8(%rbp),%edi
call   1030 <traitement@plt>
lea    0xe57(%rip),%rdi
movsbl %al,%esi
call   1050 <printf@plt>
mov    0x2dfa(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
jmp    1247 <main+0xe7>
lea    0xe39(%rip),%rdi
lea    -0x9(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
movsbl -0x9(%rbp),%eax
cmp    $0xa,%eax
jne    122c <main+0xcc>
lea    0xe1a(%rip),%rdi
movsbl -0x9(%rbp),%esi
call   1050 <printf@plt>
mov    0x2db8(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
jmp    1242 <main+0xe2>
mov    $0x2,%edi
lea    0xdf5(%rip),%rsi
mov    $0xc,%edx
call   1040 <write@plt>
jmp    1247 <main+0xe7>
jmp    124c <main+0xec>
jmp    116f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe8e(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x2e63(%rip),%rbp
cmp    0x0(%rbp),%eax
jne    11aa <main+0x4a>
lea    0xe72(%rip),%rsi
mov    $0x2,%edi
mov    $0x24,%edx
call   1040 <write@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    0x2e27(%rip),%r14
lea    0xe48(%rip),%r15
lea    0x4(%rsp),%rbx
lea    0xe66(%rip),%r12
lea    0x3(%rsp),%r13
jmp    1202 <main+0xa2>
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp),%edi
call   1030 <traitement@plt>
movsbl %al,%esi
lea    0xe43(%rip),%rdi
call   1050 <printf@plt>
mov    (%r14),%edi
call   1060 <fflush@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
cmp    0x0(%rbp),%eax
je     118a <main+0x2a>
cmp    $0x1,%eax
je     11d0 <main+0x70>
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
cmpb   $0xa,0x3(%rsp)
jne    1230 <main+0xd0>
mov    %r12,%rdi
mov    $0xa,%esi
jmp    11e3 <main+0x83>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x2,%edi
lea    0xdf1(%rip),%rsi
mov    $0xc,%edx
call   1040 <write@plt>
jmp    11f0 <main+0x90>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@EOF = global i32 0
@.str.1 = [35 x i8] c"Do nothing c'est ce n'est pas bon!\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@stdout = global i32 0
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [12 x i8] c"Erreure ...\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %0, %37
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %13
10: ; preds = %5
%11 = call i32 @write(i32 2, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 36)
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %5
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %23
16: ; preds = %13
%17 = load i32, i32* %2
%18 = call i32 @traitement(i32 %17)
%19 = trunc i32 %18 to i8
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 signext %19)
%21 = load i32, i32* @stdout
%22 = call i32 @fflush(i32 %21)
br label %36
23: ; preds = %13
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%25 = load i8, i8* %3
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 10
br i1 %27, label %28, label %33
28: ; preds = %23
%29 = load i8, i8* %3
%30 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8 signext %29)
%31 = load i32, i32* @stdout
%32 = call i32 @fflush(i32 %31)
br label %35
33: ; preds = %23
%34 = call i32 @write(i32 2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 12)
br label %35
35: ; preds = %33, %28
br label %36
36: ; preds = %35, %16
br label %37
37: ; preds = %36
br label %5
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i32 0
@.str.1 = [35 x i8] c"Do nothing c'est ce n'est pas bon!\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@stdout = global i32 0
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [12 x i8] c"Erreure ...\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %4, %5
br i1 %6, label %7, label %10
7: ; preds = %30, %0
%8 = call i32 @write(i32 2, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 36)
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %0, %30
%11 = phi i32 [ %31, %30 ], [ %4, %0 ]
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = load i32, i32* %1
%15 = call i32 @traitement(i32 %14)
%16 = trunc i32 %15 to i8
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 signext %16)
%18 = load i32, i32* @stdout
%19 = call i32 @fflush(i32 %18)
br label %30
20: ; preds = %10
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%22 = load i8, i8* %2
%23 = icmp eq i8 %22, 10
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8 signext 10)
%26 = load i32, i32* @stdout
%27 = call i32 @fflush(i32 %26)
br label %30
28: ; preds = %20
%29 = call i32 @write(i32 2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 12)
br label %30
30: ; preds = %13, %28, %24
%31 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%32 = load i32, i32* @EOF
%33 = icmp eq i32 %31, %32
br i1 %33, label %7, label %10
}