#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 uint8_t;
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ bzero(int *, int);
int /*<<< orphan*/ print_format(int, int, int, int, int, int *);
int /*<<< orphan*/ printf(char *, int);
void process_format_caps(uint8_t *buf, int list_length, int verbose,
                         uint8_t *allow, uint32_t *blks, uint32_t *params) {
  uint32_t num_blks, param;
  uint8_t *fcd;
  int dscr_type, format_tp;
  int supported;
  bzero(allow, 255);
  bzero(blks, 255 * 4);
  bzero(params, 255 * 4);
  fcd = buf + 4;
  list_length -= 4;
  if (verbose)
    printf("\tCurrent/max capacity followed by additional capacity,"
           "reported length of %d bytes (8/entry)\n",
           list_length);
  while (list_length > 0) {
    num_blks = fcd[3] | (fcd[2] << 8) | (fcd[1] << 16) | (fcd[0] << 24);
    dscr_type = fcd[4] & 3;
    format_tp = fcd[4] >> 2;
    param = fcd[7] | (fcd[6] << 8) | (fcd[5] << 16);
    print_format(format_tp, num_blks, param, dscr_type, verbose, &supported);
    allow[format_tp] = 1;
    blks[format_tp] = num_blks;
    params[format_tp] = param;
    fcd += 8;
    list_length -= 8;
  }
}


