#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 '=':
    strcpy(dst, src);
    break;
  default:
    dst[0] = '=';
    strcpy(dst + 1, src);
  }
  if (dst[0] == '=') {
    dst[0] = MACHINE_ENDIAN_F();
  }
  return 0;
}


x86 assembly (clang, -O0):
<dtype_normalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%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
add    $0xffffffc4,%eax
sub    $0x2,%eax
ja     117a <dtype_normalize+0x4a>
jmp    1168 <dtype_normalize+0x38>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    1192 <dtype_normalize+0x62>
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    11b1 <dtype_normalize+0x81>
mov    $0x0,%al
call   1050 <MACHINE_ENDIAN_F@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
xor    %eax,%eax
add    $0x10,%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
add    $0xffffffc4,%eax
cmp    $0x2,%eax
ja     1157 <dtype_normalize+0x27>
mov    %rbx,%rdi
jmp    115e <dtype_normalize+0x2e>
movb   $0x3d,(%rbx)
lea    0x1(%rbx),%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
cmpb   $0x3d,(%rbx)
jne    1174 <dtype_normalize+0x44>
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 61, label %11
]
11: ; preds = %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
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
%6 = add nsw i32 %5, -60
%7 = icmp ult i32 %6, 3
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @strcpy(i8* %0, i8* %1)
br label %13
10: ; preds = %2
store i8 61, i8* %0
%11 = getelementptr inbounds i8, i8* %0, i64 1
%12 = tail call i32 @strcpy(i8* %11, i8* %1)
br label %13
13: ; preds = %10, %8
%14 = load i8, i8* %0
%15 = icmp eq i8 %14, 61
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = tail call signext i8 (...) @MACHINE_ENDIAN_F()
store i8 %17, i8* %0
br label %18
18: ; preds = %16, %13
ret i32 0
}