#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*/ sscanf(char *, char *, char *, int *, char *);
int estValidePositionBateauHumainBatailleNavale(char positionBateau[500]) {
  int ligne;
  char colonne, direction;
  sscanf(positionBateau, "%c%d %c", &colonne, &ligne, &direction);
  if (colonne < 'A' || colonne > 'J')
    return 0;
  if (ligne < 1 || ligne > 10)
    return 0;
  if (direction != 'H' && direction != 'B' && direction != 'G' &&
      direction != 'D')
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<estValidePositionBateauHumainBatailleNavale>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
lea    -0x15(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x16(%rbp),%r8
call   1030 <sscanf@plt>
movsbl -0x15(%rbp),%eax
cmp    $0x41,%eax
jl     1152 <estValidePositionBateauHumainBatailleNavale+0x42>
movsbl -0x15(%rbp),%eax
cmp    $0x4a,%eax
jle    115e <estValidePositionBateauHumainBatailleNavale+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    11c5 <estValidePositionBateauHumainBatailleNavale+0xb5>
cmpl   $0x1,-0x14(%rbp)
jl     1172 <estValidePositionBateauHumainBatailleNavale+0x62>
cmpl   $0xa,-0x14(%rbp)
jle    117e <estValidePositionBateauHumainBatailleNavale+0x6e>
movl   $0x0,-0x4(%rbp)
jmp    11c5 <estValidePositionBateauHumainBatailleNavale+0xb5>
movsbl -0x16(%rbp),%eax
cmp    $0x48,%eax
je     11be <estValidePositionBateauHumainBatailleNavale+0xae>
movsbl -0x16(%rbp),%eax
cmp    $0x42,%eax
je     11be <estValidePositionBateauHumainBatailleNavale+0xae>
movsbl -0x16(%rbp),%eax
cmp    $0x47,%eax
je     11be <estValidePositionBateauHumainBatailleNavale+0xae>
movsbl -0x16(%rbp),%eax
cmp    $0x44,%eax
je     11be <estValidePositionBateauHumainBatailleNavale+0xae>
movl   $0x0,-0x4(%rbp)
jmp    11c5 <estValidePositionBateauHumainBatailleNavale+0xb5>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<estValidePositionBateauHumainBatailleNavale>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0x3(%rsp),%rdx
lea    0x4(%rsp),%rcx
lea    0x2(%rsp),%r8
call   1030 <sscanf@plt>
mov    0x3(%rsp),%cl
add    $0xb5,%cl
xor    %eax,%eax
cmp    $0xf6,%cl
jb     1160 <estValidePositionBateauHumainBatailleNavale+0x50>
mov    0x4(%rsp),%ecx
add    $0xfffffff5,%ecx
cmp    $0xfffffff6,%ecx
jb     1160 <estValidePositionBateauHumainBatailleNavale+0x50>
mov    0x2(%rsp),%cl
add    $0xbe,%cl
cmp    $0x6,%cl
ja     1160 <estValidePositionBateauHumainBatailleNavale+0x50>
movsbq %cl,%rax
lea    0xeab(%rip),%rcx
mov    (%rcx,%rax,4),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%c%d %c\00"
define i32 @estValidePositionBateauHumainBatailleNavale(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %5, i32* %4, i8* %6)
%9 = load i8, i8* %5
%10 = sext i8 %9 to i32
%11 = icmp slt i32 %10, 65
br i1 %11, label %16, label %12
12: ; preds = %1
%13 = load i8, i8* %5
%14 = sext i8 %13 to i32
%15 = icmp sgt i32 %14, 74
br i1 %15, label %16, label %17
16: ; preds = %12, %1
store i32 0, i32* %2
br label %42
17: ; preds = %12
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 1
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = load i32, i32* %4
%22 = icmp sgt i32 %21, 10
br i1 %22, label %23, label %24
23: ; preds = %20, %17
store i32 0, i32* %2
br label %42
24: ; preds = %20
%25 = load i8, i8* %6
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 72
br i1 %27, label %28, label %41
28: ; preds = %24
%29 = load i8, i8* %6
%30 = sext i8 %29 to i32
%31 = icmp ne i32 %30, 66
br i1 %31, label %32, label %41
32: ; preds = %28
%33 = load i8, i8* %6
%34 = sext i8 %33 to i32
%35 = icmp ne i32 %34, 71
br i1 %35, label %36, label %41
36: ; preds = %32
%37 = load i8, i8* %6
%38 = sext i8 %37 to i32
%39 = icmp ne i32 %38, 68
br i1 %39, label %40, label %41
40: ; preds = %36
store i32 0, i32* %2
br label %42
41: ; preds = %36, %32, %28, %24
store i32 1, i32* %2
br label %42
42: ; preds = %41, %40, %23, %16
%43 = load i32, i32* %2
ret i32 %43
}

LLVM IR (-O2):
@.str = [8 x i8] c"%c%d %c\00"
@switch.table.estValidePositionBateauHumainBatailleNavale = [7 x i32] [i32 1, i32 0, i32 1, i32 0, i32 0, i32 1, i32 1]
define i32 @estValidePositionBateauHumainBatailleNavale(i8* nocapture %0) {
%2 = alloca i32
%3 = alloca i8
%4 = alloca i8
%5 = bitcast i32* %2 to i8*
%6 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %3, i32* %2, i8* %4)
%7 = load i8, i8* %3
%8 = add i8 %7, -75
%9 = icmp ult i8 %8, -10
br i1 %9, label %22, label %10
10: ; preds = %1
%11 = load i32, i32* %2
%12 = add i32 %11, -11
%13 = icmp ult i32 %12, -10
br i1 %13, label %22, label %14
14: ; preds = %10
%15 = load i8, i8* %4
%16 = add i8 %15, -66
%17 = icmp ult i8 %16, 7
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = sext i8 %16 to i64
%20 = getelementptr inbounds [7 x i32], [7 x i32]* @switch.table.estValidePositionBateauHumainBatailleNavale, i64 0, i64 %19
%21 = load i32, i32* %20
br label %22
22: ; preds = %18, %14, %10, %1
%23 = phi i32 [ 0, %1 ], [ 0, %10 ], [ 0, %14 ], [ %21, %18 ]
ret i32 %23
}