#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 */

/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned int *, double *, int);
void enc11(char *to, double x) {
  int i, j;
  unsigned int qw[2];
  memcpy(qw, &x, 8);
  to[0] = 42 + (qw[0] >> 30) + ((qw[1] >> 28) & 12);
  for (i = 0; i < 2; i++)
    for (j = 0; j < 5; j++)
      to[5 * i + j + 1] = 59 + ((qw[i] >> (6 * j)) & 63);
}


x86 assembly (clang, -O0):
<enc11>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%eax
shr    $0x1e,%eax
add    $0x2a,%eax
mov    -0x1c(%rbp),%ecx
shr    $0x1c,%ecx
and    $0xc,%ecx
add    %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    11bc <enc11+0xac>
movl   $0x0,-0x18(%rbp)
cmpl   $0x5,-0x18(%rbp)
jge    11a9 <enc11+0x99>
movslq -0x14(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
imul   $0x6,-0x18(%rbp),%ecx
shr    %cl,%eax
and    $0x3f,%eax
add    $0x3b,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
imul   $0x5,-0x14(%rbp),%ecx
add    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1167 <enc11+0x57>
jmp    11ae <enc11+0x9e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1156 <enc11+0x46>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enc11>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
mov    %rsp,%rdi
lea    0x8(%rsp),%rsi
mov    $0x8,%edx
call   1030 <memcpy@plt>
mov    (%rsp),%ecx
mov    0x4(%rsp),%eax
mov    %ecx,%edx
shr    $0x1e,%edx
mov    %eax,%esi
shr    $0x1e,%esi
lea    (%rdx,%rsi,4),%edx
add    $0x2a,%dl
mov    %dl,(%rbx)
mov    %ecx,%edx
and    $0x3f,%dl
add    $0x3b,%dl
mov    %dl,0x1(%rbx)
mov    %ecx,%edx
shr    $0x6,%edx
and    $0x3f,%dl
add    $0x3b,%dl
mov    %dl,0x2(%rbx)
mov    %ecx,%edx
shr    $0xc,%edx
and    $0x3f,%dl
add    $0x3b,%dl
mov    %dl,0x3(%rbx)
mov    %ecx,%edx
shr    $0x12,%edx
and    $0x3f,%dl
add    $0x3b,%dl
mov    %dl,0x4(%rbx)
shr    $0x18,%ecx
and    $0x3f,%cl
add    $0x3b,%cl
mov    %cl,0x5(%rbx)
mov    %eax,%ecx
and    $0x3f,%cl
add    $0x3b,%cl
mov    %cl,0x6(%rbx)
mov    %eax,%ecx
shr    $0x6,%ecx
and    $0x3f,%cl
add    $0x3b,%cl
mov    %cl,0x7(%rbx)
mov    %eax,%ecx
shr    $0xc,%ecx
and    $0x3f,%cl
add    $0x3b,%cl
mov    %cl,0x8(%rbx)
mov    %eax,%ecx
shr    $0x12,%ecx
and    $0x3f,%cl
add    $0x3b,%cl
mov    %cl,0x9(%rbx)
shr    $0x18,%eax
and    $0x3f,%al
add    $0x3b,%al
mov    %al,0xa(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @enc11(i8* %0, double %1) {
%3 = alloca i8*
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca [2 x i32]
store i8* %0, i8** %3
store double %1, double* %4
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%9 = call i32 @memcpy(i32* %8, double* %4, i32 8)
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%11 = load i32, i32* %10
%12 = lshr i32 %11, 30
%13 = add i32 42, %12
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%15 = load i32, i32* %14
%16 = lshr i32 %15, 28
%17 = and i32 %16, 12
%18 = add i32 %13, %17
%19 = trunc i32 %18 to i8
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i64 0
store i8 %19, i8* %21
store i32 0, i32* %5
br label %22
22: ; preds = %52, %2
%23 = load i32, i32* %5
%24 = icmp slt i32 %23, 2
br i1 %24, label %25, label %55
25: ; preds = %22
store i32 0, i32* %6
br label %26
26: ; preds = %48, %25
%27 = load i32, i32* %6
%28 = icmp slt i32 %27, 5
br i1 %28, label %29, label %51
29: ; preds = %26
%30 = load i32, i32* %5
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = load i32, i32* %6
%35 = mul nsw i32 6, %34
%36 = lshr i32 %33, %35
%37 = and i32 %36, 63
%38 = add i32 59, %37
%39 = trunc i32 %38 to i8
%40 = load i8*, i8** %3
%41 = load i32, i32* %5
%42 = mul nsw i32 5, %41
%43 = load i32, i32* %6
%44 = add nsw i32 %42, %43
%45 = add nsw i32 %44, 1
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %40, i64 %46
store i8 %39, i8* %47
br label %48
48: ; preds = %29
%49 = load i32, i32* %6
%50 = add nsw i32 %49, 1
store i32 %50, i32* %6
br label %26
51: ; preds = %26
br label %52
52: ; preds = %51
%53 = load i32, i32* %5
%54 = add nsw i32 %53, 1
store i32 %54, i32* %5
br label %22
55: ; preds = %22
ret void
}

LLVM IR (-O2):
define void @enc11(i8* nocapture writeonly %0, double %1) {
%3 = alloca double
%4 = alloca [2 x i32]
store double %1, double* %3
%5 = bitcast [2 x i32]* %4 to i8*
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%7 = call i32 @memcpy(i32* %6, double* %3, i32 8)
%8 = load i32, i32* %6
%9 = lshr i32 %8, 30
%10 = add nuw nsw i32 %9, 42
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%12 = load i32, i32* %11
%13 = lshr i32 %12, 28
%14 = and i32 %13, 12
%15 = add nuw nsw i32 %10, %14
%16 = trunc i32 %15 to i8
store i8 %16, i8* %0
%17 = trunc i32 %8 to i8
%18 = and i8 %17, 63
%19 = add nuw nsw i8 %18, 59
%20 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %19, i8* %20
%21 = lshr i32 %8, 6
%22 = trunc i32 %21 to i8
%23 = and i8 %22, 63
%24 = add nuw nsw i8 %23, 59
%25 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %24, i8* %25
%26 = lshr i32 %8, 12
%27 = trunc i32 %26 to i8
%28 = and i8 %27, 63
%29 = add nuw nsw i8 %28, 59
%30 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %29, i8* %30
%31 = lshr i32 %8, 18
%32 = trunc i32 %31 to i8
%33 = and i8 %32, 63
%34 = add nuw nsw i8 %33, 59
%35 = getelementptr inbounds i8, i8* %0, i64 4
store i8 %34, i8* %35
%36 = lshr i32 %8, 24
%37 = trunc i32 %36 to i8
%38 = and i8 %37, 63
%39 = add nuw nsw i8 %38, 59
%40 = getelementptr inbounds i8, i8* %0, i64 5
store i8 %39, i8* %40
%41 = trunc i32 %12 to i8
%42 = and i8 %41, 63
%43 = add nuw nsw i8 %42, 59
%44 = getelementptr inbounds i8, i8* %0, i64 6
store i8 %43, i8* %44
%45 = lshr i32 %12, 6
%46 = trunc i32 %45 to i8
%47 = and i8 %46, 63
%48 = add nuw nsw i8 %47, 59
%49 = getelementptr inbounds i8, i8* %0, i64 7
store i8 %48, i8* %49
%50 = lshr i32 %12, 12
%51 = trunc i32 %50 to i8
%52 = and i8 %51, 63
%53 = add nuw nsw i8 %52, 59
%54 = getelementptr inbounds i8, i8* %0, i64 8
store i8 %53, i8* %54
%55 = lshr i32 %12, 18
%56 = trunc i32 %55 to i8
%57 = and i8 %56, 63
%58 = add nuw nsw i8 %57, 59
%59 = getelementptr inbounds i8, i8* %0, i64 9
store i8 %58, i8* %59
%60 = lshr i32 %12, 24
%61 = trunc i32 %60 to i8
%62 = and i8 %61, 63
%63 = add nuw nsw i8 %62, 59
%64 = getelementptr inbounds i8, i8* %0, i64 10
store i8 %63, i8* %64
ret void
}