#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*/ strcpy(char *, char const *);
int _dtype_normalize(char *dst, const char *src) {
  memset(dst, 0, 8);
  switch (src[0]) {
  case '<':
  case '>':
  case '|':
  case '=':
    strcpy(dst, src);
    break;
  default:
    dst[0] = '=';
    strcpy(dst + 1, src);
  }
  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    118e <_dtype_normalize+0x5e>
jmp    117c <_dtype_normalize+0x4c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    11a6 <_dtype_normalize+0x76>
mov    -0x8(%rbp),%rax
movb   $0x3d,(%rax)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    11c5 <_dtype_normalize+0x95>
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    11e4 <_dtype_normalize+0xb4>
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    115c <_dtype_normalize+0x2c>
mov    %rbx,%rdi
jmp    1163 <_dtype_normalize+0x33>
movb   $0x3d,(%rbx)
lea    0x1(%rbx),%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    (%rbx),%al
cmp    $0x3d,%al
jne    117a <_dtype_normalize+0x4a>
xor    %eax,%eax
call   1050 <MACHINE_ENDIAN_F@plt>
mov    %al,(%rbx)
cmp    $0x7c,%al
jne    1187 <_dtype_normalize+0x57>
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 @strcpy(i8* %12, i8* %13)
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 @strcpy(i8* %19, i8* %20)
br label %22
22: ; preds = %15, %11
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i64 0
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 61
br i1 %27, label %28, label %32
28: ; preds = %22
%29 = call signext i8 (...) @MACHINE_ENDIAN_F()
%30 = load i8*, i8** %3
%31 = getelementptr inbounds i8, i8* %30, i64 0
store i8 %29, i8* %31
br label %32
32: ; preds = %28, %22
%33 = load i8*, i8** %3
%34 = getelementptr inbounds i8, i8* %33, i64 0
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 124
br i1 %37, label %38, label %42
38: ; preds = %32
%39 = call signext i8 (...) @MACHINE_ENDIAN_F()
%40 = load i8*, i8** %3
%41 = getelementptr inbounds i8, i8* %40, i64 0
store i8 %39, i8* %41
br label %42
42: ; preds = %38, %32
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 @strcpy(i8* %0, i8* %1)
br label %11
8: ; preds = %2
store i8 61, i8* %0
%9 = getelementptr inbounds i8, i8* %0, i64 1
%10 = tail call i32 @strcpy(i8* %9, i8* %1)
br label %11
11: ; preds = %8, %6
%12 = load i8, i8* %0
%13 = icmp eq i8 %12, 61
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call signext i8 (...) @MACHINE_ENDIAN_F()
store i8 %15, i8* %0
br label %16
16: ; preds = %14, %11
%17 = phi i8 [ %15, %14 ], [ %12, %11 ]
%18 = icmp eq i8 %17, 124
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = tail call signext i8 (...) @MACHINE_ENDIAN_F()
store i8 %20, i8* %0
br label %21
21: ; preds = %19, %16
ret i32 0
}