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

/* Variables and functions */
char *cip_str_split(struct cip_substr *, char *, char);
int /*<<< orphan*/ cip_str_trim(struct cip_substr *, char *);
int cip_str_split_trim(struct cip_substr *before, struct cip_substr *after,
                       char *s, char delim) {
  char *aftr;
  aftr = cip_str_split(before, s, delim);
  if (aftr == NULL)
    return -1;
  cip_str_trim(after, aftr);
  return 0;
}


x86 assembly (clang, -O0):
<cip_str_split_trim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %cl,%al
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %al,-0x21(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
movsbl -0x21(%rbp),%edx
call   1030 <cip_str_split@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1165 <cip_str_split_trim+0x45>
movl   $0xffffffff,-0x4(%rbp)
jmp    1179 <cip_str_split_trim+0x59>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1040 <cip_str_trim@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cip_str_split_trim>:
push   %rbx
mov    %rsi,%rbx
mov    %rdx,%rsi
mov    %ecx,%edx
call   1030 <cip_str_split@plt>
test   %rax,%rax
je     1142 <cip_str_split_trim+0x22>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <cip_str_trim@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.cip_substr = type { i32 }
define i32 @cip_str_split_trim(%struct.cip_substr* %0, %struct.cip_substr* %1, i8* %2, i8 signext %3) {
%5 = alloca i32
%6 = alloca %struct.cip_substr*
%7 = alloca %struct.cip_substr*
%8 = alloca i8*
%9 = alloca i8
%10 = alloca i8*
store %struct.cip_substr* %0, %struct.cip_substr** %6
store %struct.cip_substr* %1, %struct.cip_substr** %7
store i8* %2, i8** %8
store i8 %3, i8* %9
%11 = load %struct.cip_substr*, %struct.cip_substr** %6
%12 = load i8*, i8** %8
%13 = load i8, i8* %9
%14 = call i8* @cip_str_split(%struct.cip_substr* %11, i8* %12, i8 signext %13)
store i8* %14, i8** %10
%15 = load i8*, i8** %10
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %18
17: ; preds = %4
store i32 -1, i32* %5
br label %22
18: ; preds = %4
%19 = load %struct.cip_substr*, %struct.cip_substr** %7
%20 = load i8*, i8** %10
%21 = call i32 @cip_str_trim(%struct.cip_substr* %19, i8* %20)
store i32 0, i32* %5
br label %22
22: ; preds = %18, %17
%23 = load i32, i32* %5
ret i32 %23
}

LLVM IR (-O2):
%struct.cip_substr = type { i32 }
define i32 @cip_str_split_trim(%struct.cip_substr* %0, %struct.cip_substr* %1, i8* %2, i8 signext %3) {
%5 = tail call i8* @cip_str_split(%struct.cip_substr* %0, i8* %2, i8 signext %3)
%6 = icmp eq i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @cip_str_trim(%struct.cip_substr* %1, i8* %5)
br label %9
9: ; preds = %4, %7
%10 = phi i32 [ 0, %7 ], [ -1, %4 ]
ret i32 %10
}