#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 MACHINE_ENDIAN_F();
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ strncpy(char *, char const *, int);
int _dtype_normalize(char *dst, const char *src) {
  memset(dst, 0, 8);
  switch (src[0]) {
  case '<':
  case '>':
  case '|':
  case '=':
    strncpy(dst, src, 8);
    break;
  default:
    dst[0] = '=';
    strncpy(dst + 1, src, 7);
  }
  dst[7] = '\0';
  if (dst[0] == '=') {
    dst[0] = MACHINE_ENDIAN_F();
  }
  if (dst[0] == '|') {
    dst[0] = MACHINE_ENDIAN_F();
  }
  return 0;
}


x86 assembly (clang, -O0):
<_dtype_normalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
add    $0xffffffc4,%eax
sub    $0x3,%eax
jb     117c <_dtype_normalize+0x4c>
jmp    116b <_dtype_normalize+0x3b>
mov    -0x14(%rbp),%eax
sub    $0x7c,%eax
jne    1193 <_dtype_normalize+0x63>
jmp    117c <_dtype_normalize+0x4c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1030 <strncpy@plt>
jmp    11b0 <_dtype_normalize+0x80>
mov    -0x8(%rbp),%rax
movb   $0x3d,(%rax)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
mov    $0x7,%edx
call   1030 <strncpy@plt>
mov    -0x8(%rbp),%rax
movb   $0x0,0x7(%rax)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    11d7 <_dtype_normalize+0xa7>
mov    $0x0,%al
call   1050 <MACHINE_ENDIAN_F@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7c,%eax
jne    11f6 <_dtype_normalize+0xc6>
mov    $0x0,%al
call   1050 <MACHINE_ENDIAN_F@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_dtype_normalize>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
movsbl (%r14),%eax
lea    -0x3c(%rax),%ecx
cmp    $0x3,%ecx
jb     1157 <_dtype_normalize+0x27>
cmp    $0x7c,%eax
jne    1164 <_dtype_normalize+0x34>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x8,%edx
jmp    1173 <_dtype_normalize+0x43>
movb   $0x3d,(%rbx)
lea    0x1(%rbx),%rdi
mov    %r14,%rsi
mov    $0x7,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x7(%rbx)
mov    (%rbx),%al
cmp    $0x3d,%al
jne    118b <_dtype_normalize+0x5b>
xor    %eax,%eax
call   1050 <MACHINE_ENDIAN_F@plt>
mov    %al,(%rbx)
cmp    $0x7c,%al
jne    1198 <_dtype_normalize+0x68>
xor    %eax,%eax
call   1050 <MACHINE_ENDIAN_F@plt>
mov    %al,(%rbx)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @_dtype_normalize(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = call i32 @memset(i8* %5, i32 0, i32 8)
%7 = load i8*, i8** %4
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
switch i32 %10, label %15 [
i32 60, label %11
i32 62, label %11
i32 124, label %11
i32 61, label %11
]
11: ; preds = %2, %2, %2, %2
%12 = load i8*, i8** %3
%13 = load i8*, i8** %4
%14 = call i32 @strncpy(i8* %12, i8* %13, i32 8)
br label %22
15: ; preds = %2
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 0
store i8 61, i8* %17
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = load i8*, i8** %4
%21 = call i32 @strncpy(i8* %19, i8* %20, i32 7)
br label %22
22: ; preds = %15, %11
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i64 7
store i8 0, i8* %24
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i64 0
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 61
br i1 %29, label %30, label %34
30: ; preds = %22
%31 = call signext i8 (...) @MACHINE_ENDIAN_F()
%32 = load i8*, i8** %3
%33 = getelementptr inbounds i8, i8* %32, i64 0
store i8 %31, i8* %33
br label %34
34: ; preds = %30, %22
%35 = load i8*, i8** %3
%36 = getelementptr inbounds i8, i8* %35, i64 0
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 124
br i1 %39, label %40, label %44
40: ; preds = %34
%41 = call signext i8 (...) @MACHINE_ENDIAN_F()
%42 = load i8*, i8** %3
%43 = getelementptr inbounds i8, i8* %42, i64 0
store i8 %41, i8* %43
br label %44
44: ; preds = %40, %34
ret i32 0
}

LLVM IR (-O2):
define i32 @_dtype_normalize(i8* %0, i8* %1) {
%3 = tail call i32 @memset(i8* %0, i32 0, i32 8)
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
switch i32 %5, label %8 [
i32 60, label %6
i32 62, label %6
i32 124, label %6
i32 61, label %6
]
6: ; preds = %2, %2, %2, %2
%7 = tail call i32 @strncpy(i8* %0, i8* %1, i32 8)
br label %11
8: ; preds = %2
store i8 61, i8* %0
%9 = getelementptr inbounds i8, i8* %0, i64 1
%10 = tail call i32 @strncpy(i8* %9, i8* %1, i32 7)
br label %11
11: ; preds = %8, %6
%12 = getelementptr inbounds i8, i8* %0, i64 7
store i8 0, i8* %12
%13 = load i8, i8* %0
%14 = icmp eq i8 %13, 61
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = tail call signext i8 (...) @MACHINE_ENDIAN_F()
store i8 %16, i8* %0
br label %17
17: ; preds = %15, %11
%18 = phi i8 [ %16, %15 ], [ %13, %11 ]
%19 = icmp eq i8 %18, 124
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = tail call signext i8 (...) @MACHINE_ENDIAN_F()
store i8 %21, i8* %0
br label %22
22: ; preds = %20, %17
ret i32 0
}