#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_dobldobl_solution(int, int, int, double *);
int solcon_retrieve_dobldobl_solution(int, int, int *, double *);
int dobldobl_assign_labels(int n, int nbsols) {
  int i, j, m, fail;
  double x[4 * n + 10];
  for (i = 1; i <= nbsols; i++) {
    fail = solcon_retrieve_dobldobl_solution(n, i, &m, x);
    m = i;
    fail = solcon_replace_dobldobl_solution(n, i, m, x);
  }
  return fail;
}


x86 assembly (clang, -O0):
<dobldobl_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    0xa(,%rax,4),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rdx
shl    $0x3,%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     11ab <dobldobl_assign_labels+0x8b>
mov    -0x30(%rbp),%rcx
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
lea    -0x14(%rbp),%rdx
call   1040 <solcon_retrieve_dobldobl_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_dobldobl_solution@plt>
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1160 <dobldobl_assign_labels+0x40>
mov    -0x18(%rbp),%eax
mov    -0x20(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dobldobl_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    0xa(,%r15,4),%eax
shl    $0x3,%rax
mov    %rsp,%r13
sub    %rax,%r13
mov    %r13,%rsp
test   %esi,%esi
jle    11ab <dobldobl_assign_labels+0x8b>
mov    %esi,%r14d
mov    %rcx,-0x38(%rbp)
neg    %r14d
mov    $0x1,%ebx
lea    -0x2c(%rbp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15d,%edi
mov    %ebx,%esi
mov    %r12,%rdx
mov    %r13,%rcx
call   1040 <solcon_retrieve_dobldobl_solution@plt>
mov    %ebx,-0x2c(%rbp)
mov    %r15d,%edi
mov    %ebx,%esi
mov    %ebx,%edx
mov    %r13,%rcx
call   1030 <solcon_replace_dobldobl_solution@plt>
lea    (%r14,%rbx,1),%ecx
add    $0x1,%ecx
mov    %ebx,%edx
add    $0x1,%edx
mov    %edx,%ebx
cmp    $0x1,%ecx
jne    1170 <dobldobl_assign_labels+0x50>
mov    -0x38(%rbp),%rcx
jmp    11ab <dobldobl_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 @dobldobl_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 4, %11
%13 = add nsw i32 %12, 10
%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_dobldobl_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_dobldobl_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 @dobldobl_assign_labels(i32 %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = shl nsw i32 %0, 2
%6 = add nsw i32 %5, 10
%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_dobldobl_solution(i32 %0, i32 %12, i32* %3, double* %9)
store i32 %12, i32* %3
%14 = call i32 @solcon_replace_dobldobl_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
}