void Set_1562_PLL(int f, int p, int m, int a, int r, unsigned char *bits) {
  bits[0] = 0x80;
  bits[1] =
      ((p & 0x80) >> 7 | (p & 0x40) >> 5 | (p & 0x20) >> 3 | (p & 0x10) >> 1 |
       (p & 0x08) << 1 | (p & 0x04) << 3 | (p & 0x02) << 5 | (p & 0x01) << 7) >>
      4;
  bits[2] = 0x00;
  if (f <= 120000)
    bits[3] = 0x20;
  else if (f <= 200000)
    bits[3] = 0xa0;
  else
    bits[3] = 0x60;
  bits[3] |= 0x05;
  bits[4] =
      ((m & 0x80) >> 7 | (m & 0x40) >> 5 | (m & 0x20) >> 3 | (m & 0x10) >> 1 |
       (m & 0x08) << 1 | (m & 0x04) << 3 | (m & 0x02) << 5 | (m & 0x01) << 7);
  bits[5] =
      ((a & 0x80) >> 7 | (a & 0x40) >> 5 | (a & 0x20) >> 3 | (a & 0x10) >> 1 |
       (a & 0x08) << 1 | (a & 0x04) << 3 | (a & 0x02) << 5 | (a & 0x01) << 7);
  bits[6] =
      ((r & 0x80) >> 7 | (r & 0x40) >> 5 | (r & 0x20) >> 3 | (r & 0x10) >> 1 |
       (r & 0x08) << 1 | (r & 0x04) << 3 | (r & 0x02) << 5 | (r & 0x01) << 7);
}


