#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ memmove(char *, char *, scalar_t__);
char *strchr(char *, char);
scalar_t__ strlen(char *);
char *strrchr(char *, char);
void parse_cmd(char *buf) {
  assert(buf != NULL);
  char *loc = NULL;
  char *loc2 = NULL;
  loc = strchr(buf, '=');
  loc++;
  loc2 = strrchr(loc, '\n');
  *loc2 = '\0';
  memmove(buf, loc, strlen(loc) + 1);
  return;
}


x86 assembly (clang, -O0):
<parse_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3d,%esi
call   1040 <strchr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1070 <memmove@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_cmd>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1060 <assert@plt>
mov    %r14,%rdi
mov    $0x3d,%esi
call   1040 <strchr@plt>
lea    0x1(%rax),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <strrchr@plt>
movb   $0x0,(%rax)
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1070 <memmove@plt>

LLVM IR (-O0):
define void @parse_cmd(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = icmp ne i8* %5, null
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
store i8* null, i8** %3
store i8* null, i8** %4
%9 = load i8*, i8** %2
%10 = call i8* @strchr(i8* %9, i8 signext 61)
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %3
%13 = load i8*, i8** %3
%14 = call i8* @strrchr(i8* %13, i8 signext 10)
store i8* %14, i8** %4
%15 = load i8*, i8** %4
store i8 0, i8* %15
%16 = load i8*, i8** %2
%17 = load i8*, i8** %3
%18 = load i8*, i8** %3
%19 = call i64 @strlen(i8* %18)
%20 = add nsw i64 %19, 1
%21 = call i32 @memmove(i8* %16, i8* %17, i64 %20)
ret void
}

LLVM IR (-O2):
define void @parse_cmd(i8* %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 61)
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = tail call i8* @strrchr(i8* %6, i8 signext 10)
store i8 0, i8* %7
%8 = tail call i64 @strlen(i8* %6)
%9 = add nsw i64 %8, 1
%10 = tail call i32 @memmove(i8* %0, i8* %6, i64 %9)
ret void
}