#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*/ srandom(int);
void gen_type_pixels(void) {
  int i;
  srandom(20050728);
  printf("static const int babl_num_type_test_pixels = %d;\n\n", 512);
  printf("static const double babl_type_test_pixels[%d] = {\n", 512 * 4);
  for (i = 0; i < 512; i++) {
    printf("%a, %a, %a, %a,\n", rand_range_double(0.0, 128.0),
           rand_range_double(0.0, 128.0), rand_range_double(0.0, 128.0),
           rand_range_double(0.0, 128.0));
  }
  printf("};\n\n");
}


x86 assembly (clang, -O0):
<gen_type_pixels>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x131f328,%edi
call   1030 <srandom@plt>
lea    0xebf(%rip),%rdi
mov    $0x200,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xedf(%rip),%rdi
mov    $0x800,%esi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x200,-0x4(%rbp)
jge    11f9 <gen_type_pixels+0xc9>
xorps  %xmm0,%xmm0
movsd  0xe79(%rip),%xmm1
call   1050 <rand_range_double@plt>
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  0xe64(%rip),%xmm1
call   1050 <rand_range_double@plt>
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  0xe4f(%rip),%xmm1
call   1050 <rand_range_double@plt>
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  0xe3a(%rip),%xmm1
call   1050 <rand_range_double@plt>
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x10(%rbp),%xmm0
lea    0xe8a(%rip),%rdi
mov    $0x4,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    116f <gen_type_pixels+0x3f>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_type_pixels>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    $0x131f328,%edi
call   1030 <srandom@plt>
lea    0xeb1(%rip),%rdi
mov    $0x200,%ebp
mov    $0x200,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xecc(%rip),%rdi
mov    $0x800,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeec(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xorps  %xmm0,%xmm0
movsd  0xe65(%rip),%xmm1
call   1060 <rand_range_double@plt>
movsd  %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
movsd  0xe4f(%rip),%xmm1
call   1060 <rand_range_double@plt>
movsd  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
movsd  0xe39(%rip),%xmm1
call   1060 <rand_range_double@plt>
movsd  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
movsd  0xe24(%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   1050 <printf@plt>
add    $0xffffffff,%ebp
jne    1190 <gen_type_pixels+0x50>
lea    0xe74(%rip),%rdi
add    $0x18,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [51 x i8] c"static const int babl_num_type_test_pixels = %d;\0A\0A\00"
@.str.1 = [51 x i8] c"static const double babl_type_test_pixels[%d] = {\0A\00"
@.str.2 = [17 x i8] c"%a, %a, %a, %a,\0A\00"
@.str.3 = [5 x i8] c"};\0A\0A\00"
define void @gen_type_pixels() {
%1 = alloca i32
%2 = call i32 @srandom(i32 20050728)
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 512)
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 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 0.000000e+00, double 1.280000e+02)
%10 = call double @rand_range_double(double 0.000000e+00, double 1.280000e+02)
%11 = call double @rand_range_double(double 0.000000e+00, double 1.280000e+02)
%12 = call double @rand_range_double(double 0.000000e+00, double 1.280000e+02)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 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 = [51 x i8] c"static const int babl_num_type_test_pixels = %d;\0A\0A\00"
@.str.1 = [51 x i8] c"static const double babl_type_test_pixels[%d] = {\0A\00"
@.str.2 = [17 x i8] c"%a, %a, %a, %a,\0A\00"
@str = [4 x i8] c"};\0A\00"
define void @gen_type_pixels() {
%1 = tail call i32 @srandom(i32 20050728)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 512)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 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 0.000000e+00, double 1.280000e+02)
%7 = tail call double @rand_range_double(double 0.000000e+00, double 1.280000e+02)
%8 = tail call double @rand_range_double(double 0.000000e+00, double 1.280000e+02)
%9 = tail call double @rand_range_double(double 0.000000e+00, double 1.280000e+02)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 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
}