#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*/ puts(char *);
char *strchr(char *, char);
int /*<<< orphan*/ strcmp(char *, char *);
int find_type_file(char *path, char *list_types[], short elements) {
  char *typedot = strchr(path, '.'), *typefile = typedot + 1;
  short i = 0;
  do {
    puts(*(list_types + i));
    if (!strcmp(typefile, *(list_types + i)))
      return 1;
    i++;
  } while (i != elements);
  return 0;
}


x86 assembly (clang, -O0):
<find_type_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %dx,%ax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %ax,-0x1a(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1040 <strchr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
movw   $0x0,-0x32(%rbp)
mov    -0x18(%rbp),%rax
movswl -0x32(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <puts@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rax
movswl -0x32(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11ac <find_type_file+0x7c>
movl   $0x1,-0x4(%rbp)
jmp    11cf <find_type_file+0x9f>
mov    -0x32(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x32(%rbp)
movswl -0x32(%rbp),%eax
movswl -0x1a(%rbp),%ecx
cmp    %ecx,%eax
jne    116b <find_type_file+0x3b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_type_file>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r14d
mov    %rsi,%r12
mov    $0x2e,%esi
call   1040 <strchr@plt>
mov    %rax,%r15
add    $0x1,%r15
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movswq %bp,%rbx
mov    (%r12,%rbx,8),%rdi
call   1030 <puts@plt>
mov    (%r12,%rbx,8),%rsi
mov    %r15,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     118a <find_type_file+0x5a>
add    $0x1,%ebp
cmp    %bp,%r14w
jne    1160 <find_type_file+0x30>
xor    %eax,%eax
jmp    118f <find_type_file+0x5f>
mov    $0x1,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @find_type_file(i8* %0, i8** %1, i16 signext %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i16
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i16
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i16 %2, i16* %7
%11 = load i8*, i8** %5
%12 = call i8* @strchr(i8* %11, i8 signext 46)
store i8* %12, i8** %8
%13 = load i8*, i8** %8
%14 = getelementptr inbounds i8, i8* %13, i64 1
store i8* %14, i8** %9
store i16 0, i16* %10
br label %15
15: ; preds = %36, %3
%16 = load i8**, i8*** %6
%17 = load i16, i16* %10
%18 = sext i16 %17 to i32
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %16, i64 %19
%21 = load i8*, i8** %20
%22 = call i32 @puts(i8* %21)
%23 = load i8*, i8** %9
%24 = load i8**, i8*** %6
%25 = load i16, i16* %10
%26 = sext i16 %25 to i32
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %24, i64 %27
%29 = load i8*, i8** %28
%30 = call i32 @strcmp(i8* %23, i8* %29)
%31 = icmp ne i32 %30, 0
br i1 %31, label %33, label %32
32: ; preds = %15
store i32 1, i32* %4
br label %43
33: ; preds = %15
%34 = load i16, i16* %10
%35 = add i16 %34, 1
store i16 %35, i16* %10
br label %36
36: ; preds = %33
%37 = load i16, i16* %10
%38 = sext i16 %37 to i32
%39 = load i16, i16* %7
%40 = sext i16 %39 to i32
%41 = icmp ne i32 %38, %40
br i1 %41, label %15, label %42
42: ; preds = %36
store i32 0, i32* %4
br label %43
43: ; preds = %42, %32
%44 = load i32, i32* %4
ret i32 %44
}

LLVM IR (-O2):
define i32 @find_type_file(i8* %0, i8** nocapture %1, i16 signext %2) {
%4 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 46)
%5 = getelementptr inbounds i8, i8* %4, i64 1
br label %6
6: ; preds = %15, %3
%7 = phi i16 [ 0, %3 ], [ %16, %15 ]
%8 = sext i16 %7 to i64
%9 = getelementptr inbounds i8*, i8** %1, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i32 @puts(i8* dereferenceable(1) %10)
%12 = load i8*, i8** %9
%13 = tail call i32 @strcmp(i8* %5, i8* dereferenceable(1) %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %6
%16 = add i16 %7, 1
%17 = icmp eq i16 %16, %2
br i1 %17, label %18, label %6
18: ; preds = %15, %6
%19 = phi i32 [ 1, %6 ], [ 0, %15 ]
ret i32 %19
}