#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 */
char *strchr(char const *, char);
void get_actualparmtype(const char *arg, char *actual) {
  const char *pstart = strchr(arg, '|');
  if (pstart) {
    pstart++;
  } else {
    pstart = arg;
  }
  while (*pstart != '|' && *pstart != '\0')
    *actual++ = *pstart++;
  *actual = '\0';
}


x86 assembly (clang, -O0):
<get_actualparmtype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x7c,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     114e <get_actualparmtype+0x3e>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1156 <get_actualparmtype+0x46>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    115b <get_actualparmtype+0x4b>
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x7c,%ecx
mov    %al,-0x19(%rbp)
je     1180 <get_actualparmtype+0x70>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1190 <get_actualparmtype+0x80>
jmp    11b7 <get_actualparmtype+0xa7>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    115b <get_actualparmtype+0x4b>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_actualparmtype>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    $0x7c,%esi
call   1030 <strchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %r14,%rcx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%rcx,%rax,1),%edx
test   %dl,%dl
je     1156 <get_actualparmtype+0x46>
cmp    $0x7c,%dl
je     1156 <get_actualparmtype+0x46>
mov    %dl,(%rbx,%rax,1)
add    $0x1,%rax
jmp    1140 <get_actualparmtype+0x30>
movb   $0x0,(%rbx,%rax,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @get_actualparmtype(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i8* @strchr(i8* %6, i8 signext 124)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %5
br label %15
13: ; preds = %2
%14 = load i8*, i8** %3
store i8* %14, i8** %5
br label %15
15: ; preds = %13, %10
br label %16
16: ; preds = %28, %15
%17 = load i8*, i8** %5
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 124
br i1 %20, label %21, label %26
21: ; preds = %16
%22 = load i8*, i8** %5
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 0
br label %26
26: ; preds = %21, %16
%27 = phi i1 [ false, %16 ], [ %25, %21 ]
br i1 %27, label %28, label %34
28: ; preds = %26
%29 = load i8*, i8** %5
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %5
%31 = load i8, i8* %29
%32 = load i8*, i8** %4
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %4
store i8 %31, i8* %32
br label %16
34: ; preds = %26
%35 = load i8*, i8** %4
store i8 0, i8* %35
ret void
}

LLVM IR (-O2):
define void @get_actualparmtype(i8* %0, i8* nocapture writeonly %1) {
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 124)
%4 = icmp eq i8* %3, null
%5 = getelementptr inbounds i8, i8* %3, i64 1
%6 = select i1 %4, i8* %0, i8* %5
br label %7
7: ; preds = %11, %2
%8 = phi i8* [ %1, %2 ], [ %13, %11 ]
%9 = phi i8* [ %6, %2 ], [ %12, %11 ]
%10 = load i8, i8* %9
switch i8 %10, label %11 [
i8 124, label %14
i8 0, label %14
]
11: ; preds = %7
%12 = getelementptr inbounds i8, i8* %9, i64 1
%13 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %10, i8* %8
br label %7
14: ; preds = %7, %7
store i8 0, i8* %8
ret void
}