#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 uint;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int, int);
void PrintVpsData(const unsigned char *data) {
  uint mday, month, hour, minute;
  uint cni;
  cni = ((data[-3 + 13] & 0x3) << 10) | ((data[-3 + 14] & 0xc0) << 2) |
        ((data[-3 + 11] & 0xc0)) | (data[-3 + 14] & 0x3f);
  if ((cni != 0) && (cni != 0xfff)) {
    if (cni == 0xDC3) {
      cni = (data[-3 + 5] & 0x20) ? 0xDC1 : 0xDC2;
    }
    mday = (data[-3 + 11] & 0x3e) >> 1;
    month = ((data[-3 + 12] & 0xe0) >> 5) | ((data[-3 + 11] & 1) << 3);
    hour = (data[-3 + 12] & 0x1f);
    minute = (data[-3 + 13] >> 2);
    printf("VPS %d.%d. %02d:%02d CNI 0x%04X\n", mday, month, hour, minute, cni);
  }
}


x86 assembly (clang, -O0):
<PrintVpsData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0xa(%rax),%eax
and    $0x3,%eax
shl    $0xa,%eax
mov    -0x8(%rbp),%rcx
movzbl 0xb(%rcx),%ecx
and    $0xc0,%ecx
shl    $0x2,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x8(%rcx),%ecx
and    $0xc0,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0xb(%rcx),%ecx
and    $0x3f,%ecx
or     %ecx,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     120c <PrintVpsData+0xfc>
cmpl   $0xfff,-0x1c(%rbp)
je     120c <PrintVpsData+0xfc>
cmpl   $0xdc3,-0x1c(%rbp)
jne    119f <PrintVpsData+0x8f>
mov    -0x8(%rbp),%rax
movzbl 0x2(%rax),%edx
and    $0x20,%edx
mov    $0xdc2,%eax
mov    $0xdc1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x8(%rax),%eax
and    $0x3e,%eax
sar    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x9(%rax),%eax
and    $0xe0,%eax
sar    $0x5,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x8(%rcx),%ecx
and    $0x1,%ecx
shl    $0x3,%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x9(%rax),%eax
and    $0x1f,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0xa(%rax),%eax
sar    $0x2,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
lea    0xdf9(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintVpsData>:
movzbl 0xa(%rdi),%r8d
mov    %r8d,%eax
and    $0x3,%eax
shl    $0xa,%eax
movzbl 0xb(%rdi),%r9d
mov    %r9d,%ecx
and    $0xffffffc0,%ecx
lea    (%rax,%rcx,4),%ecx
movzbl 0x8(%rdi),%eax
mov    %eax,%edx
and    $0xffffffc0,%edx
or     %ecx,%edx
and    $0x3f,%r9d
or     %edx,%r9d
je     118e <PrintVpsData+0x7e>
cmp    $0xfff,%r9d
je     118e <PrintVpsData+0x7e>
cmp    $0xdc3,%r9d
jne    1165 <PrintVpsData+0x55>
mov    0x2(%rdi),%cl
and    $0x20,%cl
cmp    $0x1,%cl
mov    $0xdc1,%r9d
adc    $0x0,%r9d
mov    %eax,%esi
shr    %esi
and    $0x1f,%esi
movzbl 0x9(%rdi),%ecx
mov    %ecx,%edx
shr    $0x5,%edx
and    $0x1,%eax
lea    (%rdx,%rax,8),%edx
and    $0x1f,%ecx
shr    $0x2,%r8d
lea    0xe77(%rip),%rdi
jmp    1030 <printf@plt>
ret

LLVM IR (-O0):
@.str = [33 x i8] c"VPS %d.%d. %02d:%02d CNI 0x%04X\0A\00"
define void @PrintVpsData(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %2
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 10
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = and i32 %11, 3
%13 = shl i32 %12, 10
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 11
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = and i32 %17, 192
%19 = shl i32 %18, 2
%20 = or i32 %13, %19
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i64 8
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = and i32 %24, 192
%26 = or i32 %20, %25
%27 = load i8*, i8** %2
%28 = getelementptr inbounds i8, i8* %27, i64 11
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = and i32 %30, 63
%32 = or i32 %26, %31
store i32 %32, i32* %7
%33 = load i32, i32* %7
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %86
35: ; preds = %1
%36 = load i32, i32* %7
%37 = icmp ne i32 %36, 4095
br i1 %37, label %38, label %86
38: ; preds = %35
%39 = load i32, i32* %7
%40 = icmp eq i32 %39, 3523
br i1 %40, label %41, label %50
41: ; preds = %38
%42 = load i8*, i8** %2
%43 = getelementptr inbounds i8, i8* %42, i64 2
%44 = load i8, i8* %43
%45 = zext i8 %44 to i32
%46 = and i32 %45, 32
%47 = icmp ne i32 %46, 0
%48 = zext i1 %47 to i64
%49 = select i1 %47, i32 3521, i32 3522
store i32 %49, i32* %7
br label %50
50: ; preds = %41, %38
%51 = load i8*, i8** %2
%52 = getelementptr inbounds i8, i8* %51, i64 8
%53 = load i8, i8* %52
%54 = zext i8 %53 to i32
%55 = and i32 %54, 62
%56 = ashr i32 %55, 1
store i32 %56, i32* %3
%57 = load i8*, i8** %2
%58 = getelementptr inbounds i8, i8* %57, i64 9
%59 = load i8, i8* %58
%60 = zext i8 %59 to i32
%61 = and i32 %60, 224
%62 = ashr i32 %61, 5
%63 = load i8*, i8** %2
%64 = getelementptr inbounds i8, i8* %63, i64 8
%65 = load i8, i8* %64
%66 = zext i8 %65 to i32
%67 = and i32 %66, 1
%68 = shl i32 %67, 3
%69 = or i32 %62, %68
store i32 %69, i32* %4
%70 = load i8*, i8** %2
%71 = getelementptr inbounds i8, i8* %70, i64 9
%72 = load i8, i8* %71
%73 = zext i8 %72 to i32
%74 = and i32 %73, 31
store i32 %74, i32* %5
%75 = load i8*, i8** %2
%76 = getelementptr inbounds i8, i8* %75, i64 10
%77 = load i8, i8* %76
%78 = zext i8 %77 to i32
%79 = ashr i32 %78, 2
store i32 %79, i32* %6
%80 = load i32, i32* %3
%81 = load i32, i32* %4
%82 = load i32, i32* %5
%83 = load i32, i32* %6
%84 = load i32, i32* %7
%85 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %80, i32 %81, i32 %82, i32 %83, i32 %84)
br label %86
86: ; preds = %50, %35, %1
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"VPS %d.%d. %02d:%02d CNI 0x%04X\0A\00"
define void @PrintVpsData(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 10
%3 = load i8, i8* %2
%4 = and i8 %3, 3
%5 = zext i8 %4 to i32
%6 = shl nuw nsw i32 %5, 10
%7 = getelementptr inbounds i8, i8* %0, i64 11
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = shl nuw nsw i32 %9, 2
%11 = and i32 %10, 768
%12 = or i32 %11, %6
%13 = getelementptr inbounds i8, i8* %0, i64 8
%14 = load i8, i8* %13
%15 = and i8 %14, -64
%16 = zext i8 %15 to i32
%17 = or i32 %12, %16
%18 = and i32 %9, 63
%19 = or i32 %17, %18
switch i32 %19, label %26 [
i32 4095, label %42
i32 0, label %42
i32 3523, label %20
]
20: ; preds = %1
%21 = getelementptr inbounds i8, i8* %0, i64 2
%22 = load i8, i8* %21
%23 = and i8 %22, 32
%24 = icmp eq i8 %23, 0
%25 = select i1 %24, i32 3522, i32 3521
br label %26
26: ; preds = %1, %20
%27 = phi i32 [ %25, %20 ], [ %19, %1 ]
%28 = zext i8 %14 to i32
%29 = lshr i32 %28, 1
%30 = and i32 %29, 31
%31 = getelementptr inbounds i8, i8* %0, i64 9
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
%34 = lshr i32 %33, 5
%35 = shl nuw nsw i32 %28, 3
%36 = and i32 %35, 8
%37 = or i32 %34, %36
%38 = and i32 %33, 31
%39 = lshr i8 %3, 2
%40 = zext i8 %39 to i32
%41 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %30, i32 %37, i32 %38, i32 %40, i32 %27)
br label %42
42: ; preds = %1, %1, %26
ret void
}