#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_c2phc(int, int *, int *, double *);
int solcon_write_current_multprec_solution_string(int *k, int n, char *s) {
  int b[n], fail, i;
  double *c;
  *k = n;
  fail = _ada_use_c2phc(535, k, b, c);
  if (*k != 0) {
    for (i = 0; i < n; i++)
      s[i] = b[i];
    s[n] = '\0';
  }
  return fail;
}


x86 assembly (clang, -O0):
<solcon_write_current_multprec_solution_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%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    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rsi
mov    -0x38(%rbp),%rcx
mov    $0x217,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
je     11ba <solcon_write_current_multprec_solution_string+0xaa>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ae <solcon_write_current_multprec_solution_string+0x9e>
mov    -0x40(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    117c <solcon_write_current_multprec_solution_string+0x6c>
mov    -0x18(%rbp),%rax
movslq -0xc(%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_current_multprec_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    %rdi,%r12
mov    %esi,%r13d
mov    %rsp,%rbx
lea    0xf(,%r13,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %esi,(%rdi)
mov    $0x217,%edi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1030 <_ada_use_c2phc@plt>
cmpl   $0x0,(%r12)
je     1279 <solcon_write_current_multprec_solution_string+0x169>
test   %r14d,%r14d
jle    1271 <solcon_write_current_multprec_solution_string+0x161>
cmp    $0x8,%r14d
jae    1172 <solcon_write_current_multprec_solution_string+0x62>
xor    %ecx,%ecx
jmp    1260 <solcon_write_current_multprec_solution_string+0x150>
mov    %r13d,%ecx
and    $0xfffffff8,%ecx
lea    -0x8(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x3,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     1288 <solcon_write_current_multprec_solution_string+0x178>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
movdqa 0xe5f(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
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    11b0 <solcon_write_current_multprec_solution_string+0xa0>
test   $0x1,%sil
je     1256 <solcon_write_current_multprec_solution_string+0x146>
movdqa 0xdd6(%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     1271 <solcon_write_current_multprec_solution_string+0x161>
nopl   0x0(%rax,%rax,1)
movzbl (%rbx,%rcx,4),%edx
mov    %dl,(%r15,%rcx,1)
add    $0x1,%rcx
cmp    %rcx,%r13
jne    1260 <solcon_write_current_multprec_solution_string+0x150>
movslq %r14d,%rcx
movb   $0x0,(%r15,%rcx,1)
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edx,%edx
test   $0x1,%sil
jne    1222 <solcon_write_current_multprec_solution_string+0x112>
jmp    1256 <solcon_write_current_multprec_solution_string+0x146>

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

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