#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 sweep_get_number_of_parameters(int *);
int sweep_get_indices_symbolically(int *nc, char *pars) {
  int fail, np;
  double *c;
  fail = sweep_get_number_of_parameters(&np);
  {
    int k, buf[np * 20];
    fail = _ada_use_c2phc(617, nc, buf, c);
    for (k = 0; k < (*nc); k++)
      pars[k] = (char)buf[k];
  }
  return fail;
}


x86 assembly (clang, -O0):
<sweep_get_indices_symbolically>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
call   1040 <sweep_get_number_of_parameters@plt>
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%ecx
shl    $0x2,%ecx
mov    %ecx,%eax
lea    (%rax,%rax,4),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rax,%rcx
shl    $0x2,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x40(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x20(%rbp),%rcx
mov    $0x269,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    (%rcx),%eax
jge    11b7 <sweep_get_indices_symbolically+0x97>
mov    -0x40(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1182 <sweep_get_indices_symbolically+0x62>
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x14(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sweep_get_indices_symbolically>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
lea    -0x24(%rbp),%rdi
call   1040 <sweep_get_number_of_parameters@plt>
mov    %rsp,%r12
mov    -0x24(%rbp),%eax
shl    $0x2,%eax
lea    (%rax,%rax,4),%eax
shl    $0x2,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
mov    $0x269,%edi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <_ada_use_c2phc@plt>
cmpl   $0x0,(%r15)
jle    1184 <sweep_get_indices_symbolically+0x64>
xor    %ecx,%ecx
nop
movzbl (%rbx,%rcx,4),%edx
mov    %dl,(%r14,%rcx,1)
add    $0x1,%rcx
movslq (%r15),%rdx
cmp    %rdx,%rcx
jl     1170 <sweep_get_indices_symbolically+0x50>
mov    %r12,%rsp
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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