#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 read(int, char *, int);
int checkFile(int des) {
  int rc = 0;
  char buf[1024];
  int i = 0;
  while ((rc = read(des, buf, 1024)) != 0) {
    for (i = 0; i < rc; i++) {
      if (buf[i] < '0' || buf[i] > '9') {
        printf("Mauvais Fichier\n");
        return 1;
      }
    }
  }
  printf("Bon Fichier \n");
  return 0;
}


x86 assembly (clang, -O0):
<checkFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x414(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x400,%edx
call   1040 <read@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
je     11de <checkFile+0xbe>
movl   $0x0,-0x414(%rbp)
mov    -0x414(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11d9 <checkFile+0xb9>
movslq -0x414(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0x30,%eax
jl     11a8 <checkFile+0x88>
movslq -0x414(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0x39,%eax
jle    11c0 <checkFile+0xa0>
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11f1 <checkFile+0xd1>
jmp    11c5 <checkFile+0xa5>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    1169 <checkFile+0x49>
jmp    113f <checkFile+0x1f>
lea    0xe2c(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkFile>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %edi,%ebp
mov    %rsp,%rsi
mov    $0x400,%edx
call   1040 <read@plt>
lea    0xebd(%rip),%rbx
test   %eax,%eax
je     11a1 <checkFile+0x81>
lea    0xebf(%rip),%r15
mov    %rsp,%r14
jmp    1173 <checkFile+0x53>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x400,%edx
call   1040 <read@plt>
test   %eax,%eax
je     11a1 <checkFile+0x81>
test   %eax,%eax
jle    1160 <checkFile+0x40>
mov    %eax,%eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
movzbl (%rsp,%rcx,1),%edx
add    $0xc6,%dl
cmp    $0xf5,%dl
jbe    1197 <checkFile+0x77>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1180 <checkFile+0x60>
jmp    1160 <checkFile+0x40>
mov    $0x1,%ebp
mov    %r15,%rbx
jmp    11a3 <checkFile+0x83>
xor    %ebp,%ebp
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %ebp,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Mauvais Fichier\0A\00"
@.str.1 = [14 x i8] c"Bon Fichier \0A\00"
define i32 @checkFile(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [1024 x i8]
%6 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %6
br label %7
7: ; preds = %37, %1
%8 = load i32, i32* %3
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%10 = call i32 @read(i32 %8, i8* %9, i32 1024)
store i32 %10, i32* %4
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %38
12: ; preds = %7
store i32 0, i32* %6
br label %13
13: ; preds = %34, %12
%14 = load i32, i32* %6
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %37
17: ; preds = %13
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp slt i32 %22, 48
br i1 %23, label %31, label %24
24: ; preds = %17
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp sgt i32 %29, 57
br i1 %30, label %31, label %33
31: ; preds = %24, %17
%32 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %2
br label %40
33: ; preds = %24
br label %34
34: ; preds = %33
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
br label %13
37: ; preds = %13
br label %7
38: ; preds = %7
%39 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
br label %40
40: ; preds = %38, %31
%41 = load i32, i32* %2
ret i32 %41
}

LLVM IR (-O2):
@str = [13 x i8] c"Bon Fichier \00"
@str.2 = [16 x i8] c"Mauvais Fichier\00"
define i32 @checkFile(i32 %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32 @read(i32 %0, i8* %3, i32 1024)
%5 = icmp eq i32 %4, 0
br i1 %5, label %23, label %9
6: ; preds = %14, %9
%7 = call i32 @read(i32 %0, i8* %3, i32 1024)
%8 = icmp eq i32 %7, 0
br i1 %8, label %23, label %9
9: ; preds = %1, %6
%10 = phi i32 [ %7, %6 ], [ %4, %1 ]
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %6
12: ; preds = %9
%13 = zext i32 %10 to i64
br label %16
14: ; preds = %16
%15 = icmp eq i64 %22, %13
br i1 %15, label %6, label %16
16: ; preds = %12, %14
%17 = phi i64 [ 0, %12 ], [ %22, %14 ]
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = add i8 %19, -58
%21 = icmp ult i8 %20, -10
%22 = add nuw nsw i64 %17, 1
br i1 %21, label %23, label %14
23: ; preds = %6, %16, %1
%24 = phi i8* [ getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.2, i64 0, i64 0), %16 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0), %6 ]
%25 = phi i32 [ 0, %1 ], [ 1, %16 ], [ 0, %6 ]
%26 = tail call i32 @puts(i8* dereferenceable(1) %24)
ret i32 %25
}