#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 */
struct dirent {
  scalar_t__ d_name;
};

/* Variables and functions */
scalar_t__ strcmp(char *, scalar_t__);
unsigned int strlen(scalar_t__);
int lcr_select_so(struct dirent *dirent) {
  unsigned int len;
  len = strlen(dirent->d_name);
  if (len > 6) {
    if (strcmp(".lcrso", dirent->d_name + len - 6) == 0) {
      return (1);
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<lcr_select_so>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x6,-0x14(%rbp)
jbe    117d <lcr_select_so+0x5d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x14(%rbp),%eax
add    %rax,%rsi
sub    $0x6,%rsi
lea    0xea3(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1178 <lcr_select_so+0x58>
movl   $0x1,-0x4(%rbp)
jmp    1184 <lcr_select_so+0x64>
jmp    117d <lcr_select_so+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcr_select_so>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <strlen@plt>
cmp    $0x7,%eax
jb     114f <lcr_select_so+0x2f>
mov    (%rbx),%rcx
mov    %eax,%eax
lea    (%rax,%rcx,1),%rsi
add    $0xfffffffffffffffa,%rsi
lea    0xebb(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1153 <lcr_select_so+0x33>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.dirent = type { i64 }
@.str = [7 x i8] c".lcrso\00"
define i32 @lcr_select_so(%struct.dirent* %0) {
%2 = alloca i32
%3 = alloca %struct.dirent*
%4 = alloca i32
store %struct.dirent* %0, %struct.dirent** %3
%5 = load %struct.dirent*, %struct.dirent** %3
%6 = getelementptr inbounds %struct.dirent, %struct.dirent* %5, i32 0, i32 0
%7 = load i64, i64* %6
%8 = call i32 @strlen(i64 %7)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = icmp ugt i32 %9, 6
br i1 %10, label %11, label %23
11: ; preds = %1
%12 = load %struct.dirent*, %struct.dirent** %3
%13 = getelementptr inbounds %struct.dirent, %struct.dirent* %12, i32 0, i32 0
%14 = load i64, i64* %13
%15 = load i32, i32* %4
%16 = zext i32 %15 to i64
%17 = add nsw i64 %14, %16
%18 = sub nsw i64 %17, 6
%19 = call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %11
store i32 1, i32* %2
br label %24
22: ; preds = %11
br label %23
23: ; preds = %22, %1
store i32 0, i32* %2
br label %24
24: ; preds = %23, %21
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
%struct.dirent = type { i64 }
@.str = [7 x i8] c".lcrso\00"
define i32 @lcr_select_so(%struct.dirent* nocapture %0) {
%2 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 0
%3 = load i64, i64* %2
%4 = tail call i32 @strlen(i64 %3)
%5 = icmp ugt i32 %4, 6
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = load i64, i64* %2
%8 = zext i32 %4 to i64
%9 = add nsw i64 %8, -6
%10 = add i64 %9, %7
%11 = tail call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %6, %1
br label %14
14: ; preds = %6, %13
%15 = phi i32 [ 0, %13 ], [ 1, %6 ]
ret i32 %15
}