#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 char u_int32_t;
typedef char u_int16_t;

/* Variables and functions */
int /*<<< orphan*/ pow(int, int);
char round(int /*<<< orphan*/);
u_int32_t trixel2number(char *trixel) {
  int index;
  u_int32_t id = 0;
  for (index = 6 + 1; index >= 1; --index) {
    id += (trixel[index] - '0') * (u_int16_t)round(pow(4, (6 + 1 - index)));
  }
  id += ((trixel[0] == 'S') ? round(pow(4, 6 + 1)) + 1 : 0);
  return id;
}


x86 assembly (clang, -O0):
<trixel2number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0xd(%rbp)
movl   $0x7,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jl     118c <trixel2number+0x6c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x30,%eax
mov    %eax,-0x14(%rbp)
mov    $0x7,%esi
sub    -0xc(%rbp),%esi
mov    $0x4,%edi
call   1030 <pow@plt>
mov    %eax,%edi
call   1040 <round@plt>
mov    -0x14(%rbp),%ecx
movsbl %al,%eax
imul   %eax,%ecx
movsbl -0xd(%rbp),%eax
add    %ecx,%eax
mov    %al,-0xd(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1137 <trixel2number+0x17>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x53,%eax
jne    11c0 <trixel2number+0xa0>
mov    $0x4,%edi
mov    $0x7,%esi
call   1030 <pow@plt>
mov    %eax,%edi
call   1040 <round@plt>
movsbl %al,%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ca <trixel2number+0xaa>
xor    %eax,%eax
mov    %eax,-0x18(%rbp)
jmp    11ca <trixel2number+0xaa>
mov    -0x18(%rbp),%ecx
movsbl -0xd(%rbp),%eax
add    %ecx,%eax
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trixel2number>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r12
mov    0x7(%rdi),%al
mov    %al,0x17(%rsp)
mov    $0x4,%edi
xor    %esi,%esi
call   1030 <pow@plt>
mov    %eax,%edi
call   1040 <round@plt>
mov    %al,0x16(%rsp)
mov    0x6(%r12),%al
mov    %al,0x15(%rsp)
mov    $0x4,%edi
mov    $0x1,%esi
call   1030 <pow@plt>
mov    %eax,%edi
call   1040 <round@plt>
mov    %al,0x14(%rsp)
mov    0x5(%r12),%al
mov    %al,0x13(%rsp)
mov    $0x4,%edi
mov    $0x2,%esi
call   1030 <pow@plt>
mov    %eax,%edi
call   1040 <round@plt>
mov    %al,0x12(%rsp)
mov    0x4(%r12),%r14b
mov    $0x4,%edi
mov    $0x3,%esi
call   1030 <pow@plt>
mov    %eax,%edi
call   1040 <round@plt>
mov    %al,0x11(%rsp)
mov    0x3(%r12),%bpl
mov    $0x4,%edi
mov    $0x4,%esi
call   1030 <pow@plt>
mov    %eax,%edi
call   1040 <round@plt>
mov    %al,0x10(%rsp)
mov    0x2(%r12),%r15b
mov    $0x4,%edi
mov    $0x5,%esi
call   1030 <pow@plt>
mov    %eax,%edi
call   1040 <round@plt>
mov    %al,0xf(%rsp)
mov    0x1(%r12),%r13b
mov    $0x4,%edi
mov    $0x6,%esi
call   1030 <pow@plt>
mov    %eax,%edi
call   1040 <round@plt>
xor    %esi,%esi
mov    %eax,%ebx
cmpb   $0x53,(%r12)
jne    1234 <trixel2number+0x114>
mov    $0x4,%edi
mov    $0x7,%esi
call   1030 <pow@plt>
mov    %eax,%edi
call   1040 <round@plt>
mov    %eax,%esi
add    $0x1,%sil
add    $0xd0,%r13b
mov    %r13d,%eax
mul    %bl
mov    %eax,%r9d
add    $0xd0,%r15b
mov    %r15d,%eax
mulb   0xf(%rsp)
mov    %eax,%edi
add    $0xd0,%bpl
mov    %ebp,%eax
mulb   0x10(%rsp)
mov    %eax,%r8d
add    $0xd0,%r14b
mov    %r14d,%eax
mulb   0x11(%rsp)
mov    %eax,%ecx
mov    0x13(%rsp),%al
add    $0xd0,%al
mulb   0x12(%rsp)
mov    %eax,%edx
mov    0x15(%rsp),%al
add    $0xd0,%al
mulb   0x14(%rsp)
mov    %eax,%ebx
mov    0x17(%rsp),%al
add    $0xd0,%al
mulb   0x16(%rsp)
add    %bl,%al
add    %dl,%al
add    %cl,%al
add    %r8b,%al
add    %dil,%al
add    %r9b,%al
add    %sil,%al
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define signext i8 @trixel2number(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8
store i8* %0, i8** %2
store i8 0, i8* %4
store i32 7, i32* %3
br label %5
5: ; preds = %26, %1
%6 = load i32, i32* %3
%7 = icmp sge i32 %6, 1
br i1 %7, label %8, label %29
8: ; preds = %5
%9 = load i8*, i8** %2
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = sub nsw i32 %14, 48
%16 = load i32, i32* %3
%17 = sub nsw i32 7, %16
%18 = call i32 @pow(i32 4, i32 %17)
%19 = call signext i8 @round(i32 %18)
%20 = sext i8 %19 to i32
%21 = mul nsw i32 %15, %20
%22 = load i8, i8* %4
%23 = sext i8 %22 to i32
%24 = add nsw i32 %23, %21
%25 = trunc i32 %24 to i8
store i8 %25, i8* %4
br label %26
26: ; preds = %8
%27 = load i32, i32* %3
%28 = add nsw i32 %27, -1
store i32 %28, i32* %3
br label %5
29: ; preds = %5
%30 = load i8*, i8** %2
%31 = getelementptr inbounds i8, i8* %30, i64 0
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 83
br i1 %34, label %35, label %40
35: ; preds = %29
%36 = call i32 @pow(i32 4, i32 7)
%37 = call signext i8 @round(i32 %36)
%38 = sext i8 %37 to i32
%39 = add nsw i32 %38, 1
br label %41
40: ; preds = %29
br label %41
41: ; preds = %40, %35
%42 = phi i32 [ %39, %35 ], [ 0, %40 ]
%43 = load i8, i8* %4
%44 = sext i8 %43 to i32
%45 = add nsw i32 %44, %42
%46 = trunc i32 %45 to i8
store i8 %46, i8* %4
%47 = load i8, i8* %4
ret i8 %47
}

LLVM IR (-O2):
define signext i8 @trixel2number(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 7
%3 = load i8, i8* %2
%4 = tail call i32 @pow(i32 4, i32 0)
%5 = tail call signext i8 @round(i32 %4)
%6 = getelementptr inbounds i8, i8* %0, i64 6
%7 = load i8, i8* %6
%8 = tail call i32 @pow(i32 4, i32 1)
%9 = tail call signext i8 @round(i32 %8)
%10 = getelementptr inbounds i8, i8* %0, i64 5
%11 = load i8, i8* %10
%12 = tail call i32 @pow(i32 4, i32 2)
%13 = tail call signext i8 @round(i32 %12)
%14 = getelementptr inbounds i8, i8* %0, i64 4
%15 = load i8, i8* %14
%16 = tail call i32 @pow(i32 4, i32 3)
%17 = tail call signext i8 @round(i32 %16)
%18 = getelementptr inbounds i8, i8* %0, i64 3
%19 = load i8, i8* %18
%20 = tail call i32 @pow(i32 4, i32 4)
%21 = tail call signext i8 @round(i32 %20)
%22 = getelementptr inbounds i8, i8* %0, i64 2
%23 = load i8, i8* %22
%24 = tail call i32 @pow(i32 4, i32 5)
%25 = tail call signext i8 @round(i32 %24)
%26 = getelementptr inbounds i8, i8* %0, i64 1
%27 = load i8, i8* %26
%28 = tail call i32 @pow(i32 4, i32 6)
%29 = tail call signext i8 @round(i32 %28)
%30 = load i8, i8* %0
%31 = icmp eq i8 %30, 83
br i1 %31, label %32, label %36
32: ; preds = %1
%33 = tail call i32 @pow(i32 4, i32 7)
%34 = tail call signext i8 @round(i32 %33)
%35 = add i8 %34, 1
br label %36
36: ; preds = %1, %32
%37 = phi i8 [ %35, %32 ], [ 0, %1 ]
%38 = add i8 %27, -48
%39 = mul i8 %38, %29
%40 = add i8 %23, -48
%41 = mul i8 %40, %25
%42 = add i8 %19, -48
%43 = mul i8 %42, %21
%44 = add i8 %15, -48
%45 = mul i8 %44, %17
%46 = add i8 %11, -48
%47 = mul i8 %46, %13
%48 = add i8 %7, -48
%49 = mul i8 %48, %9
%50 = add i8 %3, -48
%51 = mul i8 %50, %5
%52 = add i8 %49, %51
%53 = add i8 %47, %52
%54 = add i8 %45, %53
%55 = add i8 %43, %54
%56 = add i8 %41, %55
%57 = add i8 %39, %56
%58 = add i8 %37, %57
ret i8 %58
}