#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 */
scalar_t__ malloc(int);
float **first_derivative(float input[][2], size_t size) {
  unsigned int i;
  float **output = (float **)malloc(size * sizeof(float *));
  for (i = 0; i < 10; i++) {
    output[i] = (float *)malloc(2 * sizeof(float));
  }
  for (i = 0; i < size; i++) {
    output[i][0] = input[i][0] * input[i][1];
    output[i][1] = input[i][1] - 1;
  }
  return output;
}


x86 assembly (clang, -O0):
<first_derivative>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jae    116a <first_derivative+0x5a>
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,%rdx
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %rdx,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113a <first_derivative+0x2a>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%rax
jae    11dd <first_derivative+0xcd>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
movss  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mulss  0x4(%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
movss  0x4(%rax,%rcx,8),%xmm0
movss  0xe45(%rip),%xmm1
subss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
movss  %xmm0,0x4(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1171 <first_derivative+0x61>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<first_derivative>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x0(,%rsi,8),%edi
call   1030 <malloc@plt>
mov    %rax,%r15
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,(%r15)
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,0x8(%r15)
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,0x10(%r15)
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,0x18(%r15)
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,0x20(%r15)
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,0x28(%r15)
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,0x30(%r15)
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,0x38(%r15)
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,0x40(%r15)
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,0x48(%r15)
test   %r14,%r14
je     11fa <first_derivative+0xea>
xor    %eax,%eax
movss  0xe3c(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movss  (%rbx,%rax,8),%xmm1
mulss  0x4(%rbx,%rax,8),%xmm1
mov    (%r15,%rax,8),%rcx
movss  %xmm1,(%rcx)
movss  0x4(%rbx,%rax,8),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x4(%rcx)
add    $0x1,%eax
cmp    %r14,%rax
jb     11d0 <first_derivative+0xc0>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define float** @first_derivative([2 x float]* nocapture %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = shl i32 %3, 3
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to float**
%7 = tail call i64 @malloc(i32 8)
%8 = inttoptr i64 %7 to float*
store float* %8, float** %6
%9 = tail call i64 @malloc(i32 8)
%10 = inttoptr i64 %9 to float*
%11 = getelementptr inbounds float*, float** %6, i64 1
store float* %10, float** %11
%12 = tail call i64 @malloc(i32 8)
%13 = inttoptr i64 %12 to float*
%14 = getelementptr inbounds float*, float** %6, i64 2
store float* %13, float** %14
%15 = tail call i64 @malloc(i32 8)
%16 = inttoptr i64 %15 to float*
%17 = getelementptr inbounds float*, float** %6, i64 3
store float* %16, float** %17
%18 = tail call i64 @malloc(i32 8)
%19 = inttoptr i64 %18 to float*
%20 = getelementptr inbounds float*, float** %6, i64 4
store float* %19, float** %20
%21 = tail call i64 @malloc(i32 8)
%22 = inttoptr i64 %21 to float*
%23 = getelementptr inbounds float*, float** %6, i64 5
store float* %22, float** %23
%24 = tail call i64 @malloc(i32 8)
%25 = inttoptr i64 %24 to float*
%26 = getelementptr inbounds float*, float** %6, i64 6
store float* %25, float** %26
%27 = tail call i64 @malloc(i32 8)
%28 = inttoptr i64 %27 to float*
%29 = getelementptr inbounds float*, float** %6, i64 7
store float* %28, float** %29
%30 = tail call i64 @malloc(i32 8)
%31 = inttoptr i64 %30 to float*
%32 = getelementptr inbounds float*, float** %6, i64 8
store float* %31, float** %32
%33 = tail call i64 @malloc(i32 8)
%34 = inttoptr i64 %33 to float*
%35 = getelementptr inbounds float*, float** %6, i64 9
store float* %34, float** %35
%36 = icmp eq i64 %1, 0
br i1 %36, label %52, label %37
37: ; preds = %2, %37
%38 = phi i64 [ %50, %37 ], [ 0, %2 ]
%39 = getelementptr inbounds [2 x float], [2 x float]* %0, i64 %38, i64 0
%40 = load float, float* %39
%41 = getelementptr inbounds [2 x float], [2 x float]* %0, i64 %38, i64 1
%42 = load float, float* %41
%43 = fmul float %40, %42
%44 = getelementptr inbounds float*, float** %6, i64 %38
%45 = load float*, float** %44
store float %43, float* %45
%46 = load float, float* %41
%47 = fadd float %46, -1.000000e+00
%48 = getelementptr inbounds float, float* %45, i64 1
store float %47, float* %48
%49 = add nuw nsw i64 %38, 1
%50 = and i64 %49, 4294967295
%51 = icmp ult i64 %50, %1
br i1 %51, label %37, label %52
52: ; preds = %37, %2
ret float** %6
}