#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*/ freemap(double *);
double *genmap_sin(double, double, double, double, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ savemap(double *, char *);
int main(int argc, char *argv[]) {
  printf("Generating vmap...\n");
  double *vmap = genmap_sin(.8, 440.0, 0.1, 2.0, 1e-5);
  printf("Generated.\n");
  if (!savemap(vmap, "test")) {
    printf("Could not save...\n");
    return 1;
  }
  freemap(vmap);
  printf("Finished!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
movsd  0xe96(%rip),%xmm0
movsd  0xe96(%rip),%xmm1
movsd  0xe96(%rip),%xmm2
movsd  0xe96(%rip),%xmm3
xor    %edi,%edi
call   1040 <genmap_sin@plt>
mov    %rax,-0x18(%rbp)
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe9c(%rip),%rsi
call   1050 <savemap@plt>
cmp    $0x0,%eax
jne    11ca <main+0x8a>
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11e6 <main+0xa6>
mov    -0x18(%rbp),%rdi
call   1060 <freemap@plt>
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
movsd  0xea9(%rip),%xmm0
movsd  0xea9(%rip),%xmm1
movsd  0xea9(%rip),%xmm2
movsd  0xea9(%rip),%xmm3
xor    %ebp,%ebp
xor    %edi,%edi
call   1040 <genmap_sin@plt>
mov    %rax,%rbx
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
lea    0xe92(%rip),%rsi
mov    %rbx,%rdi
call   1050 <savemap@plt>
test   %eax,%eax
je     11ab <main+0x6b>
mov    %rbx,%rdi
call   1060 <freemap@plt>
lea    0xeac(%rip),%rdi
jmp    11b7 <main+0x77>
mov    $0x1,%ebp
lea    0xe8c(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Generating vmap...\0A\00"
@.str.1 = [12 x i8] c"Generated.\0A\00"
@.str.2 = [5 x i8] c"test\00"
@.str.3 = [19 x i8] c"Could not save...\0A\00"
@.str.4 = [11 x i8] c"Finished!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%8 = call double* @genmap_sin(double 8.000000e-01, double 4.400000e+02, double 1.000000e-01, double 2.000000e+00, i32 0)
store double* %8, double** %6
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%10 = load double*, double** %6
%11 = call i32 @savemap(double* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp ne i32 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %2
%14 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %19
15: ; preds = %2
%16 = load double*, double** %6
%17 = call i32 @freemap(double* %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %3
br label %19
19: ; preds = %15, %13
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@.str.2 = [5 x i8] c"test\00"
@str = [19 x i8] c"Generating vmap...\00"
@str.5 = [11 x i8] c"Generated.\00"
@str.6 = [18 x i8] c"Could not save...\00"
@str.7 = [10 x i8] c"Finished!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%4 = tail call double* @genmap_sin(double 8.000000e-01, double 4.400000e+02, double 1.000000e-01, double 2.000000e+00, i32 0)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.5, i64 0, i64 0))
%6 = tail call i32 @savemap(double* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @freemap(double* %4)
br label %10
10: ; preds = %2, %8
%11 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @str.6, i64 0, i64 0), %2 ]
%12 = phi i32 [ 0, %8 ], [ 1, %2 ]
%13 = tail call i32 @puts(i8* dereferenceable(1) %11)
ret i32 %12
}