#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 */
float random();
int label(float lattice[][4], float p) {
  for (int i = 0; i < 4; i++)
    for (int j = 0; j < 4; j++)
      lattice[i][j] = random();
  for (int i = 0; i < 4; i++)
    for (int j = 0; j < 4; j++) {
      if (lattice[i][j] <= p)
        lattice[i][j] = 1;
      else
        lattice[i][j] = 0;
    }
  return 0;
}


x86 assembly (clang, -O0):
<label>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    1183 <label+0x73>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1170 <label+0x60>
mov    $0x0,%al
call   1030 <random@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <label+0x29>
jmp    1175 <label+0x65>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1128 <label+0x18>
movl   $0x0,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
jge    1231 <label+0x121>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    121e <label+0x10e>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     11f0 <label+0xe0>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
movss  0xe1a(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
jmp    120b <label+0xfb>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
jmp    1210 <label+0x100>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    119b <label+0x8b>
jmp    1223 <label+0x113>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    118a <label+0x7a>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<label>:
push   %rbx
sub    $0x10,%rsp
movaps %xmm0,(%rsp)
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <random@plt>
movss  %xmm0,(%rbx)
xor    %eax,%eax
call   1030 <random@plt>
movss  %xmm0,0x4(%rbx)
xor    %eax,%eax
call   1030 <random@plt>
movss  %xmm0,0x8(%rbx)
xor    %eax,%eax
call   1030 <random@plt>
movss  %xmm0,0xc(%rbx)
xor    %eax,%eax
call   1030 <random@plt>
movss  %xmm0,0x10(%rbx)
xor    %eax,%eax
call   1030 <random@plt>
movss  %xmm0,0x14(%rbx)
xor    %eax,%eax
call   1030 <random@plt>
movss  %xmm0,0x18(%rbx)
xor    %eax,%eax
call   1030 <random@plt>
movss  %xmm0,0x1c(%rbx)
xor    %eax,%eax
call   1030 <random@plt>
movss  %xmm0,0x20(%rbx)
xor    %eax,%eax
call   1030 <random@plt>
movss  %xmm0,0x24(%rbx)
xor    %eax,%eax
call   1030 <random@plt>
movss  %xmm0,0x28(%rbx)
xor    %eax,%eax
call   1030 <random@plt>
movss  %xmm0,0x2c(%rbx)
xor    %eax,%eax
call   1030 <random@plt>
movss  %xmm0,0x30(%rbx)
xor    %eax,%eax
call   1030 <random@plt>
movss  %xmm0,0x34(%rbx)
xor    %eax,%eax
call   1030 <random@plt>
movss  %xmm0,0x38(%rbx)
xor    %eax,%eax
call   1030 <random@plt>
movaps (%rsp),%xmm5
shufps $0x0,%xmm5,%xmm5
movups (%rbx),%xmm1
movups 0x10(%rbx),%xmm2
movups 0x20(%rbx),%xmm3
cmpleps %xmm5,%xmm1
movaps 0xe0c(%rip),%xmm4
andps  %xmm4,%xmm1
movups %xmm1,(%rbx)
cmpleps %xmm5,%xmm2
andps  %xmm4,%xmm2
movups %xmm2,0x10(%rbx)
cmpleps %xmm5,%xmm3
andps  %xmm4,%xmm3
movups %xmm3,0x20(%rbx)
movsd  0x34(%rbx),%xmm1
movss  0x30(%rbx),%xmm2
movlhps %xmm1,%xmm2
shufps $0xd4,%xmm1,%xmm0
shufps $0x28,%xmm0,%xmm2
cmpleps %xmm5,%xmm2
andps  %xmm4,%xmm2
movups %xmm2,0x30(%rbx)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @label([4 x float]* %0, float %1) {
%3 = alloca [4 x float]*
%4 = alloca float
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store [4 x float]* %0, [4 x float]** %3
store float %1, float* %4
store i32 0, i32* %5
br label %9
9: ; preds = %29, %2
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 4
br i1 %11, label %12, label %32
12: ; preds = %9
store i32 0, i32* %6
br label %13
13: ; preds = %25, %12
%14 = load i32, i32* %6
%15 = icmp slt i32 %14, 4
br i1 %15, label %16, label %28
16: ; preds = %13
%17 = call float (...) @random()
%18 = load [4 x float]*, [4 x float]** %3
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [4 x float], [4 x float]* %18, i64 %20
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [4 x float], [4 x float]* %21, i64 0, i64 %23
store float %17, float* %24
br label %25
25: ; preds = %16
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
store i32 %27, i32* %6
br label %13
28: ; preds = %13
br label %29
29: ; preds = %28
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %9
32: ; preds = %9
store i32 0, i32* %7
br label %33
33: ; preds = %72, %32
%34 = load i32, i32* %7
%35 = icmp slt i32 %34, 4
br i1 %35, label %36, label %75
36: ; preds = %33
store i32 0, i32* %8
br label %37
37: ; preds = %68, %36
%38 = load i32, i32* %8
%39 = icmp slt i32 %38, 4
br i1 %39, label %40, label %71
40: ; preds = %37
%41 = load [4 x float]*, [4 x float]** %3
%42 = load i32, i32* %7
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [4 x float], [4 x float]* %41, i64 %43
%45 = load i32, i32* %8
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [4 x float], [4 x float]* %44, i64 0, i64 %46
%48 = load float, float* %47
%49 = load float, float* %4
%50 = fcmp ole float %48, %49
br i1 %50, label %51, label %59
51: ; preds = %40
%52 = load [4 x float]*, [4 x float]** %3
%53 = load i32, i32* %7
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [4 x float], [4 x float]* %52, i64 %54
%56 = load i32, i32* %8
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [4 x float], [4 x float]* %55, i64 0, i64 %57
store float 1.000000e+00, float* %58
br label %67
59: ; preds = %40
%60 = load [4 x float]*, [4 x float]** %3
%61 = load i32, i32* %7
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [4 x float], [4 x float]* %60, i64 %62
%64 = load i32, i32* %8
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [4 x float], [4 x float]* %63, i64 0, i64 %65
store float 0.000000e+00, float* %66
br label %67
67: ; preds = %59, %51
br label %68
68: ; preds = %67
%69 = load i32, i32* %8
%70 = add nsw i32 %69, 1
store i32 %70, i32* %8
br label %37
71: ; preds = %37
br label %72
72: ; preds = %71
%73 = load i32, i32* %7
%74 = add nsw i32 %73, 1
store i32 %74, i32* %7
br label %33
75: ; preds = %33
ret i32 0
}

LLVM IR (-O2):
define i32 @label([4 x float]* nocapture %0, float %1) {
%3 = tail call float (...) @random()
%4 = getelementptr inbounds [4 x float], [4 x float]* %0, i64 0, i64 0
store float %3, float* %4
%5 = tail call float (...) @random()
%6 = getelementptr inbounds [4 x float], [4 x float]* %0, i64 0, i64 1
store float %5, float* %6
%7 = tail call float (...) @random()
%8 = getelementptr inbounds [4 x float], [4 x float]* %0, i64 0, i64 2
store float %7, float* %8
%9 = tail call float (...) @random()
%10 = getelementptr inbounds [4 x float], [4 x float]* %0, i64 0, i64 3
store float %9, float* %10
%11 = tail call float (...) @random()
%12 = getelementptr inbounds [4 x float], [4 x float]* %0, i64 1, i64 0
store float %11, float* %12
%13 = tail call float (...) @random()
%14 = getelementptr inbounds [4 x float], [4 x float]* %0, i64 1, i64 1
store float %13, float* %14
%15 = tail call float (...) @random()
%16 = getelementptr inbounds [4 x float], [4 x float]* %0, i64 1, i64 2
store float %15, float* %16
%17 = tail call float (...) @random()
%18 = getelementptr inbounds [4 x float], [4 x float]* %0, i64 1, i64 3
store float %17, float* %18
%19 = tail call float (...) @random()
%20 = getelementptr inbounds [4 x float], [4 x float]* %0, i64 2, i64 0
store float %19, float* %20
%21 = tail call float (...) @random()
%22 = getelementptr inbounds [4 x float], [4 x float]* %0, i64 2, i64 1
store float %21, float* %22
%23 = tail call float (...) @random()
%24 = getelementptr inbounds [4 x float], [4 x float]* %0, i64 2, i64 2
store float %23, float* %24
%25 = tail call float (...) @random()
%26 = getelementptr inbounds [4 x float], [4 x float]* %0, i64 2, i64 3
store float %25, float* %26
%27 = tail call float (...) @random()
%28 = getelementptr inbounds [4 x float], [4 x float]* %0, i64 3, i64 0
store float %27, float* %28
%29 = tail call float (...) @random()
%30 = getelementptr inbounds [4 x float], [4 x float]* %0, i64 3, i64 1
store float %29, float* %30
%31 = tail call float (...) @random()
%32 = getelementptr inbounds [4 x float], [4 x float]* %0, i64 3, i64 2
store float %31, float* %32
%33 = tail call float (...) @random()
%34 = bitcast [4 x float]* %0 to <4 x float>*
%35 = load <4 x float>, <4 x float>* %34
%36 = insertelement <4 x float> poison, float %1, i64 0
%37 = shufflevector <4 x float> %36, <4 x float> poison, <4 x i32> zeroinitializer
%38 = fcmp ugt <4 x float> %35, %37
%39 = select <4 x i1> %38, <4 x float> zeroinitializer, <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
%40 = bitcast [4 x float]* %0 to <4 x float>*
store <4 x float> %39, <4 x float>* %40
%41 = bitcast float* %12 to <4 x float>*
%42 = load <4 x float>, <4 x float>* %41
%43 = fcmp ugt <4 x float> %42, %37
%44 = select <4 x i1> %43, <4 x float> zeroinitializer, <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
%45 = bitcast float* %12 to <4 x float>*
store <4 x float> %44, <4 x float>* %45
%46 = bitcast float* %20 to <4 x float>*
%47 = load <4 x float>, <4 x float>* %46
%48 = fcmp ugt <4 x float> %47, %37
%49 = select <4 x i1> %48, <4 x float> zeroinitializer, <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
%50 = bitcast float* %20 to <4 x float>*
store <4 x float> %49, <4 x float>* %50
%51 = load float, float* %28
%52 = bitcast float* %30 to <2 x float>*
%53 = load <2 x float>, <2 x float>* %52
%54 = insertelement <4 x float> poison, float %51, i64 0
%55 = shufflevector <2 x float> %53, <2 x float> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
%56 = shufflevector <4 x float> %54, <4 x float> %55, <4 x i32> <i32 0, i32 4, i32 5, i32 undef>
%57 = insertelement <4 x float> %56, float %33, i64 3
%58 = fcmp ugt <4 x float> %57, %37
%59 = select <4 x i1> %58, <4 x float> zeroinitializer, <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
%60 = bitcast float* %28 to <4 x float>*
store <4 x float> %59, <4 x float>* %60
ret i32 0
}