#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 */
scalar_t__ datevalide(char *);
int /*<<< orphan*/ soustringcopy(char *, char *, int, int);
int strtoint(char *);
int verifdatenaiss(char *chaine) {
  char strtmp[5];
  int annee;
  if (datevalide(chaine)) {
    soustringcopy(chaine, strtmp, 6, 4);
    annee = strtoint(strtmp);
    if ((annee > 1904) && (annee < 1997))
      return 1;
    else
      return 0;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<verifdatenaiss>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <datevalide@plt>
cmp    $0x0,%rax
je     11a4 <verifdatenaiss+0x74>
mov    -0x10(%rbp),%rdi
lea    -0x15(%rbp),%rsi
mov    $0x6,%edx
mov    $0x4,%ecx
call   1040 <soustringcopy@plt>
lea    -0x15(%rbp),%rdi
call   1030 <strtoint@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x770,-0x1c(%rbp)
jle    1198 <verifdatenaiss+0x68>
cmpl   $0x7cd,-0x1c(%rbp)
jge    1198 <verifdatenaiss+0x68>
movl   $0x1,-0x4(%rbp)
jmp    11ab <verifdatenaiss+0x7b>
movl   $0x0,-0x4(%rbp)
jmp    11ab <verifdatenaiss+0x7b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verifdatenaiss>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1050 <datevalide@plt>
test   %rax,%rax
je     1175 <verifdatenaiss+0x45>
lea    0x3(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x6,%edx
mov    $0x4,%ecx
call   1040 <soustringcopy@plt>
mov    %r14,%rdi
call   1030 <strtoint@plt>
mov    %eax,%ecx
add    $0xfffff88f,%ecx
xor    %eax,%eax
cmp    $0x5c,%ecx
setb   %al
jmp    1177 <verifdatenaiss+0x47>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @verifdatenaiss(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [5 x i8]
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i64 @datevalide(i8* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %22
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%12 = call i32 @soustringcopy(i8* %10, i8* %11, i32 6, i32 4)
%13 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%14 = call i32 @strtoint(i8* %13)
store i32 %14, i32* %5
%15 = load i32, i32* %5
%16 = icmp sgt i32 %15, 1904
br i1 %16, label %17, label %21
17: ; preds = %9
%18 = load i32, i32* %5
%19 = icmp slt i32 %18, 1997
br i1 %19, label %20, label %21
20: ; preds = %17
store i32 1, i32* %2
br label %23
21: ; preds = %17, %9
store i32 0, i32* %2
br label %23
22: ; preds = %1
store i32 0, i32* %2
br label %23
23: ; preds = %22, %21, %20
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @verifdatenaiss(i8* %0) {
%2 = alloca [5 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%4 = tail call i64 @datevalide(i8* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %1
%7 = call i32 @soustringcopy(i8* %0, i8* %3, i32 6, i32 4)
%8 = call i32 @strtoint(i8* %3)
%9 = add i32 %8, -1905
%10 = icmp ult i32 %9, 92
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %1, %6
%13 = phi i32 [ %11, %6 ], [ 0, %1 ]
ret i32 %13
}