#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 _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int solcon_write_quaddobl_solution_string(int k, int n, char *s) {
  int a[2], b[n], fail, i;
  double *c;
  a[0] = k;
  a[1] = n;
  fail = _ada_use_c2phc4c(421, a, b, c, 0);
  for (i = 0; i < n; i++)
    s[i] = b[i];
  s[n] = '\0';
  return fail;
}


x86 assembly (clang, -O0):
<solcon_write_quaddobl_solution_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x40(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    -0x18(%rbp),%rsi
mov    -0x38(%rbp),%rcx
mov    $0x1a5,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a6 <solcon_write_quaddobl_solution_string+0x96>
mov    -0x40(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1174 <solcon_write_quaddobl_solution_string+0x64>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x2c(%rbp),%eax
mov    -0x20(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solcon_write_quaddobl_solution_string>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %esi,%r14d
mov    %rsp,%r12
mov    %esi,%r13d
mov    %rsp,%rbx
lea    0xf(,%r13,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %edi,-0x30(%rbp)
mov    %esi,-0x2c(%rbp)
lea    -0x30(%rbp),%rsi
mov    $0x1a5,%edi
mov    %rbx,%rdx
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
test   %r14d,%r14d
jle    1261 <solcon_write_quaddobl_solution_string+0x151>
cmp    $0x8,%r14d
jae    116f <solcon_write_quaddobl_solution_string+0x5f>
xor    %ecx,%ecx
jmp    1250 <solcon_write_quaddobl_solution_string+0x140>
mov    %r13d,%ecx
and    $0xfffffff8,%ecx
lea    -0x8(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x3,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     127b <solcon_write_quaddobl_solution_string+0x16b>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
movdqa 0xe62(%rip),%xmm0
xchg   %ax,%ax
movdqa (%rbx,%rdx,4),%xmm1
pand   %xmm0,%xmm1
packuswb %xmm1,%xmm1
packuswb %xmm1,%xmm1
movdqa 0x10(%rbx,%rdx,4),%xmm2
pand   %xmm0,%xmm2
packuswb %xmm2,%xmm2
packuswb %xmm2,%xmm2
movd   %xmm1,(%r15,%rdx,1)
movd   %xmm2,0x4(%r15,%rdx,1)
movdqa 0x20(%rbx,%rdx,4),%xmm1
pand   %xmm0,%xmm1
packuswb %xmm1,%xmm1
packuswb %xmm1,%xmm1
movdqa 0x30(%rbx,%rdx,4),%xmm2
pand   %xmm0,%xmm2
packuswb %xmm2,%xmm2
packuswb %xmm2,%xmm2
movd   %xmm1,0x8(%r15,%rdx,1)
movd   %xmm2,0xc(%r15,%rdx,1)
add    $0x10,%rdx
add    $0xfffffffffffffffe,%rdi
jne    11a0 <solcon_write_quaddobl_solution_string+0x90>
test   $0x1,%sil
je     1246 <solcon_write_quaddobl_solution_string+0x136>
movdqa 0xde6(%rip),%xmm0
movdqa (%rbx,%rdx,4),%xmm1
pand   %xmm0,%xmm1
packuswb %xmm1,%xmm1
packuswb %xmm1,%xmm1
pand   0x10(%rbx,%rdx,4),%xmm0
packuswb %xmm0,%xmm0
packuswb %xmm0,%xmm0
movd   %xmm1,(%r15,%rdx,1)
movd   %xmm0,0x4(%r15,%rdx,1)
cmp    %r13,%rcx
je     1261 <solcon_write_quaddobl_solution_string+0x151>
nopl   0x0(%rax,%rax,1)
movzbl (%rbx,%rcx,4),%edx
mov    %dl,(%r15,%rcx,1)
add    $0x1,%rcx
cmp    %rcx,%r13
jne    1250 <solcon_write_quaddobl_solution_string+0x140>
movslq %r14d,%rcx
movb   $0x0,(%r15,%rcx,1)
mov    %r12,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edx,%edx
test   $0x1,%sil
jne    1212 <solcon_write_quaddobl_solution_string+0x102>
jmp    1246 <solcon_write_quaddobl_solution_string+0x136>

LLVM IR (-O0):
define i32 @solcon_write_quaddobl_solution_string(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca [2 x i32]
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
%12 = alloca double*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%13 = load i32, i32* %5
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %8
%16 = alloca i32, i64 %14
store i64 %14, i64* %9
%17 = load i32, i32* %4
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
store i32 %17, i32* %18
%19 = load i32, i32* %5
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
store i32 %19, i32* %20
%21 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%22 = load double*, double** %12
%23 = call i32 @_ada_use_c2phc4c(i32 421, i32* %21, i32* %16, double* %22, i32 0)
store i32 %23, i32* %10
store i32 0, i32* %11
br label %24
24: ; preds = %38, %3
%25 = load i32, i32* %11
%26 = load i32, i32* %5
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %41
28: ; preds = %24
%29 = load i32, i32* %11
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %16, i64 %30
%32 = load i32, i32* %31
%33 = trunc i32 %32 to i8
%34 = load i8*, i8** %6
%35 = load i32, i32* %11
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %34, i64 %36
store i8 %33, i8* %37
br label %38
38: ; preds = %28
%39 = load i32, i32* %11
%40 = add nsw i32 %39, 1
store i32 %40, i32* %11
br label %24
41: ; preds = %24
%42 = load i8*, i8** %6
%43 = load i32, i32* %5
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
store i8 0, i8* %45
%46 = load i32, i32* %10
%47 = load i8*, i8** %8
ret i32 %46
}

LLVM IR (-O2):
define i32 @solcon_write_quaddobl_solution_string(i32 %0, i32 %1, i8* nocapture writeonly %2) {
%4 = alloca [2 x i32]
%5 = bitcast [2 x i32]* %4 to i8*
%6 = zext i32 %1 to i64
%7 = tail call i8* @llvm.stacksave()
%8 = alloca i32, i64 %6
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
store i32 %0, i32* %9
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
store i32 %1, i32* %10
%11 = call i32 @_ada_use_c2phc4c(i32 421, i32* %9, i32* %8, double* undef, i32 0)
%12 = icmp sgt i32 %1, 0
br i1 %12, label %13, label %83
13: ; preds = %3
%14 = icmp ult i32 %1, 8
br i1 %14, label %73, label %15
15: ; preds = %13
%16 = and i64 %6, 4294967288
%17 = add nsw i64 %16, -8
%18 = lshr exact i64 %17, 3
%19 = add nuw nsw i64 %18, 1
%20 = and i64 %19, 1
%21 = icmp eq i64 %17, 0
br i1 %21, label %55, label %22
22: ; preds = %15
%23 = and i64 %19, 4611686018427387902
br label %24
24: ; preds = %24, %22
%25 = phi i64 [ 0, %22 ], [ %52, %24 ]
%26 = phi i64 [ 0, %22 ], [ %53, %24 ]
%27 = getelementptr inbounds i32, i32* %8, i64 %25
%28 = bitcast i32* %27 to <4 x i32>*
%29 = load <4 x i32>, <4 x i32>* %28
%30 = getelementptr inbounds i32, i32* %27, i64 4
%31 = bitcast i32* %30 to <4 x i32>*
%32 = load <4 x i32>, <4 x i32>* %31
%33 = trunc <4 x i32> %29 to <4 x i8>
%34 = trunc <4 x i32> %32 to <4 x i8>
%35 = getelementptr inbounds i8, i8* %2, i64 %25
%36 = bitcast i8* %35 to <4 x i8>*
store <4 x i8> %33, <4 x i8>* %36
%37 = getelementptr inbounds i8, i8* %35, i64 4
%38 = bitcast i8* %37 to <4 x i8>*
store <4 x i8> %34, <4 x i8>* %38
%39 = or i64 %25, 8
%40 = getelementptr inbounds i32, i32* %8, i64 %39
%41 = bitcast i32* %40 to <4 x i32>*
%42 = load <4 x i32>, <4 x i32>* %41
%43 = getelementptr inbounds i32, i32* %40, i64 4
%44 = bitcast i32* %43 to <4 x i32>*
%45 = load <4 x i32>, <4 x i32>* %44
%46 = trunc <4 x i32> %42 to <4 x i8>
%47 = trunc <4 x i32> %45 to <4 x i8>
%48 = getelementptr inbounds i8, i8* %2, i64 %39
%49 = bitcast i8* %48 to <4 x i8>*
store <4 x i8> %46, <4 x i8>* %49
%50 = getelementptr inbounds i8, i8* %48, i64 4
%51 = bitcast i8* %50 to <4 x i8>*
store <4 x i8> %47, <4 x i8>* %51
%52 = add nuw i64 %25, 16
%53 = add i64 %26, 2
%54 = icmp eq i64 %53, %23
br i1 %54, label %55, label %24
55: ; preds = %24, %15
%56 = phi i64 [ 0, %15 ], [ %52, %24 ]
%57 = icmp eq i64 %20, 0
br i1 %57, label %71, label %58
58: ; preds = %55
%59 = getelementptr inbounds i32, i32* %8, i64 %56
%60 = bitcast i32* %59 to <4 x i32>*
%61 = load <4 x i32>, <4 x i32>* %60
%62 = getelementptr inbounds i32, i32* %59, i64 4
%63 = bitcast i32* %62 to <4 x i32>*
%64 = load <4 x i32>, <4 x i32>* %63
%65 = trunc <4 x i32> %61 to <4 x i8>
%66 = trunc <4 x i32> %64 to <4 x i8>
%67 = getelementptr inbounds i8, i8* %2, i64 %56
%68 = bitcast i8* %67 to <4 x i8>*
store <4 x i8> %65, <4 x i8>* %68
%69 = getelementptr inbounds i8, i8* %67, i64 4
%70 = bitcast i8* %69 to <4 x i8>*
store <4 x i8> %66, <4 x i8>* %70
br label %71
71: ; preds = %55, %58
%72 = icmp eq i64 %16, %6
br i1 %72, label %83, label %73
73: ; preds = %13, %71
%74 = phi i64 [ 0, %13 ], [ %16, %71 ]
br label %75
75: ; preds = %73, %75
%76 = phi i64 [ %81, %75 ], [ %74, %73 ]
%77 = getelementptr inbounds i32, i32* %8, i64 %76
%78 = load i32, i32* %77
%79 = trunc i32 %78 to i8
%80 = getelementptr inbounds i8, i8* %2, i64 %76
store i8 %79, i8* %80
%81 = add nuw nsw i64 %76, 1
%82 = icmp eq i64 %81, %6
br i1 %82, label %83, label %75
83: ; preds = %75, %71, %3
%84 = sext i32 %1 to i64
%85 = getelementptr inbounds i8, i8* %2, i64 %84
store i8 0, i8* %85
ret i32 %11
}