#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*/ afficherEnTete();
int /*<<< orphan*/ lecteurResultat(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, int, ...);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void menu(int sock) {
  char ville1[100];
  char ville2[100];
  char tram[100];
  char heure1[100];
  char heure2[100];
  char stx = 0x02;
  char etx = 0x03;
  int choix = 1;
  int cpt = 0;
  afficherEnTete();
  while (choix != 0) {
    tram[0] = '\0';
    printf("Menu (0 pour quitter) :\n");
    printf("    -> 1 : Recherche du 1er train disponible\n");
    printf("    -> 2 : Recherche des trains disponibles entre 2 horraires\n");
    printf("    -> 3 : Recherche des trains disponibles pour un trajet\n");
    if (cpt > 0) {
      printf(
          "    -> 4 : Trouver le meilleur tarif sur la derniere recherche\n");
      printf(
          "    -> 5 : Trouver la meilleure duree sur la derniere recherche\n");
    }
    scanf("%d", &choix);
    afficherEnTete();
    if (choix == 1) {
      printf("Recherche du 1er train disponible : \n");
      printf("-----------------------------------------------------\n");
      printf("Ville de depart : ");
      scanf("%s", ville1);
      printf("Ville de d'arrivee : ");
      scanf("%s", ville2);
      printf("Heure de depart (hh:mm) : ");
      scanf("%s", heure1);
      sprintf(tram, "%c1#%s#%s#%s%c", 0x02, ville1, ville2, heure1, 0x03);
      write(sock, tram, strlen(tram));
      lecteurResultat(sock);
    } else if (choix == 2) {
      printf("Recherche des trains disponibles entre 2 horraires :\n");
      printf("-----------------------------------------------------\n");
      printf("Ville de depart : ");
      scanf("%s", ville1);
      printf("Ville de d'arrivee : ");
      scanf("%s", ville2);
      printf("Heure min (hh:mm) : ");
      scanf("%s", heure1);
      printf("Heure max (hh:mm) : ");
      scanf("%s", heure2);
      sprintf(tram, "%c2#%s#%s#%s#%s%c", 0x02, ville1, ville2, heure1, heure2,
              0x03);
      write(sock, tram, strlen(tram));
      lecteurResultat(sock);
    } else if (choix == 3) {
      printf("Recherche des trains disponibles pour un trajet\n");
      printf("-----------------------------------------------------\n");
      printf("Ville de depart : ");
      scanf("%s", ville1);
      printf("Ville de d'arrivee : ");
      scanf("%s", ville2);
      sprintf(tram, "%c3#%s#%s%c", 0x02, ville1, ville2, 0x03);
      write(sock, tram, strlen(tram));
      lecteurResultat(sock);
    } else if (choix == 4) {
      sprintf(tram, "%c%c#%c", 0x02, '4', 0x03);
      write(sock, tram, strlen(tram));
      lecteurResultat(sock);
    } else if (choix == 5) {
      sprintf(tram, "%c%c#%c", 0x02, '5', 0x03);
      write(sock, tram, strlen(tram));
      lecteurResultat(sock);
    } else if (choix == 0) {
      sprintf(tram, "%c%c#%c", 0x02, '0', 0x03);
      write(sock, tram, strlen(tram));
      printf("         A BIENTOT");
    }
    cpt++;
  }
}


