#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 *);
int /*<<< orphan*/ putchar(char);
void procchunk(unsigned char *ind, int nsamps, int nby) {
  int i, j;
  unsigned char x;
  int loopc = 0;
  for (i = 0; i < nby; ++i) {
    for (j = 0; j < 8; j += 2) {
      x = (ind[i] >> j) & 0x03;
      switch (x) {
      case 0x00:
        putchar('h');
        break;
      case 0x03:
        putchar('H');
        break;
      case 0x01:
        putchar('0');
        break;
      case 0x02:
        putchar('T');
      }
      putchar(' ');
      loopc++;
      if (loopc >= nsamps) {
        printf("\n");
        return;
      }
    }
  }
  return;
}


x86 assembly (clang, -O0):
<procchunk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1226 <procchunk+0x106>
movl   $0x0,-0x18(%rbp)
cmpl   $0x8,-0x18(%rbp)
jge    1213 <procchunk+0xf3>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%cl
shr    %cl,%eax
and    $0x3,%al
mov    %al,-0x19(%rbp)
movzbl -0x19(%rbp),%eax
mov    %rax,-0x28(%rbp)
sub    $0x3,%rax
ja     11d0 <procchunk+0xb0>
mov    -0x28(%rbp),%rax
lea    0xe70(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x68,%edi
call   1030 <putchar@plt>
jmp    11d0 <procchunk+0xb0>
mov    $0x48,%edi
call   1030 <putchar@plt>
jmp    11d0 <procchunk+0xb0>
mov    $0x30,%edi
call   1030 <putchar@plt>
jmp    11d0 <procchunk+0xb0>
mov    $0x54,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1200 <procchunk+0xe0>
lea    0xe1a(%rip),%rdi
call   1040 <printf@plt>
jmp    122b <procchunk+0x10b>
jmp    1205 <procchunk+0xe5>
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x18(%rbp)
jmp    1153 <procchunk+0x33>
jmp    1218 <procchunk+0xf8>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1140 <procchunk+0x20>
jmp    122b <procchunk+0x10b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<procchunk>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edx,%edx
jle    11e5 <procchunk+0xd5>
mov    %esi,%r15d
mov    %rdi,%rbx
mov    %edx,%r14d
shl    $0x2,%r14
xor    %ebp,%ebp
xchg   %ax,%ax
movzbl (%rbx),%ecx
shl    $0x3,%cl
mov    $0x48543068,%eax
shr    %cl,%eax
movzbl %al,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
lea    0x1(%rbp),%eax
cmp    %r15d,%eax
jge    11f0 <procchunk+0xe0>
movzbl (%rbx),%ecx
add    %cl,%cl
and    $0x18,%cl
mov    $0x48543068,%eax
shr    %cl,%eax
movzbl %al,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
lea    0x2(%rbp),%eax
cmp    %r15d,%eax
jge    11f0 <procchunk+0xe0>
movzbl (%rbx),%ecx
shr    %cl
and    $0x18,%cl
mov    $0x48543068,%eax
shr    %cl,%eax
movzbl %al,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
lea    0x3(%rbp),%eax
cmp    %r15d,%eax
jge    11f0 <procchunk+0xe0>
movzbl (%rbx),%ecx
shr    $0x3,%cl
and    $0x18,%cl
mov    $0x48543068,%eax
shr    %cl,%eax
movzbl %al,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x4,%rbp
cmp    %r15d,%ebp
jge    11f0 <procchunk+0xe0>
add    $0x1,%rbx
cmp    %rbp,%r14
jne    1130 <procchunk+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

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