#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 write_next_solution_with_diagnostics(int *k, int n, int m, double *sol,
                                         int nbstep, int nbfail, int nbiter,
                                         int nbsyst) {
  int a[5], b[2], fail;
  b[0] = n;
  b[1] = m;
  a[0] = nbstep;
  a[1] = nbfail;
  a[2] = nbiter;
  a[3] = nbsyst;
  a[4] = *k;
  fail = _ada_use_c2phc(157, a, b, sol);
  if (fail == 0)
    (*k)++;
  return fail;
}


x86 assembly (clang, -O0):
<write_next_solution_with_diagnostics>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    0x10(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x18(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
lea    -0x40(%rbp),%rsi
lea    -0x48(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x9d,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x4c(%rbp)
jne    118f <write_next_solution_with_diagnostics+0x7f>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x4c(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_next_solution_with_diagnostics>:
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%rbx
mov    0x48(%rsp),%eax
mov    0x40(%rsp),%edi
mov    %esi,0x8(%rsp)
mov    %edx,0xc(%rsp)
mov    %r8d,0x10(%rsp)
mov    %r9d,0x14(%rsp)
mov    %edi,0x18(%rsp)
mov    %eax,0x1c(%rsp)
mov    (%rbx),%eax
mov    %eax,0x20(%rsp)
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    $0x9d,%edi
call   1030 <_ada_use_c2phc@plt>
test   %eax,%eax
jne    115b <write_next_solution_with_diagnostics+0x4b>
addl   $0x1,(%rbx)
add    $0x30,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @write_next_solution_with_diagnostics(i32* nocapture %0, i32 %1, i32 %2, double* %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca [5 x i32]
%10 = alloca [2 x i32]
%11 = bitcast [5 x i32]* %9 to i8*
%12 = bitcast [2 x i32]* %10 to i8*
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 0
store i32 %1, i32* %13
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 1
store i32 %2, i32* %14
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 0
store i32 %4, i32* %15
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 1
store i32 %5, i32* %16
%17 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 2
store i32 %6, i32* %17
%18 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 3
store i32 %7, i32* %18
%19 = load i32, i32* %0
%20 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 4
store i32 %19, i32* %20
%21 = call i32 @_ada_use_c2phc(i32 157, i32* %15, i32* %13, double* %3)
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %8
%24 = load i32, i32* %0
%25 = add nsw i32 %24, 1
store i32 %25, i32* %0
br label %26
26: ; preds = %23, %8
ret i32 %21
}