#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 recherche0(int *, int *, int *, int **, int);
int recherche1(int *dep, int *arr, int *chg, int *lge1, int *lge2, int **mat,
               int nb_ligne, int nb_arret) {
  int a;
  for (a = 0; a < nb_arret; a++) {
    int t;
    int u;
    t = recherche0(&a, arr, lge2, mat, nb_ligne);
    u = recherche0(dep, &a, lge1, mat, nb_ligne);
    if (t != 0 && u != 0) {
      *chg = a;
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<recherche1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    0x18(%rbp),%eax
jge    11bd <recherche1+0xad>
mov    -0x18(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    0x10(%rbp),%r8d
lea    -0x3c(%rbp),%rdi
call   1030 <recherche0@plt>
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    0x10(%rbp),%r8d
lea    -0x3c(%rbp),%rsi
call   1030 <recherche0@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x40(%rbp)
je     11aa <recherche1+0x9a>
cmpl   $0x0,-0x44(%rbp)
je     11aa <recherche1+0x9a>
mov    -0x3c(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    11c4 <recherche1+0xb4>
jmp    11af <recherche1+0x9f>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    113d <recherche1+0x2d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recherche1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,0x20(%rsp)
mov    %rcx,0x18(%rsp)
movl   $0x0,0xc(%rsp)
xor    %eax,%eax
cmpl   $0x0,0x68(%rsp)
jle    11b9 <recherche1+0xa9>
mov    %r9,%rbx
mov    %rsi,%rbp
mov    %rdi,%r15
mov    %rdx,0x10(%rsp)
mov    0x60(%rsp),%r14d
lea    0xc(%rsp),%r12
jmp    116d <recherche1+0x5d>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ecx
mov    %ecx,0xc(%rsp)
cmp    0x68(%rsp),%ecx
jge    11b7 <recherche1+0xa7>
mov    %r12,%rdi
mov    %rbp,%rsi
mov    0x20(%rsp),%rdx
mov    %rbx,%rcx
mov    %r14d,%r8d
call   1030 <recherche0@plt>
mov    %eax,%r13d
mov    %r15,%rdi
mov    %r12,%rsi
mov    0x18(%rsp),%rdx
mov    %rbx,%rcx
mov    %r14d,%r8d
call   1030 <recherche0@plt>
mov    0xc(%rsp),%ecx
test   %r13d,%r13d
je     1160 <recherche1+0x50>
test   %eax,%eax
je     1160 <recherche1+0x50>
mov    0x10(%rsp),%rax
mov    %ecx,(%rax)
mov    $0x1,%eax
jmp    11b9 <recherche1+0xa9>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @recherche1(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32** %5, i32 %6, i32 %7) {
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32**
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
store i32* %0, i32** %10
store i32* %1, i32** %11
store i32* %2, i32** %12
store i32* %3, i32** %13
store i32* %4, i32** %14
store i32** %5, i32*** %15
store i32 %6, i32* %16
store i32 %7, i32* %17
store i32 0, i32* %18
br label %21
21: ; preds = %45, %8
%22 = load i32, i32* %18
%23 = load i32, i32* %17
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %48
25: ; preds = %21
%26 = load i32*, i32** %11
%27 = load i32*, i32** %14
%28 = load i32**, i32*** %15
%29 = load i32, i32* %16
%30 = call i32 @recherche0(i32* %18, i32* %26, i32* %27, i32** %28, i32 %29)
store i32 %30, i32* %19
%31 = load i32*, i32** %10
%32 = load i32*, i32** %13
%33 = load i32**, i32*** %15
%34 = load i32, i32* %16
%35 = call i32 @recherche0(i32* %31, i32* %18, i32* %32, i32** %33, i32 %34)
store i32 %35, i32* %20
%36 = load i32, i32* %19
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %44
38: ; preds = %25
%39 = load i32, i32* %20
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32, i32* %18
%43 = load i32*, i32** %12
store i32 %42, i32* %43
store i32 1, i32* %9
br label %49
44: ; preds = %38, %25
br label %45
45: ; preds = %44
%46 = load i32, i32* %18
%47 = add nsw i32 %46, 1
store i32 %47, i32* %18
br label %21
48: ; preds = %21
store i32 0, i32* %9
br label %49
49: ; preds = %48, %41
%50 = load i32, i32* %9
ret i32 %50
}

LLVM IR (-O2):
define i32 @recherche1(i32* %0, i32* %1, i32* nocapture writeonly %2, i32* %3, i32* %4, i32** %5, i32 %6, i32 %7) {
%9 = alloca i32
%10 = bitcast i32* %9 to i8*
store i32 0, i32* %9
%11 = icmp sgt i32 %7, 0
br i1 %11, label %12, label %23
12: ; preds = %8, %20
%13 = call i32 @recherche0(i32* %9, i32* %1, i32* %4, i32** %5, i32 %6)
%14 = call i32 @recherche0(i32* %0, i32* %9, i32* %3, i32** %5, i32 %6)
%15 = icmp ne i32 %13, 0
%16 = icmp ne i32 %14, 0
%17 = select i1 %15, i1 %16, i1 false
%18 = load i32, i32* %9
br i1 %17, label %19, label %20
19: ; preds = %12
store i32 %18, i32* %2
br label %23
20: ; preds = %12
%21 = add nsw i32 %18, 1
store i32 %21, i32* %9
%22 = icmp slt i32 %21, %7
br i1 %22, label %12, label %23
23: ; preds = %20, %8, %19
%24 = phi i32 [ 1, %19 ], [ 0, %8 ], [ 0, %20 ]
ret i32 %24
}