#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 standard_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, dim, dir);
  printf("The directions :\n");
  k = 0;
  for (i = 0; i < nbt; i++) {
    printf("  direction %d :", i + 1);
    for (j = 0; j < dim; j++)
      printf(" %.3e", dir[k++]);
    printf("\n");
  }
  generate_errors(nbt, err);
  printf("The errors :\n");
  for (k = 0; k < nbt; k++)
    printf(" %.3e", err[k]);
  printf("\n");
}


x86 assembly (clang, -O0):
<standard_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 <standard_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 <standard_generate+0x3b>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1060 <generate_directions@plt>
lea    0xe48(%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    1269 <standard_generate+0x129>
mov    -0x24(%rbp),%esi
add    $0x1,%esi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    124d <standard_generate+0x10d>
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    0xe05(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    120e <standard_generate+0xce>
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11e7 <standard_generate+0xa7>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1050 <generate_errors@plt>
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    12bf <standard_generate+0x17f>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xd93(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    128a <standard_generate+0x14a>
lea    0xd64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<standard_generate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,%r13
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %esi,%r15d
mov    %edi,%ebp
mov    %rdx,%rsi
call   1060 <generate_winding_numbers@plt>
lea    0xe75(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%r12d
test   %ebp,%ebp
jle    1298 <standard_generate+0x138>
mov    %r15d,0x8(%rsp)
mov    %r14,0x20(%rsp)
mov    %ebp,0xc(%rsp)
lea    0xe64(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rbx,%rbp,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    11c0 <standard_generate+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%r15d
mov    %r15d,%edi
mov    0x8(%rsp),%ebx
mov    %ebx,%esi
mov    0x20(%rsp),%rdx
call   1080 <generate_directions@plt>
lea    0xe32(%rip),%rdi
call   1040 <puts@plt>
test   %r15d,%r15d
jle    131b <standard_generate+0x1bb>
mov    %r12,0x10(%rsp)
mov    %r13,0x18(%rsp)
mov    %ebx,%ebp
mov    %ebx,%eax
lea    0xe09(%rip),%rbx
xor    %r13d,%r13d
xor    %r14d,%r14d
mov    %r15d,%r12d
mov    %eax,%r15d
jmp    1243 <standard_generate+0xe3>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    %r12d,%r14d
je     12c8 <standard_generate+0x168>
add    $0x1,%r14d
lea    0xdcc(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r15d,%r15d
jle    1230 <standard_generate+0xd0>
movslq %r13d,%rax
mov    0x20(%rsp),%rcx
lea    (%rcx,%rax,8),%r15
xor    %r12d,%r12d
nopl   0x0(%rax)
movsd  (%r15,%r12,8),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%r12
cmp    %r12d,%ebp
jne    1270 <standard_generate+0x110>
add    %r12d,%r13d
mov    0xc(%rsp),%r12d
mov    0x8(%rsp),%r15d
jmp    1230 <standard_generate+0xd0>
mov    %r12,0x10(%rsp)
mov    %r13,0x18(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %ebp,%edi
mov    %r15d,%esi
mov    %r14,%rdx
call   1080 <generate_directions@plt>
lea    0xd71(%rip),%rdi
call   1040 <puts@plt>
mov    %ebp,%r12d
mov    %r12d,%edi
mov    0x18(%rsp),%r15
mov    %r15,%rsi
call   1070 <generate_errors@plt>
lea    0xd63(%rip),%rdi
call   1040 <puts@plt>
test   %r12d,%r12d
mov    0x10(%rsp),%rbx
jle    1332 <standard_generate+0x1d2>
xor    %ebp,%ebp
lea    0xd34(%rip),%r14
nopw   0x0(%rax,%rax,1)
movsd  (%r15,%rbp,8),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1300 <standard_generate+0x1a0>
jmp    1332 <standard_generate+0x1d2>
mov    %r15d,%edi
mov    %r13,%rsi
call   1070 <generate_errors@plt>
lea    0xd15(%rip),%rdi
call   1040 <puts@plt>
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 @standard_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 = load double*, double** %9
%37 = call i32 @generate_directions(i32 %34, i32 %35, double* %36)
%38 = 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 %39
39: ; preds = %64, %32
%40 = load i32, i32* %11
%41 = load i32, i32* %6
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %67
43: ; preds = %39
%44 = load i32, i32* %11
%45 = add nsw i32 %44, 1
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %45)
store i32 0, i32* %12
br label %47
47: ; preds = %59, %43
%48 = load i32, i32* %12
%49 = load i32, i32* %7
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %62
51: ; preds = %47
%52 = load double*, double** %9
%53 = load i32, i32* %13
%54 = add nsw i32 %53, 1
store i32 %54, i32* %13
%55 = sext i32 %53 to i64
%56 = getelementptr inbounds double, double* %52, i64 %55
%57 = load double, double* %56
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), double %57)
br label %59
59: ; preds = %51
%60 = load i32, i32* %12
%61 = add nsw i32 %60, 1
store i32 %61, i32* %12
br label %47
62: ; preds = %47
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %64
64: ; preds = %62
%65 = load i32, i32* %11
%66 = add nsw i32 %65, 1
store i32 %66, i32* %11
br label %39
67: ; preds = %39
%68 = load i32, i32* %6
%69 = load double*, double** %10
%70 = call i32 @generate_errors(i32 %68, double* %69)
%71 = 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 %72
72: ; preds = %83, %67
%73 = load i32, i32* %13
%74 = load i32, i32* %6
%75 = icmp slt i32 %73, %74
br i1 %75, label %76, label %86
76: ; preds = %72
%77 = load double*, double** %10
%78 = load i32, i32* %13
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds double, double* %77, i64 %79
%81 = load double, double* %80
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), double %81)
br label %83
83: ; preds = %76
%84 = load i32, i32* %13
%85 = add nsw i32 %84, 1
store i32 %85, i32* %13
br label %72
86: ; preds = %72
%87 = 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 @standard_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 %46
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
%19 = tail call i32 @putchar(i32 10)
%20 = tail call i32 @generate_directions(i32 %0, i32 %1, double* %3)
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br i1 %8, label %22, label %62
22: ; preds = %18
%23 = icmp sgt i32 %1, 0
br label %24
24: ; preds = %22, %42
%25 = phi i32 [ 0, %22 ], [ %43, %42 ]
%26 = phi i32 [ 0, %22 ], [ %27, %42 ]
%27 = add nuw nsw i32 %26, 1
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %27)
br i1 %23, label %29, label %42
29: ; preds = %24
%30 = sext i32 %25 to i64
br label %31
31: ; preds = %29, %31
%32 = phi i64 [ %30, %29 ], [ %34, %31 ]
%33 = phi i32 [ 0, %29 ], [ %38, %31 ]
%34 = add nsw i64 %32, 1
%35 = getelementptr inbounds double, double* %3, i64 %32
%36 = load double, double* %35
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), double %36)
%38 = add nuw nsw i32 %33, 1
%39 = icmp eq i32 %38, %1
br i1 %39, label %40, label %31
40: ; preds = %31
%41 = trunc i64 %34 to i32
br label %42
42: ; preds = %40, %24
%43 = phi i32 [ %25, %24 ], [ %41, %40 ]
%44 = tail call i32 @putchar(i32 10)
%45 = icmp eq i32 %27, %0
br i1 %45, label %50, label %24
46: ; preds = %5
%47 = tail call i32 @putchar(i32 10)
%48 = tail call i32 @generate_directions(i32 %0, i32 %1, double* %3)
%49 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %50
50: ; preds = %42, %46
%51 = tail call i32 @generate_errors(i32 %0, double* %4)
%52 = 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 %53, label %65
53: ; preds = %50
%54 = zext i32 %0 to i64
br label %55
55: ; preds = %53, %55
%56 = phi i64 [ 0, %53 ], [ %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 %65, label %55
62: ; preds = %18
%63 = tail call i32 @generate_errors(i32 %0, double* %4)
%64 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.7, i64 0, i64 0))
br label %65
65: ; preds = %55, %62, %50
%66 = tail call i32 @putchar(i32 10)
ret void
}