#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*/ date_valable(int, int, int);
char getchar();
int jours_entre_deux_dates(int, int, int, int, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main(void) {
  int jour_1, mois_1, annee_1, jour_2, mois_2, annee_2;
  printf("Ce programme calcule le nombre de jours separant deux dates.\n");
  printf("Attention: les dates doivent etre posterieures au 1er jan. 1600.\n");
  do {
    printf("Entrez la premiere date : ");
    scanf("%d %d %d", &jour_1, &mois_1, &annee_1);
    if (!date_valable(jour_1, mois_1, annee_1) || (annee_1 < 1600)) {
      printf("Cette date n'est pas valable!\n");
      while ((getchar()) != '\n')
        ;
    } else
      break;
  } while (1);
  do {
    printf("Entrez la deuxieme date : ");
    scanf("%d %d %d", &jour_2, &mois_2, &annee_2);
    if (!date_valable(jour_2, mois_2, annee_2) || (annee_2 < 1600)) {
      printf("Cette date n'est pas valable!\n");
      while ((getchar()) != '\n')
        ;
    } else
      break;
  } while (1);
  printf("Le nombre de jours separant ces deux dates est : ");
  printf("%d\n", jours_entre_deux_dates(jour_1, mois_1, annee_1, jour_2, mois_2,
                                        annee_2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xefe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf0b(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1060 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <date_valable@plt>
cmp    $0x0,%eax
je     11c5 <main+0x75>
cmpl   $0x640,-0x10(%rbp)
jge    11f0 <main+0xa0>
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11eb <main+0x9b>
jmp    11d3 <main+0x83>
jmp    11f5 <main+0xa5>
jmp    1209 <main+0xb9>
jmp    11fa <main+0xaa>
mov    $0x1,%al
test   $0x1,%al
jne    117b <main+0x2b>
jmp    1209 <main+0xb9>
jmp    120e <main+0xbe>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe78(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
call   1060 <scanf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1030 <date_valable@plt>
cmp    $0x0,%eax
je     1258 <main+0x108>
cmpl   $0x640,-0x1c(%rbp)
jge    1283 <main+0x133>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     127e <main+0x12e>
jmp    1266 <main+0x116>
jmp    1288 <main+0x138>
jmp    129c <main+0x14c>
jmp    128d <main+0x13d>
mov    $0x1,%al
test   $0x1,%al
jne    120e <main+0xbe>
jmp    129c <main+0x14c>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
call   1070 <jours_entre_deux_dates@plt>
mov    %eax,%esi
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xf00(%rip),%rdi
call   1030 <puts@plt>
lea    0xf31(%rip),%rdi
call   1030 <puts@plt>
lea    0xe73(%rip),%r14
lea    0xe87(%rip),%r15
lea    0x14(%rsp),%r12
lea    0x10(%rsp),%rbx
lea    0x4(%rsp),%rbp
lea    0xf49(%rip),%r13
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
call   1070 <scanf@plt>
mov    0x14(%rsp),%edi
mov    0x10(%rsp),%esi
mov    0x4(%rsp),%edx
call   1040 <date_valable@plt>
test   %eax,%eax
je     11ea <main+0x8a>
cmpl   $0x640,0x4(%rsp)
jge    120d <main+0xad>
mov    %r13,%rdi
call   1030 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xa,%al
jne    1200 <main+0xa0>
jmp    11b0 <main+0x50>
lea    0xe10(%rip),%r14
lea    0xe00(%rip),%r15
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r13
mov    %rsp,%rbx
lea    0xec4(%rip),%rbp
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
call   1070 <scanf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    (%rsp),%edx
call   1040 <date_valable@plt>
test   %eax,%eax
je     1268 <main+0x108>
cmpl   $0x63f,(%rsp)
jg     127d <main+0x11d>
mov    %rbp,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xa,%al
jne    1270 <main+0x110>
jmp    1230 <main+0xd0>
lea    0xdbb(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%edi
mov    0x10(%rsp),%esi
mov    0x4(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r8d
mov    (%rsp),%r9d
call   1080 <jours_entre_deux_dates@plt>
lea    0xdc1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [62 x i8] c"Ce programme calcule le nombre de jours separant deux dates.\0A\00"
@.str.1 = [66 x i8] c"Attention: les dates doivent etre posterieures au 1er jan. 1600.\0A\00"
@.str.2 = [27 x i8] c"Entrez la premiere date : \00"
@.str.3 = [9 x i8] c"%d %d %d\00"
@.str.4 = [31 x i8] c"Cette date n'est pas valable!\0A\00"
@.str.5 = [27 x i8] c"Entrez la deuxieme date : \00"
@.str.6 = [50 x i8] c"Le nombre de jours separant ces deux dates est : \00"
@.str.7 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %31, %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = call i32 @date_valable(i32 %13, i32 %14, i32 %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %10
%19 = load i32, i32* %4
%20 = icmp slt i32 %19, 1600
br i1 %20, label %21, label %29
21: ; preds = %18, %10
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
br label %23
23: ; preds = %27, %21
%24 = call signext i8 (...) @getchar()
%25 = sext i8 %24 to i32
%26 = icmp ne i32 %25, 10
br i1 %26, label %27, label %28
27: ; preds = %23
br label %23
28: ; preds = %23
br label %30
29: ; preds = %18
br label %32
30: ; preds = %28
br label %31
31: ; preds = %30
br i1 true, label %10, label %32
32: ; preds = %31, %29
br label %33
33: ; preds = %54, %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%35 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32* %5, i32* %6, i32* %7)
%36 = load i32, i32* %5
%37 = load i32, i32* %6
%38 = load i32, i32* %7
%39 = call i32 @date_valable(i32 %36, i32 %37, i32 %38)
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %33
%42 = load i32, i32* %7
%43 = icmp slt i32 %42, 1600
br i1 %43, label %44, label %52
44: ; preds = %41, %33
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
br label %46
46: ; preds = %50, %44
%47 = call signext i8 (...) @getchar()
%48 = sext i8 %47 to i32
%49 = icmp ne i32 %48, 10
br i1 %49, label %50, label %51
50: ; preds = %46
br label %46
51: ; preds = %46
br label %53
52: ; preds = %41
br label %55
53: ; preds = %51
br label %54
54: ; preds = %53
br i1 true, label %33, label %55
55: ; preds = %54, %52
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0))
%57 = load i32, i32* %2
%58 = load i32, i32* %3
%59 = load i32, i32* %4
%60 = load i32, i32* %5
%61 = load i32, i32* %6
%62 = load i32, i32* %7
%63 = call i32 @jours_entre_deux_dates(i32 %57, i32 %58, i32 %59, i32 %60, i32 %61, i32 %62)
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %63)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [27 x i8] c"Entrez la premiere date : \00"
@.str.3 = [9 x i8] c"%d %d %d\00"
@.str.5 = [27 x i8] c"Entrez la deuxieme date : \00"
@.str.6 = [50 x i8] c"Le nombre de jours separant ces deux dates est : \00"
@.str.7 = [4 x i8] c"%d\0A\00"
@str = [61 x i8] c"Ce programme calcule le nombre de jours separant deux dates.\00"
@str.8 = [65 x i8] c"Attention: les dates doivent etre posterieures au 1er jan. 1600.\00"
@str.10 = [30 x i8] c"Cette date n'est pas valable!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str.8, i64 0, i64 0))
br label %15
15: ; preds = %28, %0
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%18 = load i32, i32* %1
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = call i32 @date_valable(i32 %18, i32 %19, i32 %20)
%22 = icmp eq i32 %21, 0
%23 = load i32, i32* %3
%24 = icmp slt i32 %23, 1600
%25 = select i1 %22, i1 true, i1 %24
br i1 %25, label %26, label %31
26: ; preds = %15
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.10, i64 0, i64 0))
br label %28
28: ; preds = %28, %26
%29 = call signext i8 (...) @getchar()
%30 = icmp eq i8 %29, 10
br i1 %30, label %15, label %28
31: ; preds = %44, %15
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%33 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32* %4, i32* %5, i32* %6)
%34 = load i32, i32* %4
%35 = load i32, i32* %5
%36 = load i32, i32* %6
%37 = call i32 @date_valable(i32 %34, i32 %35, i32 %36)
%38 = icmp eq i32 %37, 0
%39 = load i32, i32* %6
%40 = icmp slt i32 %39, 1600
%41 = select i1 %38, i1 true, i1 %40
br i1 %41, label %42, label %47
42: ; preds = %31
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.10, i64 0, i64 0))
br label %44
44: ; preds = %44, %42
%45 = call signext i8 (...) @getchar()
%46 = icmp eq i8 %45, 10
br i1 %46, label %31, label %44
47: ; preds = %31
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0))
%49 = load i32, i32* %1
%50 = load i32, i32* %2
%51 = load i32, i32* %3
%52 = load i32, i32* %4
%53 = load i32, i32* %5
%54 = load i32, i32* %6
%55 = call i32 @jours_entre_deux_dates(i32 %49, i32 %50, i32 %51, i32 %52, i32 %53, i32 %54)
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %55)
ret i32 0
}