#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 bitfile {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ *bitfile_find_chunk(struct bitfile *, char,
                                       int /*<<< orphan*/);
int bitfile_validate_xilinx_info(struct bitfile *bf) {
  char *cp;
  cp = "abcde";
  while (*cp != '\0') {
    if (bitfile_find_chunk(bf, *cp, 0) == NULL) {
      return -1;
    }
    cp++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<bitfile_validate_xilinx_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xedd(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1170 <bitfile_validate_xilinx_info+0x60>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
xor    %edx,%edx
movsbl (%rax),%esi
call   1030 <bitfile_find_chunk@plt>
cmp    $0x0,%rax
jne    115f <bitfile_validate_xilinx_info+0x4f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1177 <bitfile_validate_xilinx_info+0x67>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1127 <bitfile_validate_xilinx_info+0x17>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitfile_validate_xilinx_info>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x61,%esi
xor    %edx,%edx
call   1030 <bitfile_find_chunk@plt>
mov    $0xffffffff,%ebp
test   %rax,%rax
je     117d <bitfile_validate_xilinx_info+0x6d>
mov    %rbx,%rdi
mov    $0x62,%esi
xor    %edx,%edx
call   1030 <bitfile_find_chunk@plt>
test   %rax,%rax
je     117d <bitfile_validate_xilinx_info+0x6d>
mov    %rbx,%rdi
mov    $0x63,%esi
xor    %edx,%edx
call   1030 <bitfile_find_chunk@plt>
test   %rax,%rax
je     117d <bitfile_validate_xilinx_info+0x6d>
mov    %rbx,%rdi
mov    $0x64,%esi
xor    %edx,%edx
call   1030 <bitfile_find_chunk@plt>
test   %rax,%rax
je     117d <bitfile_validate_xilinx_info+0x6d>
mov    %rbx,%rdi
mov    $0x65,%esi
xor    %edx,%edx
call   1030 <bitfile_find_chunk@plt>
cmp    $0x1,%rax
sbb    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.bitfile = type { i32 }
@.str = [6 x i8] c"abcde\00"
define i32 @bitfile_validate_xilinx_info(%struct.bitfile* %0) {
%2 = alloca i32
%3 = alloca %struct.bitfile*
%4 = alloca i8*
store %struct.bitfile* %0, %struct.bitfile** %3
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %4
br label %5
5: ; preds = %17, %1
%6 = load i8*, i8** %4
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %5
%11 = load %struct.bitfile*, %struct.bitfile** %3
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = call i32* @bitfile_find_chunk(%struct.bitfile* %11, i8 signext %13, i32 0)
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %17
16: ; preds = %10
store i32 -1, i32* %2
br label %21
17: ; preds = %10
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %4
br label %5
20: ; preds = %5
store i32 0, i32* %2
br label %21
21: ; preds = %20, %16
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
%struct.bitfile = type { i32 }
define i32 @bitfile_validate_xilinx_info(%struct.bitfile* %0) {
%2 = tail call i32* @bitfile_find_chunk(%struct.bitfile* %0, i8 signext 97, i32 0)
%3 = icmp eq i32* %2, null
br i1 %3, label %17, label %4
4: ; preds = %1
%5 = tail call i32* @bitfile_find_chunk(%struct.bitfile* %0, i8 signext 98, i32 0)
%6 = icmp eq i32* %5, null
br i1 %6, label %17, label %7
7: ; preds = %4
%8 = tail call i32* @bitfile_find_chunk(%struct.bitfile* %0, i8 signext 99, i32 0)
%9 = icmp eq i32* %8, null
br i1 %9, label %17, label %10
10: ; preds = %7
%11 = tail call i32* @bitfile_find_chunk(%struct.bitfile* %0, i8 signext 100, i32 0)
%12 = icmp eq i32* %11, null
br i1 %12, label %17, label %13
13: ; preds = %10
%14 = tail call i32* @bitfile_find_chunk(%struct.bitfile* %0, i8 signext 101, i32 0)
%15 = icmp eq i32* %14, null
%16 = sext i1 %15 to i32
br label %17
17: ; preds = %13, %10, %7, %4, %1
%18 = phi i32 [ -1, %1 ], [ -1, %4 ], [ -1, %7 ], [ -1, %10 ], [ %16, %13 ]
ret i32 %18
}