x86 assembly (clang, -O0):
<process_format_caps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0xff,%esi
call   1050 <bzero@plt>
mov    -0x20(%rbp),%rdi
mov    $0x3fc,%esi
call   1050 <bzero@plt>
mov    -0x28(%rbp),%rdi
mov    $0x3fc,%esi
call   1050 <bzero@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x38(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x4,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     11a6 <process_format_caps+0x76>
mov    -0xc(%rbp),%esi
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
jmp    11ab <process_format_caps+0x7b>
cmpl   $0x0,-0xc(%rbp)
jle    127c <process_format_caps+0x14c>
mov    -0x38(%rbp),%rax
mov    0xc(%rax),%eax
mov    -0x38(%rbp),%rcx
mov    0x8(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x38(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x38(%rbp),%rcx
mov    (%rcx),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x38(%rbp),%rax
mov    0x10(%rax),%eax
and    $0x3,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%rax
mov    0x10(%rax),%eax
sar    $0x2,%eax
mov    %eax,-0x40(%rbp)
mov    -0x38(%rbp),%rax
mov    0x1c(%rax),%eax
mov    -0x38(%rbp),%rcx
mov    0x18(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x38(%rbp),%rcx
mov    0x14(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    -0x40(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    -0x30(%rbp),%edx
mov    -0x3c(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    -0x44(%rbp),%r9
call   1040 <print_format@plt>
mov    -0x18(%rbp),%rax
movslq -0x40(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x2c(%rbp),%edx
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x30(%rbp),%edx
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x38(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x38(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x8,%eax
mov    %eax,-0xc(%rbp)
jmp    11ab <process_format_caps+0x7b>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_format_caps>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%r13
mov    %edx,%r12d
mov    %esi,%ebx
mov    %rdi,%rbp
mov    %rcx,%rdi
mov    $0xff,%esi
call   1050 <bzero@plt>
mov    %r15,%rdi
mov    $0x3fc,%esi
call   1050 <bzero@plt>
mov    %r14,%rdi
mov    $0x3fc,%esi
call   1050 <bzero@plt>
mov    %r12d,%r8d
test   %r12d,%r12d
je     1193 <process_format_caps+0x63>
lea    -0x4(%rbx),%esi
lea    0xe78(%rip),%rdi
mov    %r8d,%r12d
call   1030 <printf@plt>
mov    %r12d,%r8d
cmp    $0x5,%ebx
jl     124b <process_format_caps+0x11b>
add    $0x4,%ebx
add    $0x2c,%rbp
mov    %r14,0x18(%rsp)
mov    %r13,0x10(%rsp)
mov    %r15,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
or     -0x10(%rbp),%eax
mov    -0x1c(%rbp),%r14d
mov    -0x18(%rbp),%ecx
shl    $0x10,%ecx
shl    $0x18,%r14d
or     %ecx,%r14d
or     %eax,%r14d
mov    -0xc(%rbp),%r15d
mov    %r15d,%ecx
and    $0x3,%ecx
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
or     0x0(%rbp),%eax
sar    $0x2,%r15d
mov    -0x8(%rbp),%r12d
shl    $0x10,%r12d
or     %eax,%r12d
mov    %r15d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %r8d,%r13d
lea    0x24(%rsp),%r9
call   1040 <print_format@plt>
mov    %r13d,%r8d
movslq %r15d,%rax
mov    0x8(%rsp),%r15
mov    0x10(%rsp),%r13
movl   $0x1,0x0(%r13,%rax,4)
mov    %r14d,(%r15,%rax,4)
mov    0x18(%rsp),%r14
mov    %r12d,(%r14,%rax,4)
add    $0xfffffff8,%ebx
add    $0x20,%rbp
cmp    $0x8,%ebx
ja     11c0 <process_format_caps+0x90>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [93 x i8] c"\09Current/max capacity followed by additional capacity,reported length of %d bytes (8/entry)\0A\00"
define void @process_format_caps(i32* %0, i32 %1, i32 %2, i32* %3, i32* %4, i32* %5) {
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32* %0, i32** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32* %3, i32** %10
store i32* %4, i32** %11
store i32* %5, i32** %12
%19 = load i32*, i32** %10
%20 = call i32 @bzero(i32* %19, i32 255)
%21 = load i32*, i32** %11
%22 = call i32 @bzero(i32* %21, i32 1020)
%23 = load i32*, i32** %12
%24 = call i32 @bzero(i32* %23, i32 1020)
%25 = load i32*, i32** %7
%26 = getelementptr inbounds i32, i32* %25, i64 4
store i32* %26, i32** %15
%27 = load i32, i32* %8
%28 = sub nsw i32 %27, 4
store i32 %28, i32* %8
%29 = load i32, i32* %9
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %6
%32 = load i32, i32* %8
%33 = call i32 @printf(i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %31, %6
br label %35
35: ; preds = %38, %34
%36 = load i32, i32* %8
%37 = icmp sgt i32 %36, 0
br i1 %37, label %38, label %102
38: ; preds = %35
%39 = load i32*, i32** %15
%40 = getelementptr inbounds i32, i32* %39, i64 3
%41 = load i32, i32* %40
%42 = load i32*, i32** %15
%43 = getelementptr inbounds i32, i32* %42, i64 2
%44 = load i32, i32* %43
%45 = shl i32 %44, 8
%46 = or i32 %41, %45
%47 = load i32*, i32** %15
%48 = getelementptr inbounds i32, i32* %47, i64 1
%49 = load i32, i32* %48
%50 = shl i32 %49, 16
%51 = or i32 %46, %50
%52 = load i32*, i32** %15
%53 = getelementptr inbounds i32, i32* %52, i64 0
%54 = load i32, i32* %53
%55 = shl i32 %54, 24
%56 = or i32 %51, %55
store i32 %56, i32* %13
%57 = load i32*, i32** %15
%58 = getelementptr inbounds i32, i32* %57, i64 4
%59 = load i32, i32* %58
%60 = and i32 %59, 3
store i32 %60, i32* %16
%61 = load i32*, i32** %15
%62 = getelementptr inbounds i32, i32* %61, i64 4
%63 = load i32, i32* %62
%64 = ashr i32 %63, 2
store i32 %64, i32* %17
%65 = load i32*, i32** %15
%66 = getelementptr inbounds i32, i32* %65, i64 7
%67 = load i32, i32* %66
%68 = load i32*, i32** %15
%69 = getelementptr inbounds i32, i32* %68, i64 6
%70 = load i32, i32* %69
%71 = shl i32 %70, 8
%72 = or i32 %67, %71
%73 = load i32*, i32** %15
%74 = getelementptr inbounds i32, i32* %73, i64 5
%75 = load i32, i32* %74
%76 = shl i32 %75, 16
%77 = or i32 %72, %76
store i32 %77, i32* %14
%78 = load i32, i32* %17
%79 = load i32, i32* %13
%80 = load i32, i32* %14
%81 = load i32, i32* %16
%82 = load i32, i32* %9
%83 = call i32 @print_format(i32 %78, i32 %79, i32 %80, i32 %81, i32 %82, i32* %18)
%84 = load i32*, i32** %10
%85 = load i32, i32* %17
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i32, i32* %84, i64 %86
store i32 1, i32* %87
%88 = load i32, i32* %13
%89 = load i32*, i32** %11
%90 = load i32, i32* %17
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i32, i32* %89, i64 %91
store i32 %88, i32* %92
%93 = load i32, i32* %14
%94 = load i32*, i32** %12
%95 = load i32, i32* %17
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds i32, i32* %94, i64 %96
store i32 %93, i32* %97
%98 = load i32*, i32** %15
%99 = getelementptr inbounds i32, i32* %98, i64 8
store i32* %99, i32** %15
%100 = load i32, i32* %8
%101 = sub nsw i32 %100, 8
store i32 %101, i32* %8
br label %35
102: ; preds = %35
ret void
}

LLVM IR (-O2):
@.str = [93 x i8] c"\09Current/max capacity followed by additional capacity,reported length of %d bytes (8/entry)\0A\00"
define void @process_format_caps(i32* nocapture %0, i32 %1, i32 %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4, i32* nocapture writeonly %5) {
%7 = alloca i32
%8 = bitcast i32* %7 to i8*
%9 = tail call i32 @bzero(i32* %3, i32 255)
%10 = tail call i32 @bzero(i32* %4, i32 1020)
%11 = tail call i32 @bzero(i32* %5, i32 1020)
%12 = getelementptr inbounds i32, i32* %0, i64 4
%13 = add nsw i32 %1, -4
%14 = icmp eq i32 %2, 0
br i1 %14, label %17, label %15
15: ; preds = %6
%16 = tail call i32 @printf(i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %17
17: ; preds = %15, %6
%18 = icmp sgt i32 %1, 4
br i1 %18, label %19, label %57
19: ; preds = %17, %19
%20 = phi i32 [ %55, %19 ], [ %13, %17 ]
%21 = phi i32* [ %54, %19 ], [ %12, %17 ]
%22 = getelementptr inbounds i32, i32* %21, i64 3
%23 = load i32, i32* %22
%24 = getelementptr inbounds i32, i32* %21, i64 2
%25 = load i32, i32* %24
%26 = shl i32 %25, 8
%27 = or i32 %26, %23
%28 = getelementptr inbounds i32, i32* %21, i64 1
%29 = load i32, i32* %28
%30 = shl i32 %29, 16
%31 = or i32 %27, %30
%32 = load i32, i32* %21
%33 = shl i32 %32, 24
%34 = or i32 %31, %33
%35 = getelementptr inbounds i32, i32* %21, i64 4
%36 = load i32, i32* %35
%37 = and i32 %36, 3
%38 = ashr i32 %36, 2
%39 = getelementptr inbounds i32, i32* %21, i64 7
%40 = load i32, i32* %39
%41 = getelementptr inbounds i32, i32* %21, i64 6
%42 = load i32, i32* %41
%43 = shl i32 %42, 8
%44 = or i32 %43, %40
%45 = getelementptr inbounds i32, i32* %21, i64 5
%46 = load i32, i32* %45
%47 = shl i32 %46, 16
%48 = or i32 %44, %47
%49 = call i32 @print_format(i32 %38, i32 %34, i32 %48, i32 %37, i32 %2, i32* %7)
%50 = sext i32 %38 to i64
%51 = getelementptr inbounds i32, i32* %3, i64 %50
store i32 1, i32* %51
%52 = getelementptr inbounds i32, i32* %4, i64 %50
store i32 %34, i32* %52
%53 = getelementptr inbounds i32, i32* %5, i64 %50
store i32 %48, i32* %53
%54 = getelementptr inbounds i32, i32* %21, i64 8
%55 = add nsw i32 %20, -8
%56 = icmp ugt i32 %20, 8
br i1 %56, label %19, label %57
57: ; preds = %19, %17
ret void
}