x86 assembly (clang, -O0):
<Set_1562_PLL>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movb   $0x80,(%rax)
mov    -0x8(%rbp),%eax
and    $0x80,%eax
sar    $0x7,%eax
mov    -0x8(%rbp),%ecx
and    $0x40,%ecx
sar    $0x5,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    $0x20,%ecx
sar    $0x3,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    $0x10,%ecx
sar    $0x1,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    $0x8,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    $0x4,%ecx
shl    $0x3,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    $0x2,%ecx
shl    $0x5,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    $0x1,%ecx
shl    $0x7,%ecx
or     %ecx,%eax
sar    $0x4,%eax
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x20(%rbp),%rax
movb   $0x0,0x2(%rax)
cmpl   $0x1d4c0,-0x4(%rbp)
jg     11a5 <Set_1562_PLL+0xa5>
mov    -0x20(%rbp),%rax
movb   $0x20,0x3(%rax)
jmp    11cc <Set_1562_PLL+0xcc>
cmpl   $0x30d40,-0x4(%rbp)
jg     11bf <Set_1562_PLL+0xbf>
mov    -0x20(%rbp),%rax
movb   $0xa0,0x3(%rax)
jmp    11c7 <Set_1562_PLL+0xc7>
mov    -0x20(%rbp),%rax
movb   $0x60,0x3(%rax)
jmp    11cc <Set_1562_PLL+0xcc>
mov    -0x20(%rbp),%rax
movzbl 0x3(%rax),%ecx
or     $0x5,%ecx
mov    %cl,0x3(%rax)
mov    -0xc(%rbp),%eax
and    $0x80,%eax
sar    $0x7,%eax
mov    -0xc(%rbp),%ecx
and    $0x40,%ecx
sar    $0x5,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
and    $0x20,%ecx
sar    $0x3,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
and    $0x10,%ecx
sar    $0x1,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
and    $0x8,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
and    $0x4,%ecx
shl    $0x3,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
and    $0x2,%ecx
shl    $0x5,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
and    $0x1,%ecx
shl    $0x7,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x4(%rax)
mov    -0x10(%rbp),%eax
and    $0x80,%eax
sar    $0x7,%eax
mov    -0x10(%rbp),%ecx
and    $0x40,%ecx
sar    $0x5,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
and    $0x20,%ecx
sar    $0x3,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
and    $0x10,%ecx
sar    $0x1,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
and    $0x8,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
and    $0x4,%ecx
shl    $0x3,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
and    $0x2,%ecx
shl    $0x5,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
and    $0x1,%ecx
shl    $0x7,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x5(%rax)
mov    -0x14(%rbp),%eax
and    $0x80,%eax
sar    $0x7,%eax
mov    -0x14(%rbp),%ecx
and    $0x40,%ecx
sar    $0x5,%ecx
or     %ecx,%eax
mov    -0x14(%rbp),%ecx
and    $0x20,%ecx
sar    $0x3,%ecx
or     %ecx,%eax
mov    -0x14(%rbp),%ecx
and    $0x10,%ecx
sar    $0x1,%ecx
or     %ecx,%eax
mov    -0x14(%rbp),%ecx
and    $0x8,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
mov    -0x14(%rbp),%ecx
and    $0x4,%ecx
shl    $0x3,%ecx
or     %ecx,%eax
mov    -0x14(%rbp),%ecx
and    $0x2,%ecx
shl    $0x5,%ecx
or     %ecx,%eax
mov    -0x14(%rbp),%ecx
and    $0x1,%ecx
shl    $0x7,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x6(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Set_1562_PLL>:
movb   $0x80,(%r9)
rol    $0x4,%sil
mov    %esi,%eax
and    $0x33,%al
shl    $0x2,%al
shr    $0x2,%sil
and    $0x33,%sil
or     %al,%sil
mov    %esi,%eax
and    $0x50,%al
add    %al,%al
shr    %sil
and    $0x50,%sil
or     %al,%sil
shr    $0x4,%sil
mov    %sil,0x1(%r9)
movb   $0x0,0x2(%r9)
cmp    $0x30d41,%edi
mov    $0xa5,%eax
mov    $0x65,%esi
cmovb  %eax,%esi
cmp    $0x1d4c1,%edi
mov    $0x25,%eax
cmovge %esi,%eax
mov    %al,0x3(%r9)
rol    $0x4,%dl
mov    %edx,%eax
and    $0x33,%al
shl    $0x2,%al
shr    $0x2,%dl
and    $0x33,%dl
or     %al,%dl
mov    %edx,%eax
and    $0x55,%al
add    %al,%al
shr    %dl
and    $0x55,%dl
or     %al,%dl
mov    %dl,0x4(%r9)
rol    $0x4,%cl
mov    %ecx,%eax
and    $0x33,%al
shl    $0x2,%al
shr    $0x2,%cl
and    $0x33,%cl
or     %al,%cl
mov    %ecx,%eax
and    $0x55,%al
add    %al,%al
shr    %cl
and    $0x55,%cl
or     %al,%cl
rol    $0x4,%r8b
mov    %cl,0x5(%r9)
mov    %r8d,%eax
and    $0x33,%al
shl    $0x2,%al
shr    $0x2,%r8b
and    $0x33,%r8b
or     %al,%r8b
mov    %r8d,%eax
and    $0x55,%al
add    %al,%al
shr    %r8b
and    $0x55,%r8b
or     %al,%r8b
mov    %r8b,0x6(%r9)
ret

LLVM IR (-O0):
define void @Set_1562_PLL(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i8* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
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 i8* %5, i8** %12
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8, i8* %13, i64 0
store i8 -128, i8* %14
%15 = load i32, i32* %8
%16 = and i32 %15, 128
%17 = ashr i32 %16, 7
%18 = load i32, i32* %8
%19 = and i32 %18, 64
%20 = ashr i32 %19, 5
%21 = or i32 %17, %20
%22 = load i32, i32* %8
%23 = and i32 %22, 32
%24 = ashr i32 %23, 3
%25 = or i32 %21, %24
%26 = load i32, i32* %8
%27 = and i32 %26, 16
%28 = ashr i32 %27, 1
%29 = or i32 %25, %28
%30 = load i32, i32* %8
%31 = and i32 %30, 8
%32 = shl i32 %31, 1
%33 = or i32 %29, %32
%34 = load i32, i32* %8
%35 = and i32 %34, 4
%36 = shl i32 %35, 3
%37 = or i32 %33, %36
%38 = load i32, i32* %8
%39 = and i32 %38, 2
%40 = shl i32 %39, 5
%41 = or i32 %37, %40
%42 = load i32, i32* %8
%43 = and i32 %42, 1
%44 = shl i32 %43, 7
%45 = or i32 %41, %44
%46 = ashr i32 %45, 4
%47 = trunc i32 %46 to i8
%48 = load i8*, i8** %12
%49 = getelementptr inbounds i8, i8* %48, i64 1
store i8 %47, i8* %49
%50 = load i8*, i8** %12
%51 = getelementptr inbounds i8, i8* %50, i64 2
store i8 0, i8* %51
%52 = load i32, i32* %7
%53 = icmp sle i32 %52, 120000
br i1 %53, label %54, label %57
54: ; preds = %6
%55 = load i8*, i8** %12
%56 = getelementptr inbounds i8, i8* %55, i64 3
store i8 32, i8* %56
br label %67
57: ; preds = %6
%58 = load i32, i32* %7
%59 = icmp sle i32 %58, 200000
br i1 %59, label %60, label %63
60: ; preds = %57
%61 = load i8*, i8** %12
%62 = getelementptr inbounds i8, i8* %61, i64 3
store i8 -96, i8* %62
br label %66
63: ; preds = %57
%64 = load i8*, i8** %12
%65 = getelementptr inbounds i8, i8* %64, i64 3
store i8 96, i8* %65
br label %66
66: ; preds = %63, %60
br label %67
67: ; preds = %66, %54
%68 = load i8*, i8** %12
%69 = getelementptr inbounds i8, i8* %68, i64 3
%70 = load i8, i8* %69
%71 = zext i8 %70 to i32
%72 = or i32 %71, 5
%73 = trunc i32 %72 to i8
store i8 %73, i8* %69
%74 = load i32, i32* %9
%75 = and i32 %74, 128
%76 = ashr i32 %75, 7
%77 = load i32, i32* %9
%78 = and i32 %77, 64
%79 = ashr i32 %78, 5
%80 = or i32 %76, %79
%81 = load i32, i32* %9
%82 = and i32 %81, 32
%83 = ashr i32 %82, 3
%84 = or i32 %80, %83
%85 = load i32, i32* %9
%86 = and i32 %85, 16
%87 = ashr i32 %86, 1
%88 = or i32 %84, %87
%89 = load i32, i32* %9
%90 = and i32 %89, 8
%91 = shl i32 %90, 1
%92 = or i32 %88, %91
%93 = load i32, i32* %9
%94 = and i32 %93, 4
%95 = shl i32 %94, 3
%96 = or i32 %92, %95
%97 = load i32, i32* %9
%98 = and i32 %97, 2
%99 = shl i32 %98, 5
%100 = or i32 %96, %99
%101 = load i32, i32* %9
%102 = and i32 %101, 1
%103 = shl i32 %102, 7
%104 = or i32 %100, %103
%105 = trunc i32 %104 to i8
%106 = load i8*, i8** %12
%107 = getelementptr inbounds i8, i8* %106, i64 4
store i8 %105, i8* %107
%108 = load i32, i32* %10
%109 = and i32 %108, 128
%110 = ashr i32 %109, 7
%111 = load i32, i32* %10
%112 = and i32 %111, 64
%113 = ashr i32 %112, 5
%114 = or i32 %110, %113
%115 = load i32, i32* %10
%116 = and i32 %115, 32
%117 = ashr i32 %116, 3
%118 = or i32 %114, %117
%119 = load i32, i32* %10
%120 = and i32 %119, 16
%121 = ashr i32 %120, 1
%122 = or i32 %118, %121
%123 = load i32, i32* %10
%124 = and i32 %123, 8
%125 = shl i32 %124, 1
%126 = or i32 %122, %125
%127 = load i32, i32* %10
%128 = and i32 %127, 4
%129 = shl i32 %128, 3
%130 = or i32 %126, %129
%131 = load i32, i32* %10
%132 = and i32 %131, 2
%133 = shl i32 %132, 5
%134 = or i32 %130, %133
%135 = load i32, i32* %10
%136 = and i32 %135, 1
%137 = shl i32 %136, 7
%138 = or i32 %134, %137
%139 = trunc i32 %138 to i8
%140 = load i8*, i8** %12
%141 = getelementptr inbounds i8, i8* %140, i64 5
store i8 %139, i8* %141
%142 = load i32, i32* %11
%143 = and i32 %142, 128
%144 = ashr i32 %143, 7
%145 = load i32, i32* %11
%146 = and i32 %145, 64
%147 = ashr i32 %146, 5
%148 = or i32 %144, %147
%149 = load i32, i32* %11
%150 = and i32 %149, 32
%151 = ashr i32 %150, 3
%152 = or i32 %148, %151
%153 = load i32, i32* %11
%154 = and i32 %153, 16
%155 = ashr i32 %154, 1
%156 = or i32 %152, %155
%157 = load i32, i32* %11
%158 = and i32 %157, 8
%159 = shl i32 %158, 1
%160 = or i32 %156, %159
%161 = load i32, i32* %11
%162 = and i32 %161, 4
%163 = shl i32 %162, 3
%164 = or i32 %160, %163
%165 = load i32, i32* %11
%166 = and i32 %165, 2
%167 = shl i32 %166, 5
%168 = or i32 %164, %167
%169 = load i32, i32* %11
%170 = and i32 %169, 1
%171 = shl i32 %170, 7
%172 = or i32 %168, %171
%173 = trunc i32 %172 to i8
%174 = load i8*, i8** %12
%175 = getelementptr inbounds i8, i8* %174, i64 6
store i8 %173, i8* %175
ret void
}

LLVM IR (-O2):
define void @Set_1562_PLL(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i8* nocapture %5) {
store i8 -128, i8* %5
%7 = trunc i32 %1 to i8
%8 = tail call i8 @llvm.bitreverse.i8(i8 %7)
%9 = lshr i8 %8, 4
%10 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %9, i8* %10
%11 = getelementptr inbounds i8, i8* %5, i64 2
store i8 0, i8* %11
%12 = icmp slt i32 %0, 120001
%13 = icmp ult i32 %0, 200001
%14 = select i1 %13, i8 -91, i8 101
%15 = select i1 %12, i8 37, i8 %14
%16 = getelementptr inbounds i8, i8* %5, i64 3
store i8 %15, i8* %16
%17 = trunc i32 %2 to i8
%18 = tail call i8 @llvm.bitreverse.i8(i8 %17)
%19 = getelementptr inbounds i8, i8* %5, i64 4
store i8 %18, i8* %19
%20 = trunc i32 %3 to i8
%21 = tail call i8 @llvm.bitreverse.i8(i8 %20)
%22 = getelementptr inbounds i8, i8* %5, i64 5
store i8 %21, i8* %22
%23 = trunc i32 %4 to i8
%24 = tail call i8 @llvm.bitreverse.i8(i8 %23)
%25 = getelementptr inbounds i8, i8* %5, i64 6
store i8 %24, i8* %25
ret void
}