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

/* Variables and functions */
int /*<<< orphan*/ print_idx_field_unicode(unsigned int, char *,
                                           unsigned int const *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int decode_params2(uint8_t idx, const uint8_t *ptr, int len) {
  print_idx_field_unicode(idx, "Params block #2", ptr + 2, len - 2);
  do {
    printf("    | %30s: ", "Max X");
    if ((2) + 2 < len) {
      printf("%u\n", ptr[2] | ((unsigned int)ptr[(2) + 1] << 8) |
                         ((unsigned int)ptr[(2) + 2] << 16));
    } else {
      printf("N/A\n");
    }
  } while (0);
  do {
    printf("    | %30s: ", "Max Y");
    if ((5) + 2 < len) {
      printf("%u\n", ptr[5] | ((unsigned int)ptr[(5) + 1] << 8) |
                         ((unsigned int)ptr[(5) + 2] << 16));
    } else {
      printf("N/A\n");
    }
  } while (0);
  do {
    printf("    | %30s: ", "Max pressure");
    if ((8) + 1 < len) {
      printf("%u\n", ptr[8] | ((unsigned int)ptr[(8) + 1] << 8));
    } else {
      printf("N/A\n");
    }
  } while (0);
  do {
    printf("    | %30s: ", "Resolution");
    if ((10) + 1 < len) {
      printf("%u\n", ptr[10] | ((unsigned int)ptr[(10) + 1] << 8));
    } else {
      printf("N/A\n");
    }
  } while (0);
  puts("    |");
  return 0;
}


x86 assembly (clang, -O0):
<decode_params2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
add    $0x8,%rdx
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
lea    0xea6(%rip),%rsi
call   1050 <print_idx_field_unicode@plt>
lea    0xeaa(%rip),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x4,%eax
cmp    -0x14(%rbp),%eax
jge    11b4 <decode_params2+0x84>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%esi
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%eax
shl    $0x8,%eax
or     %eax,%esi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%eax
shl    $0x10,%eax
or     %eax,%esi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11c2 <decode_params2+0x92>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11c7 <decode_params2+0x97>
jmp    11cc <decode_params2+0x9c>
lea    0xe3d(%rip),%rdi
lea    0xe52(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7,%eax
cmp    -0x14(%rbp),%eax
jge    1221 <decode_params2+0xf1>
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%esi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%eax
shl    $0x8,%eax
or     %eax,%esi
mov    -0x10(%rbp),%rax
mov    0x1c(%rax),%eax
shl    $0x10,%eax
or     %eax,%esi
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    122f <decode_params2+0xff>
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1234 <decode_params2+0x104>
jmp    1239 <decode_params2+0x109>
lea    0xdd0(%rip),%rdi
lea    0xdeb(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x9,%eax
cmp    -0x14(%rbp),%eax
jge    1282 <decode_params2+0x152>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%esi
mov    -0x10(%rbp),%rax
mov    0x24(%rax),%eax
shl    $0x8,%eax
or     %eax,%esi
lea    0xdad(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1290 <decode_params2+0x160>
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1295 <decode_params2+0x165>
jmp    129a <decode_params2+0x16a>
lea    0xd6f(%rip),%rdi
lea    0xd97(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xb,%eax
cmp    -0x14(%rbp),%eax
jge    12e3 <decode_params2+0x1b3>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%esi
mov    -0x10(%rbp),%rax
mov    0x2c(%rax),%eax
shl    $0x8,%eax
or     %eax,%esi
lea    0xd4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12f1 <decode_params2+0x1c1>
lea    0xd3d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12f6 <decode_params2+0x1c6>
lea    0xd4d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_params2>:
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%rbx
lea    0x8(%rsi),%rdx
lea    -0x2(%r14),%ecx
lea    0xeb7(%rip),%rsi
call   1050 <print_idx_field_unicode@plt>
lea    0xebb(%rip),%rdi
lea    0xec1(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x4,%r14d
jle    1234 <decode_params2+0x104>
mov    0xc(%rbx),%eax
mov    0x10(%rbx),%esi
shl    $0x8,%eax
or     0x8(%rbx),%eax
shl    $0x10,%esi
or     %eax,%esi
lea    0xe9e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe7d(%rip),%rdi
lea    0xe8d(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x7,%r14d
jbe    1255 <decode_params2+0x125>
mov    0x18(%rbx),%eax
mov    0x1c(%rbx),%esi
shl    $0x8,%eax
or     0x14(%rbx),%eax
shl    $0x10,%esi
or     %eax,%esi
lea    0xe60(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe3f(%rip),%rdi
lea    0xe55(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x9,%r14d
jbe    1276 <decode_params2+0x146>
mov    0x24(%rbx),%esi
shl    $0x8,%esi
or     0x20(%rbx),%esi
lea    0xe2a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe09(%rip),%rdi
lea    0xe2c(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0xc,%r14d
jb     1297 <decode_params2+0x167>
mov    0x2c(%rbx),%esi
shl    $0x8,%esi
or     0x28(%rbx),%esi
lea    0xdf8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    12a3 <decode_params2+0x173>
lea    0xe10(%rip),%rdi
call   1030 <puts@plt>
lea    0xdc9(%rip),%rdi
lea    0xdd9(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdef(%rip),%rdi
call   1030 <puts@plt>
lea    0xda8(%rip),%rdi
lea    0xdbe(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdce(%rip),%rdi
call   1030 <puts@plt>
lea    0xd87(%rip),%rdi
lea    0xdaa(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdad(%rip),%rdi
call   1030 <puts@plt>
lea    0xd9b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Params block\00"
@.str.1 = [13 x i8] c" | %30s: \00"
@.str.2 = [6 x i8] c"Max X\00"
@.str.3 = [4 x i8] c"%u\0A\00"
@.str.4 = [5 x i8] c"N/A\0A\00"
@.str.5 = [6 x i8] c"Max Y\00"
@.str.6 = [13 x i8] c"Max pressure\00"
@.str.7 = [11 x i8] c"Resolution\00"
@.str.8 = [6 x i8] c" |\00"
define i32 @decode_params2(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32*, i32** %5
%9 = getelementptr inbounds i32, i32* %8, i64 2
%10 = load i32, i32* %6
%11 = sub nsw i32 %10, 2
%12 = call i32 @print_idx_field_unicode(i32 %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32* %9, i32 %11)
br label %13
13: ; preds = %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%15 = load i32, i32* %6
%16 = icmp slt i32 4, %15
br i1 %16, label %17, label %32
17: ; preds = %13
%18 = load i32*, i32** %5
%19 = getelementptr inbounds i32, i32* %18, i64 2
%20 = load i32, i32* %19
%21 = load i32*, i32** %5
%22 = getelementptr inbounds i32, i32* %21, i64 3
%23 = load i32, i32* %22
%24 = shl i32 %23, 8
%25 = or i32 %20, %24
%26 = load i32*, i32** %5
%27 = getelementptr inbounds i32, i32* %26, i64 4
%28 = load i32, i32* %27
%29 = shl i32 %28, 16
%30 = or i32 %25, %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %30)
br label %34
32: ; preds = %13
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %34
34: ; preds = %32, %17
br label %35
35: ; preds = %34
br label %36
36: ; preds = %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%38 = load i32, i32* %6
%39 = icmp slt i32 7, %38
br i1 %39, label %40, label %55
40: ; preds = %36
%41 = load i32*, i32** %5
%42 = getelementptr inbounds i32, i32* %41, i64 5
%43 = load i32, i32* %42
%44 = load i32*, i32** %5
%45 = getelementptr inbounds i32, i32* %44, i64 6
%46 = load i32, i32* %45
%47 = shl i32 %46, 8
%48 = or i32 %43, %47
%49 = load i32*, i32** %5
%50 = getelementptr inbounds i32, i32* %49, i64 7
%51 = load i32, i32* %50
%52 = shl i32 %51, 16
%53 = or i32 %48, %52
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %53)
br label %57
55: ; preds = %36
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %57
57: ; preds = %55, %40
br label %58
58: ; preds = %57
br label %59
59: ; preds = %58
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%61 = load i32, i32* %6
%62 = icmp slt i32 9, %61
br i1 %62, label %63, label %73
63: ; preds = %59
%64 = load i32*, i32** %5
%65 = getelementptr inbounds i32, i32* %64, i64 8
%66 = load i32, i32* %65
%67 = load i32*, i32** %5
%68 = getelementptr inbounds i32, i32* %67, i64 9
%69 = load i32, i32* %68
%70 = shl i32 %69, 8
%71 = or i32 %66, %70
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %71)
br label %75
73: ; preds = %59
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %75
75: ; preds = %73, %63
br label %76
76: ; preds = %75
br label %77
77: ; preds = %76
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%79 = load i32, i32* %6
%80 = icmp slt i32 11, %79
br i1 %80, label %81, label %91
81: ; preds = %77
%82 = load i32*, i32** %5
%83 = getelementptr inbounds i32, i32* %82, i64 10
%84 = load i32, i32* %83
%85 = load i32*, i32** %5
%86 = getelementptr inbounds i32, i32* %85, i64 11
%87 = load i32, i32* %86
%88 = shl i32 %87, 8
%89 = or i32 %84, %88
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %89)
br label %93
91: ; preds = %77
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %93
93: ; preds = %91, %81
br label %94
94: ; preds = %93
%95 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Params block\00"
@.str.1 = [13 x i8] c" | %30s: \00"
@.str.2 = [6 x i8] c"Max X\00"
@.str.3 = [4 x i8] c"%u\0A\00"
@.str.5 = [6 x i8] c"Max Y\00"
@.str.6 = [13 x i8] c"Max pressure\00"
@.str.7 = [11 x i8] c"Resolution\00"
@.str.8 = [6 x i8] c" |\00"
@str.11 = [4 x i8] c"N/A\00"
define i32 @decode_params2(i32 %0, i32* %1, i32 %2) {
%4 = getelementptr inbounds i32, i32* %1, i64 2
%5 = add nsw i32 %2, -2
%6 = tail call i32 @print_idx_field_unicode(i32 %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32* %4, i32 %5)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp sgt i32 %2, 4
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.11, i64 0, i64 0))
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %25
12: ; preds = %3
%13 = load i32, i32* %4
%14 = getelementptr inbounds i32, i32* %1, i64 3
%15 = load i32, i32* %14
%16 = shl i32 %15, 8
%17 = or i32 %16, %13
%18 = getelementptr inbounds i32, i32* %1, i64 4
%19 = load i32, i32* %18
%20 = shl i32 %19, 16
%21 = or i32 %17, %20
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%24 = icmp ugt i32 %2, 7
br i1 %24, label %28, label %25
25: ; preds = %12, %9
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.11, i64 0, i64 0))
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
br label %42
28: ; preds = %12
%29 = getelementptr inbounds i32, i32* %1, i64 5
%30 = load i32, i32* %29
%31 = getelementptr inbounds i32, i32* %1, i64 6
%32 = load i32, i32* %31
%33 = shl i32 %32, 8
%34 = or i32 %33, %30
%35 = getelementptr inbounds i32, i32* %1, i64 7
%36 = load i32, i32* %35
%37 = shl i32 %36, 16
%38 = or i32 %34, %37
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %38)
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%41 = icmp ugt i32 %2, 9
br i1 %41, label %45, label %42
42: ; preds = %28, %25
%43 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.11, i64 0, i64 0))
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
br label %63
45: ; preds = %28
%46 = getelementptr inbounds i32, i32* %1, i64 8
%47 = load i32, i32* %46
%48 = getelementptr inbounds i32, i32* %1, i64 9
%49 = load i32, i32* %48
%50 = shl i32 %49, 8
%51 = or i32 %50, %47
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %51)
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%54 = icmp ugt i32 %2, 11
br i1 %54, label %55, label %63
55: ; preds = %45
%56 = getelementptr inbounds i32, i32* %1, i64 10
%57 = load i32, i32* %56
%58 = getelementptr inbounds i32, i32* %1, i64 11
%59 = load i32, i32* %58
%60 = shl i32 %59, 8
%61 = or i32 %60, %57
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %61)
br label %65
63: ; preds = %42, %45
%64 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.11, i64 0, i64 0))
br label %65
65: ; preds = %55, %63
%66 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}