#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 */
struct nnet {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(double *);
double *nnet_produce_array(struct nnet *, double *);
int /*<<< orphan*/ nnet_softmax_produce(struct nnet *, double *);
int /*<<< orphan*/ printf(char *, double, double);
void produce(struct nnet *net, double *features) {
  double *output = nnet_produce_array(net, features);
  nnet_softmax_produce(net, output);
  printf("feautes   = {%f, %f}\n", features[0], features[1]);
  printf("output    = {%f, %f}\n\n", output[0], output[1]);
  free(output);
}


x86 assembly (clang, -O0):
<produce>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <nnet_produce_array@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <nnet_softmax_produce@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
lea    0xe7a(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm1
lea    0xe73(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<produce>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
call   1060 <nnet_produce_array@plt>
mov    %rax,%r15
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <nnet_softmax_produce@plt>
movsd  (%rbx),%xmm0
movsd  0x8(%rbx),%xmm1
lea    0xe92(%rip),%rdi
call   1050 <printf@plt>
movsd  (%r15),%xmm0
movsd  0x8(%r15),%xmm1
lea    0xe91(%rip),%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.nnet = type { i32 }
@.str = [22 x i8] c"feautes = {%f, %f}\0A\00"
@.str.1 = [23 x i8] c"output = {%f, %f}\0A\0A\00"
define void @produce(%struct.nnet* %0, double* %1) {
%3 = alloca %struct.nnet*
%4 = alloca double*
%5 = alloca double*
store %struct.nnet* %0, %struct.nnet** %3
store double* %1, double** %4
%6 = load %struct.nnet*, %struct.nnet** %3
%7 = load double*, double** %4
%8 = call double* @nnet_produce_array(%struct.nnet* %6, double* %7)
store double* %8, double** %5
%9 = load %struct.nnet*, %struct.nnet** %3
%10 = load double*, double** %5
%11 = call i32 @nnet_softmax_produce(%struct.nnet* %9, double* %10)
%12 = load double*, double** %4
%13 = getelementptr inbounds double, double* %12, i64 0
%14 = load double, double* %13
%15 = load double*, double** %4
%16 = getelementptr inbounds double, double* %15, i64 1
%17 = load double, double* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double %14, double %17)
%19 = load double*, double** %5
%20 = getelementptr inbounds double, double* %19, i64 0
%21 = load double, double* %20
%22 = load double*, double** %5
%23 = getelementptr inbounds double, double* %22, i64 1
%24 = load double, double* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), double %21, double %24)
%26 = load double*, double** %5
%27 = call i32 @free(double* %26)
ret void
}

LLVM IR (-O2):
%struct.nnet = type { i32 }
@.str = [22 x i8] c"feautes = {%f, %f}\0A\00"
@.str.1 = [23 x i8] c"output = {%f, %f}\0A\0A\00"
define void @produce(%struct.nnet* %0, double* %1) {
%3 = tail call double* @nnet_produce_array(%struct.nnet* %0, double* %1)
%4 = tail call i32 @nnet_softmax_produce(%struct.nnet* %0, double* %3)
%5 = load double, double* %1
%6 = getelementptr inbounds double, double* %1, i64 1
%7 = load double, double* %6
%8 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double %5, double %7)
%9 = load double, double* %3
%10 = getelementptr inbounds double, double* %3, i64 1
%11 = load double, double* %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), double %9, double %11)
%13 = tail call i32 @free(double* %3)
ret void
}