#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 */
int /*<<< orphan*/ character_exists(char *, char);
int /*<<< orphan*/ piece(char *, char, char *, int /*<<< orphan*/);
int /*<<< orphan*/ right_trim(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
void hydrology_parse_datatype_units_phrase(char *datatype_phrase,
                                           char *units_phrase,
                                           char *datatype_seek_phrase) {
  int str_len;
  if (!character_exists(datatype_seek_phrase, '(')) {
    strcpy(datatype_phrase, datatype_seek_phrase);
    return;
  }
  str_len = strlen(datatype_seek_phrase);
  if (*(datatype_seek_phrase + (str_len - 1)) != ')') {
    return;
  }
  piece(datatype_phrase, '(', datatype_seek_phrase, 0);
  str_len = strlen(datatype_phrase);
  right_trim(datatype_phrase);
  piece(units_phrase, ')', datatype_seek_phrase + str_len + 2, 0);
}


x86 assembly (clang, -O0):
<hydrology_parse_datatype_units_phrase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x28,%esi
call   1050 <character_exists@plt>
cmp    $0x0,%eax
jne    118d <hydrology_parse_datatype_units_phrase+0x3d>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    1200 <hydrology_parse_datatype_units_phrase+0xb0>
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x29,%eax
je     11b8 <hydrology_parse_datatype_units_phrase+0x68>
jmp    1200 <hydrology_parse_datatype_units_phrase+0xb0>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x28,%esi
xor    %ecx,%ecx
call   1070 <piece@plt>
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <right_trim@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
movslq -0x1c(%rbp),%rax
add    %rax,%rdx
add    $0x2,%rdx
mov    $0x29,%esi
xor    %ecx,%ecx
call   1070 <piece@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hydrology_parse_datatype_units_phrase>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rdi
mov    $0x28,%esi
call   1050 <character_exists@plt>
test   %eax,%eax
je     11ca <hydrology_parse_datatype_units_phrase+0x7a>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmpb   $0x29,-0x1(%rax,%rbx,1)
jne    11df <hydrology_parse_datatype_units_phrase+0x8f>
mov    %r15,%rdi
mov    $0x28,%esi
mov    %rbx,%rdx
xor    %ecx,%ecx
call   1070 <piece@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1060 <right_trim@plt>
movslq %ebp,%rax
lea    (%rbx,%rax,1),%rdx
add    $0x2,%rdx
mov    %r14,%rdi
mov    $0x29,%esi
xor    %ecx,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <piece@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <strcpy@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @hydrology_parse_datatype_units_phrase(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = call i32 @character_exists(i8* %8, i8 signext 40)
%10 = icmp ne i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %3
%12 = load i8*, i8** %4
%13 = load i8*, i8** %6
%14 = call i32 @strcpy(i8* %12, i8* %13)
br label %42
15: ; preds = %3
%16 = load i8*, i8** %6
%17 = call i32 @strlen(i8* %16)
store i32 %17, i32* %7
%18 = load i8*, i8** %6
%19 = load i32, i32* %7
%20 = sub nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %18, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 41
br i1 %25, label %26, label %27
26: ; preds = %15
br label %42
27: ; preds = %15
%28 = load i8*, i8** %4
%29 = load i8*, i8** %6
%30 = call i32 @piece(i8* %28, i8 signext 40, i8* %29, i32 0)
%31 = load i8*, i8** %4
%32 = call i32 @strlen(i8* %31)
store i32 %32, i32* %7
%33 = load i8*, i8** %4
%34 = call i32 @right_trim(i8* %33)
%35 = load i8*, i8** %5
%36 = load i8*, i8** %6
%37 = load i32, i32* %7
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %36, i64 %38
%40 = getelementptr inbounds i8, i8* %39, i64 2
%41 = call i32 @piece(i8* %35, i8 signext 41, i8* %40, i32 0)
br label %42
42: ; preds = %27, %26, %11
ret void
}

LLVM IR (-O2):
define void @hydrology_parse_datatype_units_phrase(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @character_exists(i8* %2, i8 signext 40)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @strcpy(i8* %0, i8* %2)
br label %23
8: ; preds = %3
%9 = tail call i32 @strlen(i8* %2)
%10 = add nsw i32 %9, -1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %2, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 41
br i1 %14, label %15, label %23
15: ; preds = %8
%16 = tail call i32 @piece(i8* %0, i8 signext 40, i8* %2, i32 0)
%17 = tail call i32 @strlen(i8* %0)
%18 = tail call i32 @right_trim(i8* %0)
%19 = sext i32 %17 to i64
%20 = getelementptr inbounds i8, i8* %2, i64 %19
%21 = getelementptr inbounds i8, i8* %20, i64 2
%22 = tail call i32 @piece(i8* %1, i8 signext 41, i8* %21, i32 0)
br label %23
23: ; preds = %8, %15, %6
ret void
}