#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 */
size_t strlen(char *);
char *strstr(char const *, char *);
int is_update(const char *dirname) {
  char *p;
  p = strstr(dirname, "updates");
  if (!p)
    return 0;
  return (p[strlen("updates")] == '/' || p[strlen("updates")] == '\0');
}


x86 assembly (clang, -O0):
<is_update>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1157 <is_update+0x37>
movl   $0x0,-0x4(%rbp)
jmp    11b7 <is_update+0x97>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    0xe9a(%rip),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
movsbl (%rax,%rcx,1),%ecx
mov    $0x1,%al
cmp    $0x2f,%ecx
mov    %al,-0x19(%rbp)
je     11ac <is_update+0x8c>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    0xe6d(%rip),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_update>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <strstr@plt>
test   %rax,%rax
je     1136 <is_update+0x26>
mov    0x7(%rax),%al
cmp    $0x2f,%al
sete   %cl
test   %al,%al
sete   %al
or     %cl,%al
movzbl %al,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"updates\00"
define i32 @is_update(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 ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %1
store i32 0, i32* %2
br label %27
10: ; preds = %1
%11 = load i8*, i8** %4
%12 = call i64 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%13 = getelementptr inbounds i8, i8* %11, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 47
br i1 %16, label %24, label %17
17: ; preds = %10
%18 = load i8*, i8** %4
%19 = call i64 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%20 = getelementptr inbounds i8, i8* %18, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 0
br label %24
24: ; preds = %17, %10
%25 = phi i1 [ true, %10 ], [ %23, %17 ]
%26 = zext i1 %25 to i32
store i32 %26, i32* %2
br label %27
27: ; preds = %24, %9
%28 = load i32, i32* %2
ret i32 %28
}

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