#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);
void print_bldspec(unsigned char *str) {
  int i;
  for (i = 1; i < 7; i++) {
    printf("%3d; ", ((str[i - 1] << (7 - i)) & 0x7f) + (str[i] >> (i + 1)));
  }
  printf("%3d; \n", str[6] & 0x7f);
}


x86 assembly (clang, -O0):
<print_bldspec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x7,-0xc(%rbp)
jge    1180 <print_bldspec+0x70>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    $0x7,%ecx
sub    -0xc(%rbp),%ecx
shl    %cl,%eax
and    $0x7f,%eax
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
movzbl (%rcx,%rdx,1),%edx
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
sar    %cl,%edx
mov    %edx,%ecx
add    %ecx,%eax
lea    0xe96(%rip),%rdi
movzbl %al,%esi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <print_bldspec+0x13>
mov    -0x8(%rbp),%rax
movzbl 0x6(%rax),%eax
and    $0x7f,%eax
lea    0xe74(%rip),%rdi
movzbl %al,%esi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_bldspec>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%al
mov    0x1(%rdi),%cl
shr    $0x2,%cl
shl    $0x6,%al
or     %cl,%al
and    $0x7f,%al
movzbl %al,%esi
lea    0xed0(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x1(%rbx),%al
mov    0x2(%rbx),%cl
shr    $0x3,%cl
shl    $0x5,%al
or     %cl,%al
and    $0x7f,%al
movzbl %al,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x2(%rbx),%al
mov    0x3(%rbx),%cl
shr    $0x4,%cl
shl    $0x4,%al
or     %cl,%al
and    $0x7f,%al
movzbl %al,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x3(%rbx),%al
mov    0x4(%rbx),%cl
shr    $0x5,%cl
shl    $0x3,%al
or     %cl,%al
and    $0x7f,%al
movzbl %al,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x4(%rbx),%al
mov    0x5(%rbx),%cl
shr    $0x6,%cl
shl    $0x2,%al
or     %cl,%al
and    $0x7f,%al
movzbl %al,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x5(%rbx),%al
mov    0x6(%rbx),%cl
shr    $0x7,%cl
add    %al,%al
or     %cl,%al
and    $0x7f,%al
movzbl %al,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0x6(%rbx),%esi
and    $0x7f,%esi
lea    0xe3a(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%3d; \00"
@.str.1 = [7 x i8] c"%3d; \0A\00"
define void @print_bldspec(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 1, i32* %3
br label %4
4: ; preds = %31, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 7
br i1 %6, label %7, label %34
7: ; preds = %4
%8 = load i8*, i8** %2
%9 = load i32, i32* %3
%10 = sub nsw i32 %9, 1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %8, i64 %11
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = load i32, i32* %3
%16 = sub nsw i32 7, %15
%17 = shl i32 %14, %16
%18 = and i32 %17, 127
%19 = load i8*, i8** %2
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
%27 = ashr i32 %24, %26
%28 = add nsw i32 %18, %27
%29 = trunc i32 %28 to i8
%30 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 zeroext %29)
br label %31
31: ; preds = %7
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %4
34: ; preds = %4
%35 = load i8*, i8** %2
%36 = getelementptr inbounds i8, i8* %35, i64 6
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = and i32 %38, 127
%40 = trunc i32 %39 to i8
%41 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %40)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%3d; \00"
@.str.1 = [7 x i8] c"%3d; \0A\00"
define void @print_bldspec(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = shl i8 %2, 6
%4 = and i8 %3, 64
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = lshr i8 %6, 2
%8 = or i8 %4, %7
%9 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 zeroext %8)
%10 = load i8, i8* %5
%11 = shl i8 %10, 5
%12 = and i8 %11, 96
%13 = getelementptr inbounds i8, i8* %0, i64 2
%14 = load i8, i8* %13
%15 = lshr i8 %14, 3
%16 = or i8 %12, %15
%17 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 zeroext %16)
%18 = load i8, i8* %13
%19 = shl i8 %18, 4
%20 = and i8 %19, 112
%21 = getelementptr inbounds i8, i8* %0, i64 3
%22 = load i8, i8* %21
%23 = lshr i8 %22, 4
%24 = or i8 %20, %23
%25 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 zeroext %24)
%26 = load i8, i8* %21
%27 = shl i8 %26, 3
%28 = and i8 %27, 120
%29 = getelementptr inbounds i8, i8* %0, i64 4
%30 = load i8, i8* %29
%31 = lshr i8 %30, 5
%32 = or i8 %28, %31
%33 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 zeroext %32)
%34 = load i8, i8* %29
%35 = shl i8 %34, 2
%36 = and i8 %35, 124
%37 = getelementptr inbounds i8, i8* %0, i64 5
%38 = load i8, i8* %37
%39 = lshr i8 %38, 6
%40 = or i8 %36, %39
%41 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 zeroext %40)
%42 = load i8, i8* %37
%43 = shl i8 %42, 1
%44 = and i8 %43, 126
%45 = getelementptr inbounds i8, i8* %0, i64 6
%46 = load i8, i8* %45
%47 = lshr i8 %46, 7
%48 = or i8 %44, %47
%49 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 zeroext %48)
%50 = load i8, i8* %45
%51 = and i8 %50, 127
%52 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %51)
ret void
}