#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_syspool(int, int *, int *, double *);
int /*<<< orphan*/ adafinal();
int /*<<< orphan*/ adainit();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  printf("\nTesting Systems Pool...\n");
  adainit();
  {
    int n, s, k, fail, *b;
    double *c;
    printf("\nGive the size of the pool : ");
    scanf("%d", &n);
    fail = _ada_use_syspool(0, &n, b, c);
    fail = _ada_use_syspool(1, &s, b, c);
    printf("The size of the pool after initialization : %d\n", s);
    printf("Give k (<= %d) : ", s);
    scanf("%d", &k);
    fail = _ada_use_syspool(2, &k, b, c);
    printf("System %d in the pool :\n", k);
    fail = _ada_use_syspool(3, &k, b, c);
  }
  adafinal();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <adainit@plt>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
xor    %edi,%edi
lea    -0x8(%rbp),%rsi
call   1030 <_ada_use_syspool@plt>
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    $0x1,%edi
lea    -0xc(%rbp),%rsi
call   1030 <_ada_use_syspool@plt>
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe4e(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    $0x2,%edi
lea    -0x10(%rbp),%rsi
call   1030 <_ada_use_syspool@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    $0x3,%edi
lea    -0x10(%rbp),%rsi
call   1030 <_ada_use_syspool@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1050 <adafinal@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xf0e(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1080 <adainit@plt>
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe8f(%rip),%r14
lea    0x14(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <_ada_use_syspool@plt>
lea    0xc(%rsp),%rsi
mov    $0x1,%edi
call   1040 <_ada_use_syspool@plt>
mov    0xc(%rsp),%esi
lea    0xe5e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
lea    0xe7c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x10(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
call   1040 <_ada_use_syspool@plt>
mov    0x10(%rsp),%esi
lea    0xe5f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x3,%edi
mov    %rbx,%rsi
call   1040 <_ada_use_syspool@plt>
xor    %eax,%eax
call   1060 <adafinal@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [26 x i8] c"\0ATesting Systems Pool...\0A\00"
@.str.1 = [30 x i8] c"\0AGive the size of the pool : \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [48 x i8] c"The size of the pool after initialization : %d\0A\00"
@.str.4 = [18 x i8] c"Give k (<= %d) : \00"
@.str.5 = [25 x i8] c"System %d in the pool :\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca double*
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (...) @adainit()
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%12 = load i32*, i32** %6
%13 = load double*, double** %7
%14 = call i32 @_ada_use_syspool(i32 0, i32* %2, i32* %12, double* %13)
store i32 %14, i32* %5
%15 = load i32*, i32** %6
%16 = load double*, double** %7
%17 = call i32 @_ada_use_syspool(i32 1, i32* %3, i32* %15, double* %16)
store i32 %17, i32* %5
%18 = load i32, i32* %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %20)
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%23 = load i32*, i32** %6
%24 = load double*, double** %7
%25 = call i32 @_ada_use_syspool(i32 2, i32* %4, i32* %23, double* %24)
store i32 %25, i32* %5
%26 = load i32, i32* %4
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %26)
%28 = load i32*, i32** %6
%29 = load double*, double** %7
%30 = call i32 @_ada_use_syspool(i32 3, i32* %4, i32* %28, double* %29)
store i32 %30, i32* %5
%31 = call i32 (...) @adafinal()
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [30 x i8] c"\0AGive the size of the pool : \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [48 x i8] c"The size of the pool after initialization : %d\0A\00"
@.str.4 = [18 x i8] c"Give k (<= %d) : \00"
@.str.5 = [25 x i8] c"System %d in the pool :\0A\00"
@str = [25 x i8] c"\0ATesting Systems Pool...\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 (...) @adainit()
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%11 = call i32 @_ada_use_syspool(i32 0, i32* %1, i32* undef, double* undef)
%12 = call i32 @_ada_use_syspool(i32 1, i32* %2, i32* undef, double* undef)
%13 = load i32, i32* %2
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %2
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %15)
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%18 = call i32 @_ada_use_syspool(i32 2, i32* %3, i32* undef, double* undef)
%19 = load i32, i32* %3
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %19)
%21 = call i32 @_ada_use_syspool(i32 3, i32* %3, i32* undef, double* undef)
%22 = call i32 (...) @adafinal()
ret i32 0
}