#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_params1(uint8_t idx, const uint8_t *ptr, int len) {
  print_idx_field_unicode(idx, "Params block #1", ptr + 2, len - 2);
  do {
    printf("    | %30s: ", "Max X");
    if ((2) + 1 < len) {
      printf("%u\n", ptr[2] | ((unsigned int)ptr[(2) + 1] << 8));
    } else {
      printf("N/A\n");
    }
  } while (0);
  do {
    printf("    | %30s: ", "Max Y");
    if ((4) + 1 < len) {
      printf("%u\n", ptr[4] | ((unsigned int)ptr[(4) + 1] << 8));
    } 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_params1>:
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    $0x3,%eax
cmp    -0x14(%rbp),%eax
jge    11a8 <decode_params1+0x78>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%esi
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%eax
shl    $0x8,%eax
or     %eax,%esi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11b6 <decode_params1+0x86>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11bb <decode_params1+0x8b>
jmp    11c0 <decode_params1+0x90>
lea    0xe49(%rip),%rdi
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x5,%eax
cmp    -0x14(%rbp),%eax
jge    1209 <decode_params1+0xd9>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%esi
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%eax
shl    $0x8,%eax
or     %eax,%esi
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1217 <decode_params1+0xe7>
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    121c <decode_params1+0xec>
jmp    1221 <decode_params1+0xf1>
lea    0xde8(%rip),%rdi
lea    0xe03(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x9,%eax
cmp    -0x14(%rbp),%eax
jge    126a <decode_params1+0x13a>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%esi
mov    -0x10(%rbp),%rax
mov    0x24(%rax),%eax
shl    $0x8,%eax
or     %eax,%esi
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1278 <decode_params1+0x148>
lea    0xdb6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    127d <decode_params1+0x14d>
jmp    1282 <decode_params1+0x152>
lea    0xd87(%rip),%rdi
lea    0xdaf(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xb,%eax
cmp    -0x14(%rbp),%eax
jge    12cb <decode_params1+0x19b>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%esi
mov    -0x10(%rbp),%rax
mov    0x2c(%rax),%eax
shl    $0x8,%eax
or     %eax,%esi
lea    0xd64(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12d9 <decode_params1+0x1a9>
lea    0xd55(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12de <decode_params1+0x1ae>
lea    0xd65(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_params1>:
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rsi,%r14
lea    0x8(%rsi),%rdx
lea    -0x2(%rbx),%ecx
lea    0xeb9(%rip),%rsi
call   1050 <print_idx_field_unicode@plt>
lea    0xebd(%rip),%rdi
lea    0xec3(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x3,%ebx
jle    1226 <decode_params1+0xf6>
mov    0xc(%r14),%esi
shl    $0x8,%esi
or     0x8(%r14),%esi
lea    0xea7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe86(%rip),%rdi
lea    0xe96(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x5,%ebx
jbe    1247 <decode_params1+0x117>
mov    0x14(%r14),%esi
shl    $0x8,%esi
or     0x10(%r14),%esi
lea    0xe70(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe4f(%rip),%rdi
lea    0xe65(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x9,%ebx
jbe    1268 <decode_params1+0x138>
mov    0x24(%r14),%esi
shl    $0x8,%esi
or     0x20(%r14),%esi
lea    0xe39(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe18(%rip),%rdi
lea    0xe3b(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0xc,%ebx
jb     1289 <decode_params1+0x159>
mov    0x2c(%r14),%esi
shl    $0x8,%esi
or     0x28(%r14),%esi
lea    0xe06(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1295 <decode_params1+0x165>
lea    0xe1e(%rip),%rdi
call   1030 <puts@plt>
lea    0xdd7(%rip),%rdi
lea    0xde7(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdfd(%rip),%rdi
call   1030 <puts@plt>
lea    0xdb6(%rip),%rdi
lea    0xdcc(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xddc(%rip),%rdi
call   1030 <puts@plt>
lea    0xd95(%rip),%rdi
lea    0xdb8(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdbb(%rip),%rdi
call   1030 <puts@plt>
lea    0xda9(%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_params1(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 3, %15
br i1 %16, label %17, label %27
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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %25)
br label %29
27: ; preds = %13
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %29
29: ; preds = %27, %17
br label %30
30: ; preds = %29
br label %31
31: ; preds = %30
%32 = 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))
%33 = load i32, i32* %6
%34 = icmp slt i32 5, %33
br i1 %34, label %35, label %45
35: ; preds = %31
%36 = load i32*, i32** %5
%37 = getelementptr inbounds i32, i32* %36, i64 4
%38 = load i32, i32* %37
%39 = load i32*, i32** %5
%40 = getelementptr inbounds i32, i32* %39, i64 5
%41 = load i32, i32* %40
%42 = shl i32 %41, 8
%43 = or i32 %38, %42
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %43)
br label %47
45: ; preds = %31
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %47
47: ; preds = %45, %35
br label %48
48: ; preds = %47
br label %49
49: ; preds = %48
%50 = 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))
%51 = load i32, i32* %6
%52 = icmp slt i32 9, %51
br i1 %52, label %53, label %63
53: ; preds = %49
%54 = load i32*, i32** %5
%55 = getelementptr inbounds i32, i32* %54, i64 8
%56 = load i32, i32* %55
%57 = load i32*, i32** %5
%58 = getelementptr inbounds i32, i32* %57, i64 9
%59 = load i32, i32* %58
%60 = shl i32 %59, 8
%61 = or i32 %56, %60
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %61)
br label %65
63: ; preds = %49
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %65
65: ; preds = %63, %53
br label %66
66: ; preds = %65
br label %67
67: ; preds = %66
%68 = 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))
%69 = load i32, i32* %6
%70 = icmp slt i32 11, %69
br i1 %70, label %71, label %81
71: ; preds = %67
%72 = load i32*, i32** %5
%73 = getelementptr inbounds i32, i32* %72, i64 10
%74 = load i32, i32* %73
%75 = load i32*, i32** %5
%76 = getelementptr inbounds i32, i32* %75, i64 11
%77 = load i32, i32* %76
%78 = shl i32 %77, 8
%79 = or i32 %74, %78
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %79)
br label %83
81: ; preds = %67
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %83
83: ; preds = %81, %71
br label %84
84: ; preds = %83
%85 = 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_params1(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, 3
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 %21
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 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%19 = 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))
%20 = icmp ugt i32 %2, 5
br i1 %20, label %24, label %21
21: ; preds = %12, %9
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.11, i64 0, i64 0))
%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 ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
br label %34
24: ; preds = %12
%25 = getelementptr inbounds i32, i32* %1, i64 4
%26 = load i32, i32* %25
%27 = getelementptr inbounds i32, i32* %1, i64 5
%28 = load i32, i32* %27
%29 = shl i32 %28, 8
%30 = or i32 %29, %26
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %30)
%32 = 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))
%33 = icmp ugt i32 %2, 9
br i1 %33, label %37, label %34
34: ; preds = %24, %21
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.11, i64 0, i64 0))
%36 = 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 %55
37: ; preds = %24
%38 = getelementptr inbounds i32, i32* %1, i64 8
%39 = load i32, i32* %38
%40 = getelementptr inbounds i32, i32* %1, i64 9
%41 = load i32, i32* %40
%42 = shl i32 %41, 8
%43 = or i32 %42, %39
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %43)
%45 = 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))
%46 = icmp ugt i32 %2, 11
br i1 %46, label %47, label %55
47: ; preds = %37
%48 = getelementptr inbounds i32, i32* %1, i64 10
%49 = load i32, i32* %48
%50 = getelementptr inbounds i32, i32* %1, i64 11
%51 = load i32, i32* %50
%52 = shl i32 %51, 8
%53 = or i32 %52, %49
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %53)
br label %57
55: ; preds = %34, %37
%56 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.11, i64 0, i64 0))
br label %57
57: ; preds = %47, %55
%58 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}