#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 */
int /*<<< orphan*/ printf(char *, unsigned char);
unsigned char exponent(char *bytes) {
  unsigned char exp = 0;
  int i;
  int k;
  int j;
  for (i = 0; i < 7; i++) {
    j = 1;
    for (k = 5; k > i; k--) {
      j *= 2;
    }
    if (bytes[3] & j) {
      exp |= 2 * j;
    }
  }
  if (bytes[2] & 0x80) {
    exp |= 1;
  }
  printf("%i\n", exp);
  return exp;
}


x86 assembly (clang, -O0):
<exponent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x7,-0x10(%rbp)
jge    1198 <exponent+0x88>
movl   $0x1,-0x18(%rbp)
movl   $0x5,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1162 <exponent+0x52>
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    113f <exponent+0x2f>
mov    -0x8(%rbp),%rax
movsbl 0x3(%rax),%eax
and    -0x18(%rbp),%eax
cmp    $0x0,%eax
je     1185 <exponent+0x75>
mov    -0x18(%rbp),%ecx
shl    $0x1,%ecx
movzbl -0x9(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x9(%rbp)
jmp    118a <exponent+0x7a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1127 <exponent+0x17>
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     11b8 <exponent+0xa8>
movzbl -0x9(%rbp),%eax
or     $0x1,%eax
mov    %al,-0x9(%rbp)
lea    0xe41(%rip),%rdi
movzbl -0x9(%rbp),%esi
call   1030 <printf@plt>
movzbl -0x9(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exponent>:
push   %rbx
movzbl 0x3(%rdi),%eax
movd   %eax,%xmm0
paddb  %xmm0,%xmm0
punpcklbw %xmm0,%xmm0
pshuflw $0x0,%xmm0,%xmm0
pand   0xed2(%rip),%xmm0
add    %eax,%eax
mov    %eax,%ecx
and    $0x20,%cl
and    $0x40,%al
or     %cl,%al
movdqa %xmm0,%xmm1
psrld  $0x10,%xmm1
por    %xmm0,%xmm1
movdqa %xmm1,%xmm0
psrlw  $0x8,%xmm0
por    %xmm1,%xmm0
movd   %xmm0,%ecx
mov    0x2(%rdi),%dl
shr    $0x7,%dl
or     %al,%dl
or     %cl,%dl
movzbl %dl,%ebx
lea    0xea5(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%i\0A\00"
define zeroext i8 @exponent(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %2
store i8 0, i8* %3
store i32 0, i32* %4
br label %7
7: ; preds = %37, %1
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 7
br i1 %9, label %10, label %40
10: ; preds = %7
store i32 1, i32* %6
store i32 5, i32* %5
br label %11
11: ; preds = %18, %10
%12 = load i32, i32* %5
%13 = load i32, i32* %4
%14 = icmp sgt i32 %12, %13
br i1 %14, label %15, label %21
15: ; preds = %11
%16 = load i32, i32* %6
%17 = mul nsw i32 %16, 2
store i32 %17, i32* %6
br label %18
18: ; preds = %15
%19 = load i32, i32* %5
%20 = add nsw i32 %19, -1
store i32 %20, i32* %5
br label %11
21: ; preds = %11
%22 = load i8*, i8** %2
%23 = getelementptr inbounds i8, i8* %22, i64 3
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = load i32, i32* %6
%27 = and i32 %25, %26
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %36
29: ; preds = %21
%30 = load i32, i32* %6
%31 = mul nsw i32 2, %30
%32 = load i8, i8* %3
%33 = zext i8 %32 to i32
%34 = or i32 %33, %31
%35 = trunc i32 %34 to i8
store i8 %35, i8* %3
br label %36
36: ; preds = %29, %21
br label %37
37: ; preds = %36
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %7
40: ; preds = %7
%41 = load i8*, i8** %2
%42 = getelementptr inbounds i8, i8* %41, i64 2
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = and i32 %44, 128
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %52
47: ; preds = %40
%48 = load i8, i8* %3
%49 = zext i8 %48 to i32
%50 = or i32 %49, 1
%51 = trunc i32 %50 to i8
store i8 %51, i8* %3
br label %52
52: ; preds = %47, %40
%53 = load i8, i8* %3
%54 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext %53)
%55 = load i8, i8* %3
ret i8 %55
}

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
define zeroext i8 @exponent(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 3
%3 = load i8, i8* %2
%4 = insertelement <4 x i8> poison, i8 %3, i64 0
%5 = shl <4 x i8> %4, <i8 1, i8 0, i8 0, i8 0>
%6 = shufflevector <4 x i8> %5, <4 x i8> poison, <4 x i32> zeroinitializer
%7 = and <4 x i8> %6, <i8 2, i8 4, i8 8, i8 16>
%8 = shl i8 %3, 1
%9 = and i8 %8, 32
%10 = shl i8 %3, 1
%11 = and i8 %10, 64
%12 = call i8 @llvm.vector.reduce.or.v4i8(<4 x i8> %7)
%13 = or i8 %12, %9
%14 = or i8 %13, %11
%15 = getelementptr inbounds i8, i8* %0, i64 2
%16 = load i8, i8* %15
%17 = lshr i8 %16, 7
%18 = or i8 %17, %14
%19 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext %18)
ret i8 %18
}