#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*/ memcpy(char *, char *, int);
int strlen(char *);
int extraitFichier(char *requete, char *tableauNomFichier,
                   int tailleTableauNomFichier) {
  int i;
  if ((strlen(requete) > 5) && (strlen(requete) > tailleTableauNomFichier))
    memcpy(tableauNomFichier, &requete[5], tailleTableauNomFichier);
  else if ((strlen(requete) > 5) && (strlen(requete) < tailleTableauNomFichier))
    memcpy(tableauNomFichier, &requete[5], strlen(requete) - 5);
  else
    return -2;
  for (i = 0; tableauNomFichier[i] != ' '; ++i)
    ;
  tableauNomFichier[i] = '\0';
  return 0;
}


x86 assembly (clang, -O0):
<extraitFichier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x5,%eax
jle    1170 <extraitFichier+0x50>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    -0x1c(%rbp),%eax
jle    1170 <extraitFichier+0x50>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x5,%rsi
mov    -0x1c(%rbp),%edx
call   1040 <memcpy@plt>
jmp    11d9 <extraitFichier+0xb9>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x5,%eax
jle    11c8 <extraitFichier+0xa8>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    -0x1c(%rbp),%eax
jge    11c8 <extraitFichier+0xa8>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
sub    $0x5,%edx
call   1040 <memcpy@plt>
jmp    11d4 <extraitFichier+0xb4>
movl   $0xfffffffe,-0x4(%rbp)
jmp    121b <extraitFichier+0xfb>
jmp    11d9 <extraitFichier+0xb9>
movl   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
je     1208 <extraitFichier+0xe8>
jmp    11fa <extraitFichier+0xda>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11e0 <extraitFichier+0xc0>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extraitFichier>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
cmp    $0x6,%eax
jl     1156 <extraitFichier+0x36>
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    %r15d,%eax
jle    1156 <extraitFichier+0x36>
add    $0x5,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
jmp    118a <extraitFichier+0x6a>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    $0xfffffffe,%ebp
cmp    $0x6,%eax
jl     11b3 <extraitFichier+0x93>
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    %r15d,%eax
jge    11b3 <extraitFichier+0x93>
lea    0x5(%r14),%rbp
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    -0x5(%rax),%edx
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <memcpy@plt>
mov    $0xffffffffffffffff,%rax
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x20,0x1(%rbx,%rax,1)
lea    0x1(%rax),%rax
jne    11a0 <extraitFichier+0x80>
mov    %eax,%eax
movb   $0x0,(%rbx,%rax,1)
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @extraitFichier(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%9 = load i8*, i8** %5
%10 = call i32 @strlen(i8* %9)
%11 = icmp sgt i32 %10, 5
br i1 %11, label %12, label %23
12: ; preds = %3
%13 = load i8*, i8** %5
%14 = call i32 @strlen(i8* %13)
%15 = load i32, i32* %7
%16 = icmp sgt i32 %14, %15
br i1 %16, label %17, label %23
17: ; preds = %12
%18 = load i8*, i8** %6
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i64 5
%21 = load i32, i32* %7
%22 = call i32 @memcpy(i8* %18, i8* %20, i32 %21)
br label %42
23: ; preds = %12, %3
%24 = load i8*, i8** %5
%25 = call i32 @strlen(i8* %24)
%26 = icmp sgt i32 %25, 5
br i1 %26, label %27, label %40
27: ; preds = %23
%28 = load i8*, i8** %5
%29 = call i32 @strlen(i8* %28)
%30 = load i32, i32* %7
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %40
32: ; preds = %27
%33 = load i8*, i8** %6
%34 = load i8*, i8** %5
%35 = getelementptr inbounds i8, i8* %34, i64 5
%36 = load i8*, i8** %5
%37 = call i32 @strlen(i8* %36)
%38 = sub nsw i32 %37, 5
%39 = call i32 @memcpy(i8* %33, i8* %35, i32 %38)
br label %41
40: ; preds = %27, %23
store i32 -2, i32* %4
br label %60
41: ; preds = %32
br label %42
42: ; preds = %41, %17
store i32 0, i32* %8
br label %43
43: ; preds = %52, %42
%44 = load i8*, i8** %6
%45 = load i32, i32* %8
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp ne i32 %49, 32
br i1 %50, label %51, label %55
51: ; preds = %43
br label %52
52: ; preds = %51
%53 = load i32, i32* %8
%54 = add nsw i32 %53, 1
store i32 %54, i32* %8
br label %43
55: ; preds = %43
%56 = load i8*, i8** %6
%57 = load i32, i32* %8
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i8, i8* %56, i64 %58
store i8 0, i8* %59
store i32 0, i32* %4
br label %60
60: ; preds = %55, %40
%61 = load i32, i32* %4
ret i32 %61
}

LLVM IR (-O2):
define i32 @extraitFichier(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp sgt i32 %4, 5
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = tail call i32 @strlen(i8* %0)
%8 = icmp sgt i32 %7, %2
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = getelementptr inbounds i8, i8* %0, i64 5
%11 = tail call i32 @memcpy(i8* %1, i8* %10, i32 %2)
br label %23
12: ; preds = %6, %3
%13 = tail call i32 @strlen(i8* %0)
%14 = icmp sgt i32 %13, 5
br i1 %14, label %15, label %33
15: ; preds = %12
%16 = tail call i32 @strlen(i8* %0)
%17 = icmp slt i32 %16, %2
br i1 %17, label %18, label %33
18: ; preds = %15
%19 = getelementptr inbounds i8, i8* %0, i64 5
%20 = tail call i32 @strlen(i8* %0)
%21 = add nsw i32 %20, -5
%22 = tail call i32 @memcpy(i8* %1, i8* %19, i32 %21)
br label %23
23: ; preds = %18, %9
br label %24
24: ; preds = %23, %24
%25 = phi i64 [ %29, %24 ], [ 0, %23 ]
%26 = getelementptr inbounds i8, i8* %1, i64 %25
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 32
%29 = add nuw i64 %25, 1
br i1 %28, label %30, label %24
30: ; preds = %24
%31 = and i64 %25, 4294967295
%32 = getelementptr inbounds i8, i8* %1, i64 %31
store i8 0, i8* %32
br label %33
33: ; preds = %12, %15, %30
%34 = phi i32 [ 0, %30 ], [ -2, %15 ], [ -2, %12 ]
ret i32 %34
}