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

/* Variables and functions */
int gpio_sequence(struct port_interface *, char *, int /*<<< orphan*/);
char *strchr(char const *, char);
int /*<<< orphan*/ strlen(char *);
int gpio_bl_exit(struct port_interface *port, const char *seq) {
  char *s;
  if (seq == NULL)
    return 1;
  s = strchr(seq, ':');
  if (s == NULL || s[1] == '\0')
    return 1;
  return gpio_sequence(port, s + 1, strlen(s + 1));
}


x86 assembly (clang, -O0):
<gpio_bl_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1157 <gpio_bl_exit+0x27>
movl   $0x1,-0x4(%rbp)
jmp    11c4 <gpio_bl_exit+0x94>
mov    -0x18(%rbp),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1185 <gpio_bl_exit+0x55>
mov    -0x20(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    1191 <gpio_bl_exit+0x61>
movl   $0x1,-0x4(%rbp)
jmp    11c4 <gpio_bl_exit+0x94>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
add    $0x1,%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
call   1050 <gpio_sequence@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpio_bl_exit>:
push   %r14
push   %rbx
push   %rax
test   %rsi,%rsi
je     1177 <gpio_bl_exit+0x47>
mov    %rdi,%r14
mov    %rsi,%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1177 <gpio_bl_exit+0x47>
mov    %rax,%rbx
cmpb   $0x0,0x1(%rax)
je     1177 <gpio_bl_exit+0x47>
add    $0x1,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <gpio_sequence@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.port_interface = type { i32 }
define i32 @gpio_bl_exit(%struct.port_interface* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.port_interface*
%5 = alloca i8*
%6 = alloca i8*
store %struct.port_interface* %0, %struct.port_interface** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %5
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 1, i32* %3
br label %30
10: ; preds = %2
%11 = load i8*, i8** %5
%12 = call i8* @strchr(i8* %11, i8 signext 58)
store i8* %12, i8** %6
%13 = load i8*, i8** %6
%14 = icmp eq i8* %13, null
br i1 %14, label %21, label %15
15: ; preds = %10
%16 = load i8*, i8** %6
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %15, %10
store i32 1, i32* %3
br label %30
22: ; preds = %15
%23 = load %struct.port_interface*, %struct.port_interface** %4
%24 = load i8*, i8** %6
%25 = getelementptr inbounds i8, i8* %24, i64 1
%26 = load i8*, i8** %6
%27 = getelementptr inbounds i8, i8* %26, i64 1
%28 = call i32 @strlen(i8* %27)
%29 = call i32 @gpio_sequence(%struct.port_interface* %23, i8* %25, i32 %28)
store i32 %29, i32* %3
br label %30
30: ; preds = %22, %21, %9
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
%struct.port_interface = type { i32 }
define i32 @gpio_bl_exit(%struct.port_interface* %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %14, label %4
4: ; preds = %2
%5 = tail call i8* @strchr(i8* %1, i8 signext 58)
%6 = icmp eq i8* %5, null
br i1 %6, label %14, label %7
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %7
%12 = tail call i32 @strlen(i8* %8)
%13 = tail call i32 @gpio_sequence(%struct.port_interface* %0, i8* %8, i32 %12)
br label %14
14: ; preds = %4, %7, %2, %11
%15 = phi i32 [ %13, %11 ], [ 1, %2 ], [ 1, %7 ], [ 1, %4 ]
ret i32 %15
}