#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 /*<<< orphan*/ printf(char *, ...);
int monodromy_permutation(int d, int *done) {
  int *a, *b, fail, i;
  int permutation[d];
  int nf[2];
  double *c;
  fail = _ada_use_c2phc(52, a, permutation, c);
  if (0 > 0) {
    printf("the permutation :");
    for (i = 0; i < d; i++)
      printf(" %d", permutation[i]);
  }
  nf[0] = d;
  nf[1] = 0;
  fail = _ada_use_c2phc(53, nf, permutation, c);
  if (0 > 0)
    printf(" : %d -> %d\n", nf[0], nf[1]);
  fail = _ada_use_c2phc(55, done, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<monodromy_permutation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x50(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x48(%rbp),%rcx
mov    $0x34,%edi
call   1030 <_ada_use_c2phc@plt>
mov    -0x50(%rbp),%rdx
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x40(%rbp)
movl   $0x0,-0x3c(%rbp)
lea    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%rcx
mov    $0x35,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x48(%rbp),%rcx
mov    $0x37,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x30(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<monodromy_permutation>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%r15d
mov    %edi,%eax
mov    %rsp,%rbx
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    $0x34,%edi
mov    %rbx,%rdx
call   1030 <_ada_use_c2phc@plt>
mov    %r15d,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    -0x20(%rbp),%rsi
mov    $0x35,%edi
mov    %rbx,%rdx
call   1030 <_ada_use_c2phc@plt>
mov    $0x37,%edi
mov    %r14,%rsi
call   1030 <_ada_use_c2phc@plt>
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @monodromy_permutation(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca [2 x i32]
%12 = alloca double*
store i32 %0, i32* %3
store i32* %1, i32** %4
%13 = load i32, i32* %3
%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** %5
%18 = load double*, double** %12
%19 = call i32 @_ada_use_c2phc(i32 52, i32* %17, i32* %16, double* %18)
store i32 %19, i32* %7
%20 = load i32, i32* %3
%21 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 0
store i32 %20, i32* %21
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 1
store i32 0, i32* %22
%23 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 0
%24 = load double*, double** %12
%25 = call i32 @_ada_use_c2phc(i32 53, i32* %23, i32* %16, double* %24)
store i32 %25, i32* %7
%26 = load i32*, i32** %4
%27 = load i32*, i32** %6
%28 = load double*, double** %12
%29 = call i32 @_ada_use_c2phc(i32 55, i32* %26, i32* %27, double* %28)
store i32 %29, i32* %7
%30 = load i32, i32* %7
%31 = load i8*, i8** %9
ret i32 %30
}

LLVM IR (-O2):
define i32 @monodromy_permutation(i32 %0, i32* %1) {
%3 = alloca [2 x i32]
%4 = zext i32 %0 to i64
%5 = alloca i32, i64 %4
%6 = bitcast [2 x i32]* %3 to i8*
%7 = call i32 @_ada_use_c2phc(i32 52, i32* undef, i32* %5, double* undef)
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
store i32 %0, i32* %8
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
store i32 0, i32* %9
%10 = call i32 @_ada_use_c2phc(i32 53, i32* %8, i32* %5, double* undef)
%11 = call i32 @_ada_use_c2phc(i32 55, i32* %1, i32* undef, double* undef)
ret i32 %11
}