#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*/ generate_directions(int, int, double *);
int /*<<< orphan*/ generate_errors(int, double *);
int /*<<< orphan*/ generate_winding_numbers(int, int *);
int /*<<< orphan*/ printf(char *, ...);
void quaddobl_generate(int nbt, int dim, int *wind, double *dir, double *err) {
  int i, j, k;
  generate_winding_numbers(nbt, wind);
  printf("The winding numbers :");
  for (k = 0; k < nbt; k++)
    printf(" %d", wind[k]);
  printf("\n");
  generate_directions(nbt, 4 * dim, dir);
  printf("The directions :\n");
  k = 0;
  for (i = 0; i < nbt; i++) {
    printf("  direction %d :", i + 1);
    for (j = 0; j < 4 * dim; j++)
      printf(" %.3e", dir[k++]);
    printf("\n");
  }
  generate_errors(4 * nbt, err);
  printf("The errors :\n");
  for (k = 0; k < 4 * nbt; k++)
    printf(" %.3e", err[k]);
  printf("\n");
}


x86 assembly (clang, -O0):
<quaddobl_generate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <generate_winding_numbers@plt>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11ae <quaddobl_generate+0x6e>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    117b <quaddobl_generate+0x3b>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
shl    $0x2,%esi
mov    -0x18(%rbp),%rdx
call   1060 <generate_directions@plt>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1271 <quaddobl_generate+0x131>
mov    -0x24(%rbp),%esi
add    $0x1,%esi
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x2,%ecx
cmp    %ecx,%eax
jge    1255 <quaddobl_generate+0x115>
mov    -0x18(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x2c(%rbp)
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xdfd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1211 <quaddobl_generate+0xd1>
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11ea <quaddobl_generate+0xaa>
mov    -0x4(%rbp),%edi
shl    $0x2,%edi
mov    -0x20(%rbp),%rsi
call   1050 <generate_errors@plt>
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
cmp    %ecx,%eax
jge    12cf <quaddobl_generate+0x18f>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xd83(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1295 <quaddobl_generate+0x155>
lea    0xd54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quaddobl_generate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,0x20(%rsp)
mov    %rcx,0x10(%rsp)
mov    %rdx,%r14
mov    %rsi,0x18(%rsp)
mov    %edi,%ebx
mov    %rdx,%rsi
call   1060 <generate_winding_numbers@plt>
lea    0xe6f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,0x8(%rsp)
test   %ebx,%ebx
jle    11c7 <quaddobl_generate+0x67>
mov    0x8(%rsp),%ebx
lea    0xe6a(%rip),%r15
xor    %ebp,%ebp
xchg   %ax,%ax
mov    (%r14,%rbp,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    11b0 <quaddobl_generate+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x18(%rsp),%rax
lea    0x0(,%rax,4),%ebp
mov    0x8(%rsp),%rbx
mov    %ebx,%edi
mov    %ebp,%esi
mov    0x10(%rsp),%rdx
call   1080 <generate_directions@plt>
lea    0xe3a(%rip),%rdi
call   1040 <puts@plt>
test   %ebx,%ebx
jle    127e <quaddobl_generate+0x11e>
cmp    $0x2,%ebp
mov    $0x1,%ebx
cmovge %ebp,%ebx
lea    0xe19(%rip),%rbp
xor    %r13d,%r13d
xor    %r15d,%r15d
jmp    1231 <quaddobl_generate+0xd1>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    0x8(%rsp),%r15d
je     127e <quaddobl_generate+0x11e>
add    $0x1,%r15d
lea    0xdde(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x0,0x18(%rsp)
jle    1220 <quaddobl_generate+0xc0>
movslq %r13d,%rax
mov    0x10(%rsp),%rcx
lea    (%rcx,%rax,8),%r14
xor    %r12d,%r12d
nopl   0x0(%rax)
movsd  (%r14,%r12,8),%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%r12
cmp    %r12d,%ebx
jne    1260 <quaddobl_generate+0x100>
add    %r12d,%r13d
jmp    1220 <quaddobl_generate+0xc0>
mov    0x8(%rsp),%rbp
lea    0x0(,%rbp,4),%ebx
mov    %ebx,%edi
mov    0x20(%rsp),%r15
mov    %r15,%rsi
call   1070 <generate_errors@plt>
lea    0xda2(%rip),%rdi
call   1040 <puts@plt>
test   %ebp,%ebp
jle    12d9 <quaddobl_generate+0x179>
cmp    $0x2,%ebx
mov    $0x1,%ebp
cmovge %ebx,%ebp
xor    %ebx,%ebx
lea    0xd6e(%rip),%r14
nopl   (%rax)
movsd  (%r15,%rbx,8),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    12c0 <quaddobl_generate+0x160>
mov    $0xa,%edi
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"The winding numbers :\00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [18 x i8] c"The directions :\0A\00"
@.str.4 = [17 x i8] c" direction %d :\00"
@.str.5 = [6 x i8] c" %.3e\00"
@.str.6 = [14 x i8] c"The errors :\0A\00"
define void @quaddobl_generate(i32 %0, i32 %1, i32* %2, double* %3, double* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32* %2, i32** %8
store double* %3, double** %9
store double* %4, double** %10
%14 = load i32, i32* %6
%15 = load i32*, i32** %8
%16 = call i32 @generate_winding_numbers(i32 %14, i32* %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %13
br label %18
18: ; preds = %29, %5
%19 = load i32, i32* %13
%20 = load i32, i32* %6
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %32
22: ; preds = %18
%23 = load i32*, i32** %8
%24 = load i32, i32* %13
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %22
%30 = load i32, i32* %13
%31 = add nsw i32 %30, 1
store i32 %31, i32* %13
br label %18
32: ; preds = %18
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%34 = load i32, i32* %6
%35 = load i32, i32* %7
%36 = mul nsw i32 4, %35
%37 = load double*, double** %9
%38 = call i32 @generate_directions(i32 %34, i32 %36, double* %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %13
store i32 0, i32* %11
br label %40
40: ; preds = %66, %32
%41 = load i32, i32* %11
%42 = load i32, i32* %6
%43 = icmp slt i32 %41, %42
br i1 %43, label %44, label %69
44: ; preds = %40
%45 = load i32, i32* %11
%46 = add nsw i32 %45, 1
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %46)
store i32 0, i32* %12
br label %48
48: ; preds = %61, %44
%49 = load i32, i32* %12
%50 = load i32, i32* %7
%51 = mul nsw i32 4, %50
%52 = icmp slt i32 %49, %51
br i1 %52, label %53, label %64
53: ; preds = %48
%54 = load double*, double** %9
%55 = load i32, i32* %13
%56 = add nsw i32 %55, 1
store i32 %56, i32* %13
%57 = sext i32 %55 to i64
%58 = getelementptr inbounds double, double* %54, i64 %57
%59 = load double, double* %58
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), double %59)
br label %61
61: ; preds = %53
%62 = load i32, i32* %12
%63 = add nsw i32 %62, 1
store i32 %63, i32* %12
br label %48
64: ; preds = %48
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %66
66: ; preds = %64
%67 = load i32, i32* %11
%68 = add nsw i32 %67, 1
store i32 %68, i32* %11
br label %40
69: ; preds = %40
%70 = load i32, i32* %6
%71 = mul nsw i32 4, %70
%72 = load double*, double** %10
%73 = call i32 @generate_errors(i32 %71, double* %72)
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %13
br label %75
75: ; preds = %87, %69
%76 = load i32, i32* %13
%77 = load i32, i32* %6
%78 = mul nsw i32 4, %77
%79 = icmp slt i32 %76, %78
br i1 %79, label %80, label %90
80: ; preds = %75
%81 = load double*, double** %10
%82 = load i32, i32* %13
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %81, i64 %83
%85 = load double, double* %84
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), double %85)
br label %87
87: ; preds = %80
%88 = load i32, i32* %13
%89 = add nsw i32 %88, 1
store i32 %89, i32* %13
br label %75
90: ; preds = %75
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"The winding numbers :\00"
@.str.1 = [4 x i8] c" %d\00"
@.str.4 = [17 x i8] c" direction %d :\00"
@.str.5 = [6 x i8] c" %.3e\00"
@str = [17 x i8] c"The directions :\00"
@str.7 = [13 x i8] c"The errors :\00"
define void @quaddobl_generate(i32 %0, i32 %1, i32* %2, double* %3, double* %4) {
%6 = tail call i32 @generate_winding_numbers(i32 %0, i32* %2)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%8 = icmp sgt i32 %0, 0
br i1 %8, label %9, label %18
9: ; preds = %5
%10 = zext i32 %0 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 0, %9 ], [ %16, %11 ]
%13 = getelementptr inbounds i32, i32* %2, i64 %12
%14 = load i32, i32* %13
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = add nuw nsw i64 %12, 1
%17 = icmp eq i64 %16, %10
br i1 %17, label %18, label %11
18: ; preds = %11, %5
%19 = tail call i32 @putchar(i32 10)
%20 = shl nsw i32 %1, 2
%21 = tail call i32 @generate_directions(i32 %0, i32 %20, double* %3)
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br i1 %8, label %23, label %48
23: ; preds = %18
%24 = icmp sgt i32 %1, 0
%25 = call i32 @llvm.smax.i32(i32 %20, i32 1)
br label %26
26: ; preds = %23, %44
%27 = phi i32 [ 0, %23 ], [ %45, %44 ]
%28 = phi i32 [ 0, %23 ], [ %29, %44 ]
%29 = add nuw nsw i32 %28, 1
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %29)
br i1 %24, label %31, label %44
31: ; preds = %26
%32 = sext i32 %27 to i64
br label %33
33: ; preds = %31, %33
%34 = phi i64 [ %32, %31 ], [ %36, %33 ]
%35 = phi i32 [ 0, %31 ], [ %40, %33 ]
%36 = add nsw i64 %34, 1
%37 = getelementptr inbounds double, double* %3, i64 %34
%38 = load double, double* %37
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), double %38)
%40 = add nuw nsw i32 %35, 1
%41 = icmp eq i32 %40, %25
br i1 %41, label %42, label %33
42: ; preds = %33
%43 = trunc i64 %36 to i32
br label %44
44: ; preds = %42, %26
%45 = phi i32 [ %27, %26 ], [ %43, %42 ]
%46 = tail call i32 @putchar(i32 10)
%47 = icmp eq i32 %29, %0
br i1 %47, label %48, label %26
48: ; preds = %44, %18
%49 = shl nsw i32 %0, 2
%50 = tail call i32 @generate_errors(i32 %49, double* %4)
%51 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.7, i64 0, i64 0))
br i1 %8, label %52, label %62
52: ; preds = %48
%53 = call i32 @llvm.smax.i32(i32 %49, i32 1)
%54 = zext i32 %53 to i64
br label %55
55: ; preds = %52, %55
%56 = phi i64 [ 0, %52 ], [ %60, %55 ]
%57 = getelementptr inbounds double, double* %4, i64 %56
%58 = load double, double* %57
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), double %58)
%60 = add nuw nsw i64 %56, 1
%61 = icmp eq i64 %60, %54
br i1 %61, label %62, label %55
62: ; preds = %55, %48
%63 = tail call i32 @putchar(i32 10)
ret void
}