#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 */
scalar_t__ kcm_get_char_or_hex_val(char *, unsigned short *);
char *kcm_get_token(char const *, char *, int);
const char *kcm_get_char_or_hex_token_value(const char *line,
                                            unsigned short *val) {
  char token[512];
  line = kcm_get_token(line, token, 512);
  if (NULL != line) {
    if (kcm_get_char_or_hex_val(token, val)) {
      return NULL;
    }
  }
  return line;
}


x86 assembly (clang, -O0):
<kcm_get_char_or_hex_token_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x220(%rbp),%rsi
mov    $0x200,%edx
call   1040 <kcm_get_token@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
je     1184 <kcm_get_char_or_hex_token_value+0x64>
lea    -0x220(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <kcm_get_char_or_hex_val@plt>
cmp    $0x0,%rax
je     117f <kcm_get_char_or_hex_token_value+0x5f>
movq   $0x0,-0x8(%rbp)
jmp    118c <kcm_get_char_or_hex_token_value+0x6c>
jmp    1184 <kcm_get_char_or_hex_token_value+0x64>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kcm_get_char_or_hex_token_value>:
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %rsi,%r14
mov    %rsp,%rsi
mov    $0x200,%edx
call   1040 <kcm_get_token@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1154 <kcm_get_char_or_hex_token_value+0x34>
mov    %rsp,%rdi
mov    %r14,%rsi
call   1030 <kcm_get_char_or_hex_val@plt>
test   %rax,%rax
je     1154 <kcm_get_char_or_hex_token_value+0x34>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @kcm_get_char_or_hex_token_value(i8* %0, i16* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i16*
%6 = alloca [512 x i8]
store i8* %0, i8** %4
store i16* %1, i16** %5
%7 = load i8*, i8** %4
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%9 = call i8* @kcm_get_token(i8* %7, i8* %8, i32 512)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = icmp ne i8* null, %10
br i1 %11, label %12, label %19
12: ; preds = %2
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%14 = load i16*, i16** %5
%15 = call i64 @kcm_get_char_or_hex_val(i8* %13, i16* %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %12
store i8* null, i8** %3
br label %21
18: ; preds = %12
br label %19
19: ; preds = %18, %2
%20 = load i8*, i8** %4
store i8* %20, i8** %3
br label %21
21: ; preds = %19, %17
%22 = load i8*, i8** %3
ret i8* %22
}

LLVM IR (-O2):
define i8* @kcm_get_char_or_hex_token_value(i8* %0, i16* %1) {
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = call i8* @kcm_get_token(i8* %0, i8* %4, i32 512)
%6 = icmp eq i8* %5, null
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = call i64 @kcm_get_char_or_hex_val(i8* %4, i16* %1)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7, %2
br label %11
11: ; preds = %7, %10
%12 = phi i8* [ %5, %10 ], [ null, %7 ]
ret i8* %12
}