#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 *, ...);
double rand_range_double(double, double);
int /*<<< orphan*/ srand(int);
void gen_model_pixels(void) {
  int i;
  srand(20050728);
  printf("static const int babl_num_model_test_pixels = %d;\n\n", 512);
  printf("static const double babl_model_test_pixels[%d] = {\n", 512 * 4);
  for (i = 0; i < 512; i++) {
    printf("%.13f"
           ", "
           "%.13f"
           ", "
           "%.13f"
           ", "
           "%.13f"
           ",\n",
           rand_range_double(-0.2, 1.2), rand_range_double(-0.2, 1.2),
           rand_range_double(-0.2, 1.2), rand_range_double(-0.2, 1.2));
  }
  printf("};\n\n");
}


x86 assembly (clang, -O0):
<gen_model_pixels>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x131f328,%edi
call   1040 <srand@plt>
lea    0xec7(%rip),%rdi
mov    $0x200,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
mov    $0x800,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x200,-0x4(%rbp)
jge    120d <gen_model_pixels+0xdd>
movsd  0xe7c(%rip),%xmm0
movsd  0xe7c(%rip),%xmm1
call   1050 <rand_range_double@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  0xe62(%rip),%xmm0
movsd  0xe62(%rip),%xmm1
call   1050 <rand_range_double@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  0xe48(%rip),%xmm0
movsd  0xe48(%rip),%xmm1
call   1050 <rand_range_double@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xe2e(%rip),%xmm0
movsd  0xe2e(%rip),%xmm1
call   1050 <rand_range_double@plt>
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x10(%rbp),%xmm0
lea    0xe80(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    116f <gen_model_pixels+0x3f>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_model_pixels>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    $0x131f328,%edi
call   1050 <srand@plt>
lea    0xeb9(%rip),%rdi
mov    $0x200,%ebp
mov    $0x200,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0x800,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef6(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  0xe68(%rip),%xmm0
movsd  0xe68(%rip),%xmm1
call   1060 <rand_range_double@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xe4d(%rip),%xmm0
movsd  0xe4d(%rip),%xmm1
call   1060 <rand_range_double@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xe32(%rip),%xmm0
movsd  0xe32(%rip),%xmm1
call   1060 <rand_range_double@plt>
movsd  %xmm0,(%rsp)
movsd  0xe18(%rip),%xmm0
movsd  0xe18(%rip),%xmm1
call   1060 <rand_range_double@plt>
movaps %xmm0,%xmm3
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  (%rsp),%xmm2
mov    $0x4,%al
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    1190 <gen_model_pixels+0x50>
lea    0xe72(%rip),%rdi
add    $0x18,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [52 x i8] c"static const int babl_num_model_test_pixels = %d;\0A\0A\00"
@.str.1 = [52 x i8] c"static const double babl_model_test_pixels[%d] = {\0A\00"
@.str.2 = [29 x i8] c"%.13f, %.13f, %.13f, %.13f,\0A\00"
@.str.3 = [5 x i8] c"};\0A\0A\00"
define void @gen_model_pixels() {
%1 = alloca i32
%2 = call i32 @srand(i32 20050728)
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 512)
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i32 2048)
store i32 0, i32* %1
br label %5
5: ; preds = %14, %0
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 512
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = call double @rand_range_double(double -2.000000e-01, double 1.200000e+00)
%10 = call double @rand_range_double(double -2.000000e-01, double 1.200000e+00)
%11 = call double @rand_range_double(double -2.000000e-01, double 1.200000e+00)
%12 = call double @rand_range_double(double -2.000000e-01, double 1.200000e+00)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), double %9, double %10, double %11, double %12)
br label %14
14: ; preds = %8
%15 = load i32, i32* %1
%16 = add nsw i32 %15, 1
store i32 %16, i32* %1
br label %5
17: ; preds = %5
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [52 x i8] c"static const int babl_num_model_test_pixels = %d;\0A\0A\00"
@.str.1 = [52 x i8] c"static const double babl_model_test_pixels[%d] = {\0A\00"
@.str.2 = [29 x i8] c"%.13f, %.13f, %.13f, %.13f,\0A\00"
@str = [4 x i8] c"};\0A\00"
define void @gen_model_pixels() {
%1 = tail call i32 @srand(i32 20050728)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 512)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i32 2048)
br label %4
4: ; preds = %0, %4
%5 = phi i32 [ 0, %0 ], [ %11, %4 ]
%6 = tail call double @rand_range_double(double -2.000000e-01, double 1.200000e+00)
%7 = tail call double @rand_range_double(double -2.000000e-01, double 1.200000e+00)
%8 = tail call double @rand_range_double(double -2.000000e-01, double 1.200000e+00)
%9 = tail call double @rand_range_double(double -2.000000e-01, double 1.200000e+00)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), double %6, double %7, double %8, double %9)
%11 = add nuw nsw i32 %5, 1
%12 = icmp eq i32 %11, 512
br i1 %12, label %13, label %4
13: ; preds = %4
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret void
}