#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 copy_quaddobl_laursys_witset(int);
int /*<<< orphan*/ printf(char *, int, int);
int solcon_number_of_quaddobl_solutions(int *);
int quaddobl_laursys_write(int topdim) {
  int fail, dim, len;
  for (dim = 0; dim <= topdim; dim++) {
    fail = copy_quaddobl_laursys_witset(dim);
    fail = solcon_number_of_quaddobl_solutions(&len);
    printf("-> number of points at dimension %d : %d\n", dim, len);
  }
  return fail;
}


x86 assembly (clang, -O0):
<quaddobl_laursys_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1185 <quaddobl_laursys_write+0x55>
mov    -0xc(%rbp),%edi
call   1050 <copy_quaddobl_laursys_witset@plt>
mov    %eax,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <solcon_number_of_quaddobl_solutions@plt>
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1142 <quaddobl_laursys_write+0x12>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quaddobl_laursys_write>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
test   %edi,%edi
js     1189 <quaddobl_laursys_write+0x59>
mov    %edi,%r12d
add    $0x1,%r12d
xor    %ebp,%ebp
lea    0xc(%rsp),%r14
lea    0xeab(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%edi
call   1050 <copy_quaddobl_laursys_witset@plt>
mov    %r14,%rdi
call   1030 <solcon_number_of_quaddobl_solutions@plt>
mov    %eax,%ebx
mov    0xc(%rsp),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%r12d
jne    1160 <quaddobl_laursys_write+0x30>
jmp    1189 <quaddobl_laursys_write+0x59>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"-> number of points at dimension %d : %d\0A\00"
define i32 @quaddobl_laursys_write(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %4
br label %6
6: ; preds = %17, %1
%7 = load i32, i32* %4
%8 = load i32, i32* %2
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32, i32* %4
%12 = call i32 @copy_quaddobl_laursys_witset(i32 %11)
store i32 %12, i32* %3
%13 = call i32 @solcon_number_of_quaddobl_solutions(i32* %5)
store i32 %13, i32* %3
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %6
20: ; preds = %6
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@.str = [42 x i8] c"-> number of points at dimension %d : %d\0A\00"
define i32 @quaddobl_laursys_write(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = icmp slt i32 %0, 0
br i1 %4, label %13, label %5
5: ; preds = %1, %5
%6 = phi i32 [ %11, %5 ], [ 0, %1 ]
%7 = call i32 @copy_quaddobl_laursys_witset(i32 %6)
%8 = call i32 @solcon_number_of_quaddobl_solutions(i32* %2)
%9 = load i32, i32* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %9)
%11 = add nuw i32 %6, 1
%12 = icmp eq i32 %6, %0
br i1 %12, label %13, label %5
13: ; preds = %5, %1
%14 = phi i32 [ undef, %1 ], [ %8, %5 ]
ret i32 %14
}