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


x86 assembly (clang, -O0):
<syscon_string_of_symbols>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%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    -0x8(%rbp),%rsi
mov    -0x38(%rbp),%rcx
mov    $0x127,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    (%rcx),%eax
jge    119b <syscon_string_of_symbols+0x8b>
mov    -0x40(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1166 <syscon_string_of_symbols+0x56>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq (%rcx),%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):
<syscon_string_of_symbols>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
mov    (%rdi),%eax
mov    %rsp,%rbx
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    $0x127,%edi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <_ada_use_c2phc@plt>
mov    (%r15),%ecx
test   %ecx,%ecx
jle    1164 <syscon_string_of_symbols+0x54>
xor    %edx,%edx
movzbl (%rbx,%rdx,4),%ecx
mov    %cl,(%r14,%rdx,1)
add    $0x1,%rdx
movslq (%r15),%rcx
cmp    %rcx,%rdx
jl     1150 <syscon_string_of_symbols+0x40>
movslq %ecx,%rcx
movb   $0x0,(%r14,%rcx,1)
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @syscon_string_of_symbols(i32* %0, i8* nocapture writeonly %1) {
%3 = load i32, i32* %0
%4 = zext i32 %3 to i64
%5 = alloca i32, i64 %4
%6 = call i32 @_ada_use_c2phc(i32 295, i32* %0, i32* %5, double* undef)
%7 = load i32, i32* %0
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %2, %9
%10 = phi i64 [ %15, %9 ], [ 0, %2 ]
%11 = getelementptr inbounds i32, i32* %5, i64 %10
%12 = load i32, i32* %11
%13 = trunc i32 %12 to i8
%14 = getelementptr inbounds i8, i8* %1, i64 %10
store i8 %13, i8* %14
%15 = add nuw nsw i64 %10, 1
%16 = load i32, i32* %0
%17 = sext i32 %16 to i64
%18 = icmp slt i64 %15, %17
br i1 %18, label %9, label %19
19: ; preds = %9, %2
%20 = phi i32 [ %7, %2 ], [ %16, %9 ]
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %1, i64 %21
store i8 0, i8* %22
ret i32 %6
}