#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 */
char *strrchr(char *, char);
int shn_filename_contains_a_dot(char *filename) {
  char *slash, *dot;
  dot = strrchr(filename, '.');
  if (!dot)
    return 0;
  slash = strrchr(filename, '/');
  if (!slash)
    return 1;
  if (slash < dot)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<shn_filename_contains_a_dot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1145 <shn_filename_contains_a_dot+0x35>
movl   $0x0,-0x4(%rbp)
jmp    118f <shn_filename_contains_a_dot+0x7f>
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    116e <shn_filename_contains_a_dot+0x5e>
movl   $0x1,-0x4(%rbp)
jmp    118f <shn_filename_contains_a_dot+0x7f>
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1188 <shn_filename_contains_a_dot+0x78>
movl   $0x1,-0x4(%rbp)
jmp    118f <shn_filename_contains_a_dot+0x7f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shn_filename_contains_a_dot>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x2e,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     1148 <shn_filename_contains_a_dot+0x38>
mov    %rax,%r14
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     114c <shn_filename_contains_a_dot+0x3c>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %r14,%rcx
setb   %al
jmp    1151 <shn_filename_contains_a_dot+0x41>
xor    %eax,%eax
jmp    1151 <shn_filename_contains_a_dot+0x41>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @shn_filename_contains_a_dot(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i8* @strrchr(i8* %6, i8 signext 46)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %11, label %10
10: ; preds = %1
store i32 0, i32* %2
br label %23
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = call i8* @strrchr(i8* %12, i8 signext 47)
store i8* %13, i8** %4
%14 = load i8*, i8** %4
%15 = icmp ne i8* %14, null
br i1 %15, label %17, label %16
16: ; preds = %11
store i32 1, i32* %2
br label %23
17: ; preds = %11
%18 = load i8*, i8** %4
%19 = load i8*, i8** %5
%20 = icmp ult i8* %18, %19
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 1, i32* %2
br label %23
22: ; preds = %17
store i32 0, i32* %2
br label %23
23: ; preds = %22, %21, %16, %10
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @shn_filename_contains_a_dot(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 46)
%3 = icmp eq i8* %2, null
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%6 = icmp eq i8* %5, null
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = icmp ult i8* %5, %2
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %7, %4, %1
%11 = phi i32 [ 0, %1 ], [ 1, %4 ], [ %9, %7 ]
ret i32 %11
}