#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 solcon_replace_standard_solution(int, int, int, double *);
int solcon_retrieve_standard_solution(int, int, int *, double *);
int standard_assign_labels(int n, int nbsols) {
  int i, j, m, fail;
  double x[2 * n + 5];
  for (i = 1; i <= nbsols; i++) {
    fail = solcon_retrieve_standard_solution(n, i, &m, x);
    m = i;
    fail = solcon_replace_standard_solution(n, i, m, x);
  }
  return fail;
}


x86 assembly (clang, -O0):
<standard_assign_labels>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%ecx
mov    %ecx,%eax
lea    0x5(%rax,%rax,1),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11ad <standard_assign_labels+0x8d>
mov    -0x30(%rbp),%rcx
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
lea    -0x14(%rbp),%rdx
call   1040 <solcon_retrieve_standard_solution@plt>
mov    -0x30(%rbp),%rcx
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <solcon_replace_standard_solution@plt>
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1162 <standard_assign_labels+0x42>
mov    -0x18(%rbp),%eax
mov    -0x20(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<standard_assign_labels>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edi,%r15d
mov    %rsp,%rcx
lea    (%r15,%r15,1),%eax
add    $0x5,%eax
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%r13
sub    %rax,%r13
mov    %r13,%rsp
test   %esi,%esi
jle    11ab <standard_assign_labels+0x8b>
mov    %esi,%r14d
mov    %rcx,-0x38(%rbp)
neg    %r14d
mov    $0x1,%ebx
lea    -0x2c(%rbp),%r12
nopw   0x0(%rax,%rax,1)
mov    %r15d,%edi
mov    %ebx,%esi
mov    %r12,%rdx
mov    %r13,%rcx
call   1040 <solcon_retrieve_standard_solution@plt>
mov    %ebx,-0x2c(%rbp)
mov    %r15d,%edi
mov    %ebx,%esi
mov    %ebx,%edx
mov    %r13,%rcx
call   1030 <solcon_replace_standard_solution@plt>
lea    (%r14,%rbx,1),%ecx
add    $0x1,%ecx
mov    %ebx,%edx
add    $0x1,%edx
mov    %edx,%ebx
cmp    $0x1,%ecx
jne    1170 <standard_assign_labels+0x50>
mov    -0x38(%rbp),%rcx
jmp    11ab <standard_assign_labels+0x8b>
mov    %rcx,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @standard_assign_labels(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
store i32 %0, i32* %3
store i32 %1, i32* %4
%11 = load i32, i32* %3
%12 = mul nsw i32 2, %11
%13 = add nsw i32 %12, 5
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %9
%16 = alloca double, i64 %14
store i64 %14, i64* %10
store i32 1, i32* %5
br label %17
17: ; preds = %30, %2
%18 = load i32, i32* %5
%19 = load i32, i32* %4
%20 = icmp sle i32 %18, %19
br i1 %20, label %21, label %33
21: ; preds = %17
%22 = load i32, i32* %3
%23 = load i32, i32* %5
%24 = call i32 @solcon_retrieve_standard_solution(i32 %22, i32 %23, i32* %7, double* %16)
store i32 %24, i32* %8
%25 = load i32, i32* %5
store i32 %25, i32* %7
%26 = load i32, i32* %3
%27 = load i32, i32* %5
%28 = load i32, i32* %7
%29 = call i32 @solcon_replace_standard_solution(i32 %26, i32 %27, i32 %28, double* %16)
store i32 %29, i32* %8
br label %30
30: ; preds = %21
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %17
33: ; preds = %17
%34 = load i32, i32* %8
%35 = load i8*, i8** %9
ret i32 %34
}

LLVM IR (-O2):
define i32 @standard_assign_labels(i32 %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = shl nsw i32 %0, 1
%6 = add nsw i32 %5, 5
%7 = zext i32 %6 to i64
%8 = tail call i8* @llvm.stacksave()
%9 = alloca double, i64 %7
%10 = icmp slt i32 %1, 1
br i1 %10, label %17, label %11
11: ; preds = %2, %11
%12 = phi i32 [ %15, %11 ], [ 1, %2 ]
%13 = call i32 @solcon_retrieve_standard_solution(i32 %0, i32 %12, i32* %3, double* %9)
store i32 %12, i32* %3
%14 = call i32 @solcon_replace_standard_solution(i32 %0, i32 %12, i32 %12, double* %9)
%15 = add nuw i32 %12, 1
%16 = icmp eq i32 %12, %1
br i1 %16, label %17, label %11
17: ; preds = %11, %2
%18 = phi i32 [ undef, %2 ], [ %14, %11 ]
ret i32 %18
}