x86 assembly (clang, -O0):
<menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2b0,%rsp
mov    %edi,-0x4(%rbp)
movb   $0x2,-0x231(%rbp)
movb   $0x3,-0x232(%rbp)
movl   $0x1,-0x238(%rbp)
movl   $0x0,-0x23c(%rbp)
mov    $0x0,%al
call   1090 <afficherEnTete@plt>
cmpl   $0x0,-0x238(%rbp)
je     16b2 <menu+0x542>
movb   $0x0,-0x150(%rbp)
lea    0xe3e(%rip),%rdi
call   1050 <printf@plt>
lea    0xe4b(%rip),%rdi
call   1050 <printf@plt>
lea    0xe6d(%rip),%rdi
call   1050 <printf@plt>
lea    0xea0(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x0,-0x23c(%rbp)
jle    1210 <menu+0xa0>
lea    0xec3(%rip),%rdi
call   1050 <printf@plt>
lea    0xef7(%rip),%rdi
call   1050 <printf@plt>
lea    0xf2c(%rip),%rdi
lea    -0x238(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    $0x0,%al
call   1090 <afficherEnTete@plt>
cmpl   $0x1,-0x238(%rbp)
jne    1328 <menu+0x1b8>
lea    0xf06(%rip),%rdi
call   1050 <printf@plt>
lea    0xf20(%rip),%rdi
call   1050 <printf@plt>
lea    0xf4b(%rip),%rdi
call   1050 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xf4e(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xf43(%rip),%rdi
call   1050 <printf@plt>
lea    -0xe0(%rbp),%rsi
lea    0xf2d(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xf38(%rip),%rdi
call   1050 <printf@plt>
lea    -0x1c0(%rbp),%rsi
lea    0xf0c(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    -0x150(%rbp),%rdi
lea    -0x70(%rbp),%rcx
lea    -0xe0(%rbp),%r8
lea    -0x1c0(%rbp),%r9
lea    0xf19(%rip),%rsi
mov    $0x2,%edx
movl   $0x3,(%rsp)
mov    $0x0,%al
call   1080 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x24c(%rbp)
lea    -0x150(%rbp),%rax
mov    %rax,-0x248(%rbp)
lea    -0x150(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x24c(%rbp),%edi
mov    -0x248(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    -0x4(%rbp),%edi
call   1060 <lecteurResultat@plt>
jmp    169e <menu+0x52e>
cmpl   $0x2,-0x238(%rbp)
jne    1451 <menu+0x2e1>
lea    0xebd(%rip),%rdi
call   1050 <printf@plt>
lea    0xe24(%rip),%rdi
call   1050 <printf@plt>
lea    0xe4f(%rip),%rdi
call   1050 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xe47(%rip),%rdi
call   1050 <printf@plt>
lea    -0xe0(%rbp),%rsi
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xe9c(%rip),%rdi
call   1050 <printf@plt>
lea    -0x1c0(%rbp),%rsi
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xe90(%rip),%rdi
call   1050 <printf@plt>
lea    -0x230(%rbp),%rsi
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    -0x150(%rbp),%rdi
lea    -0x70(%rbp),%rcx
lea    -0xe0(%rbp),%r8
lea    -0x1c0(%rbp),%r9
lea    -0x230(%rbp),%rax
lea    0xe64(%rip),%rsi
mov    $0x2,%edx
mov    %rax,(%rsp)
movl   $0x3,0x8(%rsp)
mov    $0x0,%al
call   1080 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x25c(%rbp)
lea    -0x150(%rbp),%rax
mov    %rax,-0x258(%rbp)
lea    -0x150(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x25c(%rbp),%edi
mov    -0x258(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    -0x4(%rbp),%edi
call   1060 <lecteurResultat@plt>
jmp    1699 <menu+0x529>
cmpl   $0x3,-0x238(%rbp)
jne    1524 <menu+0x3b4>
lea    0xc2c(%rip),%rdi
call   1050 <printf@plt>
lea    0xcfb(%rip),%rdi
call   1050 <printf@plt>
lea    0xd26(%rip),%rdi
call   1050 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xd29(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xd1e(%rip),%rdi
call   1050 <printf@plt>
lea    -0xe0(%rbp),%rsi
lea    0xd08(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    -0x150(%rbp),%rdi
lea    -0x70(%rbp),%rcx
lea    -0xe0(%rbp),%r8
lea    0xd9d(%rip),%rsi
mov    $0x2,%edx
mov    $0x3,%r9d
mov    $0x0,%al
call   1080 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x26c(%rbp)
lea    -0x150(%rbp),%rax
mov    %rax,-0x268(%rbp)
lea    -0x150(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x26c(%rbp),%edi
mov    -0x268(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    -0x4(%rbp),%edi
call   1060 <lecteurResultat@plt>
jmp    1694 <menu+0x524>
cmpl   $0x4,-0x238(%rbp)
jne    159a <menu+0x42a>
lea    -0x150(%rbp),%rdi
lea    0xd38(%rip),%rsi
mov    $0x2,%edx
mov    $0x34,%ecx
mov    $0x3,%r8d
mov    $0x0,%al
call   1080 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x27c(%rbp)
lea    -0x150(%rbp),%rax
mov    %rax,-0x278(%rbp)
lea    -0x150(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x27c(%rbp),%edi
mov    -0x278(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    -0x4(%rbp),%edi
call   1060 <lecteurResultat@plt>
jmp    168f <menu+0x51f>
cmpl   $0x5,-0x238(%rbp)
jne    1610 <menu+0x4a0>
lea    -0x150(%rbp),%rdi
lea    0xcc2(%rip),%rsi
mov    $0x2,%edx
mov    $0x35,%ecx
mov    $0x3,%r8d
mov    $0x0,%al
call   1080 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x28c(%rbp)
lea    -0x150(%rbp),%rax
mov    %rax,-0x288(%rbp)
lea    -0x150(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x28c(%rbp),%edi
mov    -0x288(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    -0x4(%rbp),%edi
call   1060 <lecteurResultat@plt>
jmp    168a <menu+0x51a>
cmpl   $0x0,-0x238(%rbp)
jne    1685 <menu+0x515>
lea    -0x150(%rbp),%rdi
lea    0xc4c(%rip),%rsi
mov    $0x2,%edx
mov    $0x30,%ecx
mov    $0x3,%r8d
mov    $0x0,%al
call   1080 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x29c(%rbp)
lea    -0x150(%rbp),%rax
mov    %rax,-0x298(%rbp)
lea    -0x150(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x29c(%rbp),%edi
mov    -0x298(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    0xbff(%rip),%rdi
call   1050 <printf@plt>
jmp    168a <menu+0x51a>
jmp    168f <menu+0x51f>
jmp    1694 <menu+0x524>
jmp    1699 <menu+0x529>
jmp    169e <menu+0x52e>
mov    -0x23c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x23c(%rbp)
jmp    11a7 <menu+0x37>
add    $0x2b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x238,%rsp
mov    %edi,%r13d
movl   $0x1,0x8(%rsp)
xor    %eax,%eax
call   10a0 <afficherEnTete@plt>
lea    0xe56(%rip),%r12
xor    %r15d,%r15d
mov    %r13d,0xc(%rsp)
jmp    1297 <menu+0x117>
lea    0x1009(%rip),%rdi
call   1030 <puts@plt>
lea    0x1022(%rip),%rdi
call   1030 <puts@plt>
lea    0xe45(%rip),%rdi
call   1060 <printf@plt>
lea    0xe4c(%rip),%r13
mov    %r13,%rdi
lea    0x80(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0xe36(%rip),%rdi
call   1060 <printf@plt>
mov    %r13,%rdi
lea    0xf0(%rsp),%rbp
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0xe2b(%rip),%rdi
call   1060 <printf@plt>
mov    %r13,%rdi
mov    0xc(%rsp),%r13d
lea    0x160(%rsp),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
sub    $0x8,%rsp
lea    0x18(%rsp),%rbx
mov    %rbx,%rdi
lea    0xe14(%rip),%rsi
mov    $0x2,%edx
lea    0x88(%rsp),%rcx
mov    %rbp,%r8
mov    %r14,%r9
xor    %eax,%eax
push   $0x3
call   1090 <sprintf@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r13d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %r13d,%edi
call   1070 <lecteurResultat@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
je     1509 <menu+0x389>
movb   $0x0,0x10(%rsp)
lea    0xe31(%rip),%rdi
call   1030 <puts@plt>
lea    0xe3d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe5e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe90(%rip),%rdi
call   1030 <puts@plt>
sub    $0x1,%r15d
jb     12ea <menu+0x16a>
lea    0xf49(%rip),%rdi
call   1030 <puts@plt>
lea    0xf7c(%rip),%rdi
call   1030 <puts@plt>
lea    0xd27(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
xor    %eax,%eax
call   10a0 <afficherEnTete@plt>
mov    0x8(%rsp),%eax
cmp    $0x5,%rax
ja     128f <menu+0x10f>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
lea    0xd93(%rip),%rsi
mov    $0x2,%edx
mov    $0x30,%ecx
mov    $0x3,%r8d
xor    %eax,%eax
call   1090 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r13d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
lea    0xd68(%rip),%rdi
call   1060 <printf@plt>
jmp    128b <menu+0x10b>
lea    0xe28(%rip),%rdi
call   1030 <puts@plt>
lea    0xe76(%rip),%rdi
call   1030 <puts@plt>
lea    0xc99(%rip),%rdi
call   1060 <printf@plt>
lea    0xca0(%rip),%rbx
mov    %rbx,%rdi
lea    0x80(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0xc8a(%rip),%rdi
call   1060 <printf@plt>
mov    %rbx,%rdi
lea    0xf0(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0xcac(%rip),%rdi
call   1060 <printf@plt>
mov    %rbx,%rdi
lea    0x160(%rsp),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0xca0(%rip),%rdi
call   1060 <printf@plt>
mov    %rbx,%rdi
lea    0x1d0(%rsp),%rbp
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
lea    0xc8c(%rip),%rsi
mov    $0x2,%edx
lea    0x80(%rsp),%rcx
lea    0xf0(%rsp),%r8
mov    %r14,%r9
xor    %eax,%eax
push   $0x3
push   %rbp
jmp    1265 <menu+0xe5>
lea    0xd2a(%rip),%rdi
call   1030 <puts@plt>
lea    0xda8(%rip),%rdi
call   1030 <puts@plt>
lea    0xbcb(%rip),%rdi
call   1060 <printf@plt>
lea    0xbd2(%rip),%rbp
mov    %rbp,%rdi
lea    0x80(%rsp),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0xbb9(%rip),%rdi
call   1060 <printf@plt>
mov    %rbp,%rdi
mov    0xc(%rsp),%r13d
lea    0xf0(%rsp),%rbp
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
lea    0xc07(%rip),%rsi
mov    $0x2,%edx
mov    %r14,%rcx
mov    %rbp,%r8
mov    $0x3,%r9d
xor    %eax,%eax
call   1090 <sprintf@plt>
jmp    126e <menu+0xee>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
lea    0xbe7(%rip),%rsi
mov    $0x2,%edx
mov    $0x34,%ecx
jmp    14f7 <menu+0x377>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
lea    0xbcc(%rip),%rsi
mov    $0x2,%edx
mov    $0x35,%ecx
mov    $0x3,%r8d
xor    %eax,%eax
call   1090 <sprintf@plt>
jmp    126e <menu+0xee>
add    $0x238,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Menu (0 pour quitter) :\0A\00"
@.str.1 = [46 x i8] c" -> 1 : Recherche du 1er train disponible\0A\00"
@.str.2 = [63 x i8] c" -> 2 : Recherche des trains disponibles entre 2 horraires\0A\00"
@.str.3 = [60 x i8] c" -> 3 : Recherche des trains disponibles pour un trajet\0A\00"
@.str.4 = [64 x i8] c" -> 4 : Trouver le meilleur tarif sur la derniere recherche\0A\00"
@.str.5 = [65 x i8] c" -> 5 : Trouver la meilleure duree sur la derniere recherche\0A\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [38 x i8] c"Recherche du 1er train disponible : \0A\00"
@.str.8 = [55 x i8] c"-----------------------------------------------------\0A\00"
@.str.9 = [19 x i8] c"Ville de depart : \00"
@.str.10 = [3 x i8] c"%s\00"
@.str.11 = [22 x i8] c"Ville de d'arrivee : \00"
@.str.12 = [27 x i8] c"Heure de depart (hh:mm) : \00"
@.str.13 = [15 x i8] c"%c1#%s#%s#%s%c\00"
@.str.14 = [54 x i8] c"Recherche des trains disponibles entre 2 horraires :\0A\00"
@.str.15 = [21 x i8] c"Heure min (hh:mm) : \00"
@.str.16 = [21 x i8] c"Heure max (hh:mm) : \00"
@.str.17 = [18 x i8] c"%c2#%s#%s#%s#%s%c\00"
@.str.18 = [49 x i8] c"Recherche des trains disponibles pour un trajet\0A\00"
@.str.19 = [12 x i8] c"%c3#%s#%s%c\00"
@.str.20 = [8 x i8] c"%c%c#%c\00"
@.str.21 = [19 x i8] c" A BIENTOT\00"
define void @menu(i32 %0) {
%2 = alloca i32
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = alloca [100 x i8]
%6 = alloca [100 x i8]
%7 = alloca [100 x i8]
%8 = alloca i8
%9 = alloca i8
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %2
store i8 2, i8* %8
store i8 3, i8* %9
store i32 1, i32* %10
store i32 0, i32* %11
%12 = call i32 (...) @afficherEnTete()
br label %13
13: ; preds = %153, %1
%14 = load i32, i32* %10
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %156
16: ; preds = %13
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
store i8 0, i8* %17
%18 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0))
%22 = load i32, i32* %11
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %16
%25 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.4, i64 0, i64 0))
%26 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.5, i64 0, i64 0))
br label %27
27: ; preds = %24, %16
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %10)
%29 = call i32 (...) @afficherEnTete()
%30 = load i32, i32* %10
%31 = icmp eq i32 %30, 1
br i1 %31, label %32, label %56
32: ; preds = %27
%33 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0))
%34 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.8, i64 0, i64 0))
%35 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%37 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %36)
%38 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
%39 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%40 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %39)
%41 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.12, i64 0, i64 0))
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%43 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %42)
%44 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%45 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%46 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%47 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%48 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %44, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.13, i64 0, i64 0), i32 2, i8* %45, i8* %46, i8* %47, i32 3)
%49 = load i32, i32* %2
%50 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%51 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%52 = call i32 @strlen(i8* %51)
%53 = call i32 @write(i32 %49, i8* %50, i32 %52)
%54 = load i32, i32* %2
%55 = call i32 @lecteurResultat(i32 %54)
br label %153
56: ; preds = %27
%57 = load i32, i32* %10
%58 = icmp eq i32 %57, 2
br i1 %58, label %59, label %87
59: ; preds = %56
%60 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.14, i64 0, i64 0))
%61 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.8, i64 0, i64 0))
%62 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%63 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%64 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %63)
%65 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
%66 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%67 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %66)
%68 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0))
%69 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%70 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %69)
%71 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.16, i64 0, i64 0))
%72 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%73 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %72)
%74 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%75 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%76 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%77 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%78 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%79 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %74, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0), i32 2, i8* %75, i8* %76, i8* %77, i8* %78, i32 3)
%80 = load i32, i32* %2
%81 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%82 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%83 = call i32 @strlen(i8* %82)
%84 = call i32 @write(i32 %80, i8* %81, i32 %83)
%85 = load i32, i32* %2
%86 = call i32 @lecteurResultat(i32 %85)
br label %152
87: ; preds = %56
%88 = load i32, i32* %10
%89 = icmp eq i32 %88, 3
br i1 %89, label %90, label %110
90: ; preds = %87
%91 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.18, i64 0, i64 0))
%92 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.8, i64 0, i64 0))
%93 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%94 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%95 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %94)
%96 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
%97 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%98 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %97)
%99 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%100 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%101 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%102 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %99, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.19, i64 0, i64 0), i32 2, i8* %100, i8* %101, i32 3)
%103 = load i32, i32* %2
%104 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%105 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%106 = call i32 @strlen(i8* %105)
%107 = call i32 @write(i32 %103, i8* %104, i32 %106)
%108 = load i32, i32* %2
%109 = call i32 @lecteurResultat(i32 %108)
br label %151
110: ; preds = %87
%111 = load i32, i32* %10
%112 = icmp eq i32 %111, 4
br i1 %112, label %113, label %123
113: ; preds = %110
%114 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%115 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %114, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i64 0, i64 0), i32 2, i32 52, i32 3)
%116 = load i32, i32* %2
%117 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%118 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%119 = call i32 @strlen(i8* %118)
%120 = call i32 @write(i32 %116, i8* %117, i32 %119)
%121 = load i32, i32* %2
%122 = call i32 @lecteurResultat(i32 %121)
br label %150
123: ; preds = %110
%124 = load i32, i32* %10
%125 = icmp eq i32 %124, 5
br i1 %125, label %126, label %136
126: ; preds = %123
%127 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%128 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %127, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i64 0, i64 0), i32 2, i32 53, i32 3)
%129 = load i32, i32* %2
%130 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%131 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%132 = call i32 @strlen(i8* %131)
%133 = call i32 @write(i32 %129, i8* %130, i32 %132)
%134 = load i32, i32* %2
%135 = call i32 @lecteurResultat(i32 %134)
br label %149
136: ; preds = %123
%137 = load i32, i32* %10
%138 = icmp eq i32 %137, 0
br i1 %138, label %139, label %148
139: ; preds = %136
%140 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%141 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %140, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i64 0, i64 0), i32 2, i32 48, i32 3)
%142 = load i32, i32* %2
%143 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%144 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%145 = call i32 @strlen(i8* %144)
%146 = call i32 @write(i32 %142, i8* %143, i32 %145)
%147 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.21, i64 0, i64 0))
br label %148
148: ; preds = %139, %136
br label %149
149: ; preds = %148, %126
br label %150
150: ; preds = %149, %113
br label %151
151: ; preds = %150, %90
br label %152
152: ; preds = %151, %59
br label %153
153: ; preds = %152, %32
%154 = load i32, i32* %11
%155 = add nsw i32 %154, 1
store i32 %155, i32* %11
br label %13
156: ; preds = %13
ret void
}

