#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 /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ syscon_write_dobldobl_system();
int /*<<< orphan*/ syspool_copy_to_dobldobl_container(int);
int /*<<< orphan*/ syspool_dobldobl_size(int *);
void dobldobl_query_pool(void) {
  int nbr, idx;
  syspool_dobldobl_size(&nbr);
  printf("  Computed %d solution systems.\n", nbr);
  while (1) {
    printf("\nGive index for the system you want to see (0 to exit) : ");
    scanf("%d", &idx);
    if (idx <= 0)
      break;
    printf("Copying system %d to container ...\n", idx);
    syspool_copy_to_dobldobl_container(idx);
    printf("The system in the container :\n");
    syscon_write_dobldobl_system();
  }
}


x86 assembly (clang, -O0):
<dobldobl_query_pool>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1060 <syspool_dobldobl_size@plt>
mov    -0x4(%rbp),%esi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jg     119f <dobldobl_query_pool+0x4f>
jmp    11d2 <dobldobl_query_pool+0x82>
mov    -0x8(%rbp),%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
call   1050 <syspool_copy_to_dobldobl_container@plt>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <syscon_write_dobldobl_system@plt>
jmp    1172 <dobldobl_query_pool+0x22>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dobldobl_query_pool>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rdi
call   1070 <syspool_dobldobl_size@plt>
mov    0xc(%rsp),%esi
lea    0xe7e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe91(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xebd(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x8(%rsp),%esi
test   %esi,%esi
jle    121f <dobldobl_query_pool+0xbf>
lea    0xea7(%rip),%r14
lea    0xec4(%rip),%r15
lea    0xe5c(%rip),%r12
lea    0xe8f(%rip),%r13
lea    0x8(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%edi
call   1060 <syspool_copy_to_dobldobl_container@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1030 <syscon_write_dobldobl_system@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1080 <scanf@plt>
mov    0x8(%rsp),%esi
test   %esi,%esi
jg     11e0 <dobldobl_query_pool+0x80>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [33 x i8] c" Computed %d solution systems.\0A\00"
@.str.1 = [58 x i8] c"\0AGive index for the system you want to see (0 to exit) : \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [36 x i8] c"Copying system %d to container ...\0A\00"
@.str.4 = [31 x i8] c"The system in the container :\0A\00"
define void @dobldobl_query_pool() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @syspool_dobldobl_size(i32* %1)
%4 = load i32, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %6
6: ; preds = %0, %12
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %6
br label %19
12: ; preds = %6
%13 = load i32, i32* %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %2
%16 = call i32 @syspool_copy_to_dobldobl_container(i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 (...) @syscon_write_dobldobl_system()
br label %6
19: ; preds = %11
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c" Computed %d solution systems.\0A\00"
@.str.1 = [58 x i8] c"\0AGive index for the system you want to see (0 to exit) : \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [36 x i8] c"Copying system %d to container ...\0A\00"
@str = [30 x i8] c"The system in the container :\00"
define void @dobldobl_query_pool() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @syspool_dobldobl_size(i32* %1)
%6 = load i32, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 1
br i1 %11, label %23, label %12
12: ; preds = %0, %12
%13 = phi i32 [ %21, %12 ], [ %10, %0 ]
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %2
%16 = call i32 @syspool_copy_to_dobldobl_container(i32 %15)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%18 = call i32 (...) @syscon_write_dobldobl_system()
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%21 = load i32, i32* %2
%22 = icmp slt i32 %21, 1
br i1 %22, label %23, label %12
23: ; preds = %12, %0
ret void
}