#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 bgpq_request {
  int dummy;
};
struct bgpq_expander {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ bgpq_expander_add_prefix(struct bgpq_expander *, char *);
int /*<<< orphan*/ bgpq_expander_add_prefix_range(struct bgpq_expander *,
                                                  char *);
char *strchr(char *, char);
int bgpq_expanded_v6prefix(char *prefix, struct bgpq_expander *ex,
                           struct bgpq_request *req) {
  char *d = strchr(prefix, '^');
  if (!d)
    bgpq_expander_add_prefix(ex, prefix);
  else
    bgpq_expander_add_prefix_range(ex, prefix);
  return 1;
}


x86 assembly (clang, -O0):
<bgpq_expanded_v6prefix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x5e,%esi
call   1050 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1173 <bgpq_expanded_v6prefix+0x43>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <bgpq_expander_add_prefix@plt>
jmp    1180 <bgpq_expanded_v6prefix+0x50>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <bgpq_expander_add_prefix_range@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bgpq_expanded_v6prefix>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x5e,%esi
call   1050 <strchr@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
test   %rax,%rax
je     1156 <bgpq_expanded_v6prefix+0x26>
call   1040 <bgpq_expander_add_prefix_range@plt>
jmp    115b <bgpq_expanded_v6prefix+0x2b>
call   1030 <bgpq_expander_add_prefix@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.bgpq_expander = type { i32 }
%struct.bgpq_request = type { i32 }
define i32 @bgpq_expanded_v6prefix(i8* %0, %struct.bgpq_expander* %1, %struct.bgpq_request* %2) {
%4 = alloca i8*
%5 = alloca %struct.bgpq_expander*
%6 = alloca %struct.bgpq_request*
%7 = alloca i8*
store i8* %0, i8** %4
store %struct.bgpq_expander* %1, %struct.bgpq_expander** %5
store %struct.bgpq_request* %2, %struct.bgpq_request** %6
%8 = load i8*, i8** %4
%9 = call i8* @strchr(i8* %8, i8 signext 94)
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = icmp ne i8* %10, null
br i1 %11, label %16, label %12
12: ; preds = %3
%13 = load %struct.bgpq_expander*, %struct.bgpq_expander** %5
%14 = load i8*, i8** %4
%15 = call i32 @bgpq_expander_add_prefix(%struct.bgpq_expander* %13, i8* %14)
br label %20
16: ; preds = %3
%17 = load %struct.bgpq_expander*, %struct.bgpq_expander** %5
%18 = load i8*, i8** %4
%19 = call i32 @bgpq_expander_add_prefix_range(%struct.bgpq_expander* %17, i8* %18)
br label %20
20: ; preds = %16, %12
ret i32 1
}

LLVM IR (-O2):
%struct.bgpq_expander = type { i32 }
%struct.bgpq_request = type { i32 }
define i32 @bgpq_expanded_v6prefix(i8* %0, %struct.bgpq_expander* %1, %struct.bgpq_request* nocapture readnone %2) {
%4 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 94)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @bgpq_expander_add_prefix(%struct.bgpq_expander* %1, i8* %0)
br label %10
8: ; preds = %3
%9 = tail call i32 @bgpq_expander_add_prefix_range(%struct.bgpq_expander* %1, i8* %0)
br label %10
10: ; preds = %8, %6
ret i32 1
}