#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 /*<<< orphan*/ out;

/* Variables and functions */
int /*<<< orphan*/ strncat(char *, char *, int);
void decodeblock(unsigned char in[], char *clrstr) {
  unsigned char out[4];
  out[0] = in[0] << 2 | in[1] >> 4;
  out[1] = in[1] << 4 | in[2] >> 2;
  out[2] = in[2] << 6 | in[3] >> 0;
  out[3] = '\0';
  strncat((char *)clrstr, (char *)out, sizeof(out));
}


x86 assembly (clang, -O0):
<decodeblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x2,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
sar    $0x4,%ecx
or     %ecx,%eax
mov    %al,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
shl    $0x4,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
sar    $0x2,%ecx
or     %ecx,%eax
mov    %al,-0x13(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x2(%rax),%eax
shl    $0x6,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
sar    $0x0,%ecx
or     %ecx,%eax
mov    %al,-0x12(%rbp)
movb   $0x0,-0x11(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x4,%edx
call   1030 <strncat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decodeblock>:
push   %rax
mov    %rsi,%r8
mov    (%rdi),%cl
mov    0x1(%rdi),%al
shl    $0x2,%cl
mov    %eax,%edx
shr    $0x4,%dl
or     %cl,%dl
mov    %dl,0x4(%rsp)
shl    $0x4,%al
mov    0x2(%rdi),%cl
mov    %ecx,%edx
shr    $0x2,%dl
or     %al,%dl
mov    %dl,0x5(%rsp)
shl    $0x6,%cl
or     0x3(%rdi),%cl
mov    %cl,0x6(%rsp)
movb   $0x0,0x7(%rsp)
lea    0x4(%rsp),%rsi
mov    %r8,%rdi
mov    $0x4,%edx
call   1030 <strncat@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @decodeblock(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [4 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = shl i32 %9, 2
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = ashr i32 %14, 4
%16 = or i32 %10, %15
%17 = trunc i32 %16 to i8
%18 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
store i8 %17, i8* %18
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i64 1
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = shl i32 %22, 4
%24 = load i8*, i8** %3
%25 = getelementptr inbounds i8, i8* %24, i64 2
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = ashr i32 %27, 2
%29 = or i32 %23, %28
%30 = trunc i32 %29 to i8
%31 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 1
store i8 %30, i8* %31
%32 = load i8*, i8** %3
%33 = getelementptr inbounds i8, i8* %32, i64 2
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
%36 = shl i32 %35, 6
%37 = load i8*, i8** %3
%38 = getelementptr inbounds i8, i8* %37, i64 3
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = ashr i32 %40, 0
%42 = or i32 %36, %41
%43 = trunc i32 %42 to i8
%44 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 2
store i8 %43, i8* %44
%45 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 3
store i8 0, i8* %45
%46 = load i8*, i8** %4
%47 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%48 = call i32 @strncat(i8* %46, i8* %47, i32 4)
ret void
}

LLVM IR (-O2):
define void @decodeblock(i8* nocapture %0, i8* %1) {
%3 = alloca [4 x i8]
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = load i8, i8* %0
%6 = shl i8 %5, 2
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
%9 = lshr i8 %8, 4
%10 = or i8 %9, %6
store i8 %10, i8* %4
%11 = shl i8 %8, 4
%12 = getelementptr inbounds i8, i8* %0, i64 2
%13 = load i8, i8* %12
%14 = lshr i8 %13, 2
%15 = or i8 %14, %11
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
store i8 %15, i8* %16
%17 = shl i8 %13, 6
%18 = getelementptr inbounds i8, i8* %0, i64 3
%19 = load i8, i8* %18
%20 = or i8 %19, %17
%21 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
store i8 %20, i8* %21
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
store i8 0, i8* %22
%23 = call i32 @strncat(i8* %1, i8* %4, i32 4)
ret void
}