#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 */
typedef int uint;

/* Variables and functions */
float dst_ut_float_rand();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ stderr;
float **makeRandomImages(uint image_size, uint nImages) {
  uint i, j;
  float **images;
  images = (float **)malloc(sizeof(float *) * nImages);
  if (images == NULL) {
    {
      fprintf(stderr, "makeRandomImages: could not malloc\n");
      exit(1);
    };
  }
  for (i = 0; i < nImages; i++) {
    images[i] = (float *)malloc(sizeof(float) * image_size);
    if (images[i] == NULL) {
      {
        fprintf(stderr, "makeRandomImages: could not malloc\n");
        exit(1);
      };
    }
  }
  for (i = 0; i < image_size; i++) {
    for (j = 0; j < nImages; j++) {
      images[j][i] = dst_ut_float_rand();
    }
  }
  return images;
}


x86 assembly (clang, -O0):
<makeRandomImages>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    118b <makeRandomImages+0x4b>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
lea    0xe84(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1201 <makeRandomImages+0xc1>
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    11ee <makeRandomImages+0xae>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
lea    0xe21(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
jmp    11f3 <makeRandomImages+0xb3>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1192 <makeRandomImages+0x52>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1264 <makeRandomImages+0x124>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1251 <makeRandomImages+0x111>
mov    $0x0,%al
call   1050 <dst_ut_float_rand@plt>
mov    -0x18(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xc(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    121b <makeRandomImages+0xdb>
jmp    1256 <makeRandomImages+0x116>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1208 <makeRandomImages+0xc8>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeRandomImages>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%r15d
lea    0x0(,%rbx,8),%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     11ee <makeRandomImages+0xae>
mov    %rax,%r13
mov    %ebx,%r14d
mov    %rbx,%rbp
test   %ebx,%ebx
jle    119b <makeRandomImages+0x5b>
lea    0x0(,%r15,4),%r12d
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r12d,%edi
call   1040 <malloc@plt>
mov    %rax,0x0(%r13,%rbx,8)
test   %rax,%rax
je     11ee <makeRandomImages+0xae>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1180 <makeRandomImages+0x40>
test   %r15d,%r15d
jle    11dc <makeRandomImages+0x9c>
mov    %rbp,%r12
mov    %r15d,%r15d
xor    %ebx,%ebx
jmp    11b9 <makeRandomImages+0x79>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %r15,%rbx
je     11dc <makeRandomImages+0x9c>
test   %r12d,%r12d
jle    11b0 <makeRandomImages+0x70>
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <dst_ut_float_rand@plt>
mov    0x0(%r13,%rbp,8),%rax
movss  %xmm0,(%rax,%rbx,4)
add    $0x1,%rbp
cmp    %rbp,%r14
jne    11c0 <makeRandomImages+0x80>
jmp    11b0 <makeRandomImages+0x70>
mov    %r13,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
lea    0xe02(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [36 x i8] c"makeRandomImages: could not malloc\0A\00"
define float** @makeRandomImages(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca float**
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = mul i64 8, %9
%11 = trunc i64 %10 to i32
%12 = call i64 @malloc(i32 %11)
%13 = inttoptr i64 %12 to float**
store float** %13, float*** %7
%14 = load float**, float*** %7
%15 = icmp eq float** %14, null
br i1 %15, label %16, label %20
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %2
store i32 0, i32* %5
br label %21
21: ; preds = %47, %20
%22 = load i32, i32* %5
%23 = load i32, i32* %4
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %50
25: ; preds = %21
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = mul i64 4, %27
%29 = trunc i64 %28 to i32
%30 = call i64 @malloc(i32 %29)
%31 = inttoptr i64 %30 to float*
%32 = load float**, float*** %7
%33 = load i32, i32* %5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds float*, float** %32, i64 %34
store float* %31, float** %35
%36 = load float**, float*** %7
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds float*, float** %36, i64 %38
%40 = load float*, float** %39
%41 = icmp eq float* %40, null
br i1 %41, label %42, label %46
42: ; preds = %25
%43 = load i32, i32* @stderr
%44 = call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%45 = call i32 @exit(i32 1)
unreachable
46: ; preds = %25
br label %47
47: ; preds = %46
%48 = load i32, i32* %5
%49 = add nsw i32 %48, 1
store i32 %49, i32* %5
br label %21
50: ; preds = %21
store i32 0, i32* %5
br label %51
51: ; preds = %74, %50
%52 = load i32, i32* %5
%53 = load i32, i32* %3
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %77
55: ; preds = %51
store i32 0, i32* %6
br label %56
56: ; preds = %70, %55
%57 = load i32, i32* %6
%58 = load i32, i32* %4
%59 = icmp slt i32 %57, %58
br i1 %59, label %60, label %73
60: ; preds = %56
%61 = call float (...) @dst_ut_float_rand()
%62 = load float**, float*** %7
%63 = load i32, i32* %6
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds float*, float** %62, i64 %64
%66 = load float*, float** %65
%67 = load i32, i32* %5
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds float, float* %66, i64 %68
store float %61, float* %69
br label %70
70: ; preds = %60
%71 = load i32, i32* %6
%72 = add nsw i32 %71, 1
store i32 %72, i32* %6
br label %56
73: ; preds = %56
br label %74
74: ; preds = %73
%75 = load i32, i32* %5
%76 = add nsw i32 %75, 1
store i32 %76, i32* %5
br label %51
77: ; preds = %51
%78 = load float**, float*** %7
ret float** %78
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"makeRandomImages: could not malloc\0A\00"
define float** @makeRandomImages(i32 %0, i32 %1) {
%3 = shl i32 %1, 3
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to float**
%6 = icmp eq i64 %4, 0
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = icmp sgt i32 %1, 0
br i1 %8, label %9, label %18
9: ; preds = %7
%10 = shl i32 %0, 2
%11 = zext i32 %1 to i64
br label %23
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %23
%17 = icmp eq i64 %29, %11
br i1 %17, label %18, label %23
18: ; preds = %16, %7
%19 = icmp sgt i32 %0, 0
br i1 %19, label %20, label %47
20: ; preds = %18
%21 = zext i32 %0 to i64
%22 = zext i32 %1 to i64
br label %34
23: ; preds = %9, %16
%24 = phi i64 [ 0, %9 ], [ %29, %16 ]
%25 = tail call i64 @malloc(i32 %10)
%26 = inttoptr i64 %25 to float*
%27 = getelementptr inbounds float*, float** %5, i64 %24
store float* %26, float** %27
%28 = icmp eq i64 %25, 0
%29 = add nuw nsw i64 %24, 1
br i1 %28, label %30, label %16
30: ; preds = %23
%31 = load i32, i32* @stderr
%32 = tail call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%33 = tail call i32 @exit(i32 1)
unreachable
34: ; preds = %20, %44
%35 = phi i64 [ 0, %20 ], [ %45, %44 ]
br i1 %8, label %36, label %44
36: ; preds = %34, %36
%37 = phi i64 [ %42, %36 ], [ 0, %34 ]
%38 = tail call float (...) @dst_ut_float_rand()
%39 = getelementptr inbounds float*, float** %5, i64 %37
%40 = load float*, float** %39
%41 = getelementptr inbounds float, float* %40, i64 %35
store float %38, float* %41
%42 = add nuw nsw i64 %37, 1
%43 = icmp eq i64 %42, %22
br i1 %43, label %44, label %36
44: ; preds = %36, %34
%45 = add nuw nsw i64 %35, 1
%46 = icmp eq i64 %45, %21
br i1 %46, label %47, label %34
47: ; preds = %44, %18
ret float** %5
}