#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 *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int get_uname(char *param) {
  char *p = strchr(param, '<');
  if (NULL != p) {
    *p++ = '\0';
    char *q = strchr(p, '>');
    if (NULL != q) {
      *q = '\0';
    }
  }
  strcpy(param, p);
  return 0;
}


x86 assembly (clang, -O0):
<get_uname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3c,%esi
call   1040 <strchr@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
je     1186 <get_uname+0x66>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    $0x3e,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
je     1181 <get_uname+0x61>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
jmp    1186 <get_uname+0x66>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_uname>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x3c,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1157 <get_uname+0x37>
mov    %rax,%rbx
add    $0x1,%rbx
movb   $0x0,(%rax)
mov    %rbx,%rdi
mov    $0x3e,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1159 <get_uname+0x39>
movb   $0x0,(%rax)
jmp    1159 <get_uname+0x39>
xor    %ebx,%ebx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @get_uname(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @strchr(i8* %5, i8 signext 60)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = icmp ne i8* null, %7
br i1 %8, label %9, label %19
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %3
store i8 0, i8* %10
%12 = load i8*, i8** %3
%13 = call i8* @strchr(i8* %12, i8 signext 62)
store i8* %13, i8** %4
%14 = load i8*, i8** %4
%15 = icmp ne i8* null, %14
br i1 %15, label %16, label %18
16: ; preds = %9
%17 = load i8*, i8** %4
store i8 0, i8* %17
br label %18
18: ; preds = %16, %9
br label %19
19: ; preds = %18, %1
%20 = load i8*, i8** %2
%21 = load i8*, i8** %3
%22 = call i32 @strcpy(i8* %20, i8* %21)
ret i32 0
}

LLVM IR (-O2):
define i32 @get_uname(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 60)
%3 = icmp eq i8* %2, null
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %2, i64 1
store i8 0, i8* %2
%6 = tail call i8* @strchr(i8* %5, i8 signext 62)
%7 = icmp eq i8* %6, null
br i1 %7, label %9, label %8
8: ; preds = %4
store i8 0, i8* %6
br label %9
9: ; preds = %4, %8, %1
%10 = phi i8* [ null, %1 ], [ %5, %8 ], [ %5, %4 ]
%11 = tail call i32 @strcpy(i8* %0, i8* %10)
ret i32 0
}