#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 */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ Com_sprintf(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ Q_stricmp(char *, char *);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ parse_getChar(char *);
void parse_TokToDest(char *str, char *s) {
  char buf[64];
  Com_sprintf(buf, sizeof(buf), parse_getChar(s));
  if (!Q_stricmp(buf, "0") || !Q_stricmp(buf, "<NULL>") ||
      !Q_stricmp(buf, "NULL"))
    *str = 0;
  else
    memcpy(str, buf, 64);
}


x86 assembly (clang, -O0):
<parse_TokToDest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <parse_getChar@plt>
mov    -0x58(%rbp),%rdi
mov    %eax,%edx
mov    $0x40,%esi
call   1050 <Com_sprintf@plt>
lea    -0x50(%rbp),%rdi
lea    0xe84(%rip),%rsi
call   1030 <Q_stricmp@plt>
cmp    $0x0,%eax
je     11bc <parse_TokToDest+0x7c>
lea    -0x50(%rbp),%rdi
lea    0xe6d(%rip),%rsi
call   1030 <Q_stricmp@plt>
cmp    $0x0,%eax
je     11bc <parse_TokToDest+0x7c>
lea    -0x50(%rbp),%rdi
lea    0xe5b(%rip),%rsi
call   1030 <Q_stricmp@plt>
cmp    $0x0,%eax
jne    11c8 <parse_TokToDest+0x88>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
jmp    11da <parse_TokToDest+0x9a>
mov    -0x8(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x40,%edx
call   1040 <memcpy@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_TokToDest>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rdi,%r14
mov    %rsi,%rdi
call   1060 <parse_getChar@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x40,%esi
mov    %eax,%edx
call   1050 <Com_sprintf@plt>
lea    0xe95(%rip),%rsi
mov    %rbx,%rdi
call   1030 <Q_stricmp@plt>
test   %eax,%eax
je     11af <parse_TokToDest+0x6f>
lea    0xe84(%rip),%rsi
mov    %rsp,%rdi
call   1030 <Q_stricmp@plt>
test   %eax,%eax
je     11af <parse_TokToDest+0x6f>
lea    0xe78(%rip),%rsi
mov    %rsp,%rdi
call   1030 <Q_stricmp@plt>
test   %eax,%eax
je     11af <parse_TokToDest+0x6f>
mov    %rsp,%rsi
mov    %r14,%rdi
mov    $0x40,%edx
call   1040 <memcpy@plt>
jmp    11b3 <parse_TokToDest+0x73>
movb   $0x0,(%r14)
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"0\00"
@.str.1 = [7 x i8] c"<NULL>\00"
@.str.2 = [5 x i8] c"NULL\00"
define void @parse_TokToDest(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [64 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %4
%8 = call i32 @parse_getChar(i8* %7)
%9 = call i32 @Com_sprintf(i8* %6, i32 64, i32 %8)
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%11 = call i32 @Q_stricmp(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %2
%14 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%15 = call i32 @Q_stricmp(i8* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%19 = call i32 @Q_stricmp(i8* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %17, %13, %2
%22 = load i8*, i8** %3
store i8 0, i8* %22
br label %27
23: ; preds = %17
%24 = load i8*, i8** %3
%25 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%26 = call i32 @memcpy(i8* %24, i8* %25, i32 64)
br label %27
27: ; preds = %23, %21
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"0\00"
@.str.1 = [7 x i8] c"<NULL>\00"
@.str.2 = [5 x i8] c"NULL\00"
define void @parse_TokToDest(i8* %0, i8* %1) {
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @parse_getChar(i8* %1)
%6 = call i32 @Com_sprintf(i8* %4, i32 64, i32 %5)
%7 = call i32 @Q_stricmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %2
%10 = call i32 @Q_stricmp(i8* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = call i32 @Q_stricmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %12, %9, %2
store i8 0, i8* %0
br label %18
16: ; preds = %12
%17 = call i32 @memcpy(i8* %0, i8* %4, i32 64)
br label %18
18: ; preds = %16, %15
ret void
}