LLVM IR (-O2):
@.str.6 = [3 x i8] c"%d\00"
@.str.9 = [19 x i8] c"Ville de depart : \00"
@.str.10 = [3 x i8] c"%s\00"
@.str.11 = [22 x i8] c"Ville de d'arrivee : \00"
@.str.12 = [27 x i8] c"Heure de depart (hh:mm) : \00"
@.str.13 = [15 x i8] c"%c1#%s#%s#%s%c\00"
@.str.15 = [21 x i8] c"Heure min (hh:mm) : \00"
@.str.16 = [21 x i8] c"Heure max (hh:mm) : \00"
@.str.17 = [18 x i8] c"%c2#%s#%s#%s#%s%c\00"
@.str.19 = [12 x i8] c"%c3#%s#%s%c\00"
@.str.20 = [8 x i8] c"%c%c#%c\00"
@.str.21 = [19 x i8] c" A BIENTOT\00"
@str = [24 x i8] c"Menu (0 pour quitter) :\00"
@str.22 = [45 x i8] c" -> 1 : Recherche du 1er train disponible\00"
@str.23 = [62 x i8] c" -> 2 : Recherche des trains disponibles entre 2 horraires\00"
@str.24 = [59 x i8] c" -> 3 : Recherche des trains disponibles pour un trajet\00"
@str.25 = [48 x i8] c"Recherche des trains disponibles pour un trajet\00"
@str.27 = [53 x i8] c"Recherche des trains disponibles entre 2 horraires :\00"
@str.29 = [37 x i8] c"Recherche du 1er train disponible : \00"
@str.30 = [54 x i8] c"-----------------------------------------------------\00"
@str.31 = [63 x i8] c" -> 4 : Trouver le meilleur tarif sur la derniere recherche\00"
@str.32 = [64 x i8] c" -> 5 : Trouver la meilleure duree sur la derniere recherche\00"
define void @menu(i32 %0) {
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = alloca [100 x i8]
%6 = alloca [100 x i8]
%7 = alloca i32
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%13 = bitcast i32* %7 to i8*
store i32 1, i32* %7
%14 = tail call i32 (...) @afficherEnTete()
br label %15
15: ; preds = %1, %85
%16 = phi i32 [ %87, %85 ], [ 0, %1 ]
store i8 0, i8* %10
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.22, i64 0, i64 0))
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str.23, i64 0, i64 0))
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.24, i64 0, i64 0))
%21 = icmp eq i32 %16, 0
br i1 %21, label %25, label %22
22: ; preds = %15
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str.31, i64 0, i64 0))
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.32, i64 0, i64 0))
br label %25
25: ; preds = %22, %15
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %7)
%27 = call i32 (...) @afficherEnTete()
%28 = load i32, i32* %7
switch i32 %28, label %85 [
i32 1, label %29
i32 2, label %42
i32 3, label %57
i32 4, label %68
i32 5, label %73
i32 0, label %78
]
29: ; preds = %25
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.29, i64 0, i64 0))
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.30, i64 0, i64 0))
%32 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%33 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %8)
%34 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
%35 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %9)
%36 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.12, i64 0, i64 0))
%37 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %11)
%38 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.13, i64 0, i64 0), i32 2, i8* %8, i8* %9, i8* %11, i32 3)
%39 = call i32 @strlen(i8* %10)
%40 = call i32 @write(i32 %0, i8* %10, i32 %39)
%41 = call i32 @lecteurResultat(i32 %0)
br label %83
42: ; preds = %25
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.27, i64 0, i64 0))
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.30, i64 0, i64 0))
%45 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%46 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %8)
%47 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
%48 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %9)
%49 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0))
%50 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %11)
%51 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.16, i64 0, i64 0))
%52 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %12)
%53 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0), i32 2, i8* %8, i8* %9, i8* %11, i8* %12, i32 3)
%54 = call i32 @strlen(i8* %10)
%55 = call i32 @write(i32 %0, i8* %10, i32 %54)
%56 = call i32 @lecteurResultat(i32 %0)
br label %83
57: ; preds = %25
%58 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.25, i64 0, i64 0))
%59 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.30, i64 0, i64 0))
%60 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%61 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %8)
%62 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
%63 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %9)
%64 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.19, i64 0, i64 0), i32 2, i8* %8, i8* %9, i32 3)
%65 = call i32 @strlen(i8* %10)
%66 = call i32 @write(i32 %0, i8* %10, i32 %65)
%67 = call i32 @lecteurResultat(i32 %0)
br label %83
68: ; preds = %25
%69 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i64 0, i64 0), i32 2, i32 52, i32 3)
%70 = call i32 @strlen(i8* %10)
%71 = call i32 @write(i32 %0, i8* %10, i32 %70)
%72 = call i32 @lecteurResultat(i32 %0)
br label %83
73: ; preds = %25
%74 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i64 0, i64 0), i32 2, i32 53, i32 3)
%75 = call i32 @strlen(i8* %10)
%76 = call i32 @write(i32 %0, i8* %10, i32 %75)
%77 = call i32 @lecteurResultat(i32 %0)
br label %83
78: ; preds = %25
%79 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i64 0, i64 0), i32 2, i32 48, i32 3)
%80 = call i32 @strlen(i8* %10)
%81 = call i32 @write(i32 %0, i8* %10, i32 %80)
%82 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.21, i64 0, i64 0))
br label %83
83: ; preds = %29, %57, %73, %78, %68, %42
%84 = load i32, i32* %7
br label %85
85: ; preds = %83, %25
%86 = phi i32 [ %84, %83 ], [ %28, %25 ]
%87 = add nuw nsw i32 %16, 1
%88 = icmp eq i32 %86, 0
br i1 %88, label %89, label %15
89: ; preds = %85
ret void
}