#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 int u_char;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int, int, int);
void dump_device_geo(u_char *p, int len) {
  while (len >= 6) {
    printf("\twidth = %d, erase = 0x%x, read = 0x%x, write = 0x%x\n"
           "\t\tpartition = 0x%x, interleave = 0x%x\n",
           p[0], 1 << (p[1] - 1), 1 << (p[2] - 1), 1 << (p[3] - 1),
           1 << (p[4] - 1), 1 << (p[5] - 1));
    len -= 6;
  }
}


x86 assembly (clang, -O0):
<dump_device_geo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x6,-0xc(%rbp)
jl     11ab <dump_device_geo+0x9b>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ecx
sub    $0x1,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%ecx
sub    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%ecx
sub    $0x1,%ecx
mov    $0x1,%r8d
shl    %cl,%r8d
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%ecx
sub    $0x1,%ecx
mov    $0x1,%r9d
shl    %cl,%r9d
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%ecx
sub    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    -0x10(%rbp),%ecx
lea    0xe6b(%rip),%rdi
mov    %eax,(%rsp)
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
sub    $0x6,%eax
mov    %eax,-0xc(%rbp)
jmp    111f <dump_device_geo+0xf>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_device_geo>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
cmp    $0x6,%esi
jl     1197 <dump_device_geo+0x87>
mov    %esi,%ebx
mov    %rdi,%r14
add    $0x6,%ebx
lea    0xed3(%rip),%r15
nopl   (%rax)
movzbl 0x4(%r14),%ecx
add    $0xff,%cl
mov    $0x1,%edx
shl    %cl,%edx
movzbl 0x8(%r14),%ecx
add    $0xff,%cl
mov    $0x1,%eax
shl    %cl,%eax
movzbl 0xc(%r14),%ecx
add    $0xff,%cl
mov    $0x1,%r8d
shl    %cl,%r8d
movzbl 0x10(%r14),%ecx
add    $0xff,%cl
mov    $0x1,%r9d
shl    %cl,%r9d
mov    (%r14),%esi
movzbl 0x14(%r14),%ecx
add    $0xff,%cl
mov    $0x1,%edi
shl    %cl,%edi
mov    %edi,(%rsp)
mov    %r15,%rdi
mov    %eax,%ecx
call   1030 <printf@plt>
add    $0xfffffffa,%ebx
cmp    $0xb,%ebx
ja     1130 <dump_device_geo+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [92 x i8] c"\09width = %d, erase = 0x%x, read = 0x%x, write = 0x%x\0A\09\09partition = 0x%x, interleave = 0x%x\0A\00"
define void @dump_device_geo(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 5
br i1 %3, label %4, label %31
4: ; preds = %2
%5 = getelementptr inbounds i32, i32* %0, i64 1
%6 = getelementptr inbounds i32, i32* %0, i64 2
%7 = getelementptr inbounds i32, i32* %0, i64 3
%8 = getelementptr inbounds i32, i32* %0, i64 4
%9 = getelementptr inbounds i32, i32* %0, i64 5
br label %10
10: ; preds = %4, %10
%11 = phi i32 [ %1, %4 ], [ %29, %10 ]
%12 = load i32, i32* %0
%13 = load i32, i32* %5
%14 = add nsw i32 %13, -1
%15 = shl nuw i32 1, %14
%16 = load i32, i32* %6
%17 = add nsw i32 %16, -1
%18 = shl nuw i32 1, %17
%19 = load i32, i32* %7
%20 = add nsw i32 %19, -1
%21 = shl nuw i32 1, %20
%22 = load i32, i32* %8
%23 = add nsw i32 %22, -1
%24 = shl nuw i32 1, %23
%25 = load i32, i32* %9
%26 = add nsw i32 %25, -1
%27 = shl nuw i32 1, %26
%28 = tail call i32 @printf(i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %15, i32 %18, i32 %21, i32 %24, i32 %27)
%29 = add nsw i32 %11, -6
%30 = icmp ugt i32 %11, 11
br i1 %30, label %10, label %31
31: ; preds = %10, %2
ret void
}