#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);
void 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;
      }
    }
  }
  printf("Bon Fichier \n");
}


x86 assembly (clang, -O0):
<checkFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x414(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x400,%edx
call   1040 <read@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     11d7 <checkFile+0xb7>
movl   $0x0,-0x414(%rbp)
mov    -0x414(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d2 <checkFile+0xb2>
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    11b9 <checkFile+0x99>
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
jmp    11e3 <checkFile+0xc3>
jmp    11be <checkFile+0x9e>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    1169 <checkFile+0x49>
jmp    113f <checkFile+0x1f>
lea    0xe33(%rip),%rdi
call   1030 <printf@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkFile>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %edi,%ebx
mov    %rsp,%rsi
mov    $0x400,%edx
call   1040 <read@plt>
lea    0xebc(%rip),%r14
test   %eax,%eax
je     119a <checkFile+0x7a>
lea    0xebe(%rip),%r12
mov    %rsp,%r15
jmp    1173 <checkFile+0x53>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%edi
mov    %r15,%rsi
mov    $0x400,%edx
call   1040 <read@plt>
test   %eax,%eax
je     119a <checkFile+0x7a>
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    %r12,%r14
mov    %r14,%rdi
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [13 x i8] c"Bon Fichier \00"
@str.2 = [16 x i8] c"Mauvais Fichier\00"
define void @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 = tail call i32 @puts(i8* dereferenceable(1) %24)
ret void
}