#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 */
scalar_t__ strcmp(char *, char *);
char *strstr(char const *, char *);
int is_conf_path(const char *name) {
  char *conf = strstr(name, ".conf");
  while (conf != NULL && strcmp(conf, ".conf") != 0) {
    conf = strstr(conf + 1, ".conf");
  }
  if (conf == NULL)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<is_conf_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x18(%rbp)
mov    %al,-0x19(%rbp)
je     116a <is_conf_path+0x4a>
mov    -0x18(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    117a <is_conf_path+0x5a>
jmp    1197 <is_conf_path+0x77>
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
lea    0xe77(%rip),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x18(%rbp)
jmp    1140 <is_conf_path+0x20>
cmpq   $0x0,-0x18(%rbp)
jne    11ae <is_conf_path+0x8e>
movl   $0x0,-0x4(%rbp)
jmp    11b5 <is_conf_path+0x95>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_conf_path>:
push   %rbp
push   %r14
push   %rbx
lea    0xed5(%rip),%rsi
call   1040 <strstr@plt>
xor    %r14d,%r14d
test   %rax,%rax
je     117f <is_conf_path+0x5f>
mov    %rax,%rbx
lea    0xebe(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1179 <is_conf_path+0x59>
add    $0x1,%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <strstr@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1150 <is_conf_path+0x30>
jmp    117f <is_conf_path+0x5f>
mov    $0x1,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c".conf\00"
define i32 @is_conf_path(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strstr(i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %4
br label %7
7: ; preds = %16, %1
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = load i8*, i8** %4
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%13 = icmp ne i64 %12, 0
br label %14
14: ; preds = %10, %7
%15 = phi i1 [ false, %7 ], [ %13, %10 ]
br i1 %15, label %16, label %20
16: ; preds = %14
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = call i8* @strstr(i8* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %19, i8** %4
br label %7
20: ; preds = %14
%21 = load i8*, i8** %4
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %24
23: ; preds = %20
store i32 0, i32* %2
br label %25
24: ; preds = %20
store i32 1, i32* %2
br label %25
25: ; preds = %24, %23
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
@.str = [6 x i8] c".conf\00"
define i32 @is_conf_path(i8* %0) {
%2 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %12, label %4
4: ; preds = %1, %8
%5 = phi i8* [ %10, %8 ], [ %2, %1 ]
%6 = tail call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %4
%9 = getelementptr inbounds i8, i8* %5, i64 1
%10 = tail call i8* @strstr(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %4
12: ; preds = %8, %4, %1
%13 = phi i32 [ 0, %1 ], [ 1, %4 ], [ 0, %8 ]
ret i32 %13
}