#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 /*<<< orphan*/ FILE;

/* Variables and functions */
float atof(char *);
int atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ genData(int /*<<< orphan*/ *, int, float);
int /*<<< orphan*/ srand(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdout;
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc < 4) {
    fprintf(stderr, "Use: filename nVec variance seed\n");
    exit(1);
  }
  char *filename = argv[1];
  FILE *fn = stdout;
  if (strcmp("-", filename) != 0)
    fn = fopen(filename, "w");
  if (!fn) {
    fprintf(stderr, "Cannot open %s\n", filename);
    exit(1);
  }
  int nVec = atoi(argv[2]);
  float variance = atof(argv[3]);
  srand(atoi(argv[4]));
  genData(fn, nVec, variance);
  if (fn != stdout)
    fclose(fn);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11d1 <main+0x41>
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
lea    0xe40(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    0x2df4(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe2c(%rip),%rdi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     1219 <main+0x89>
mov    -0x18(%rbp),%rdi
lea    0xe14(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1249 <main+0xb9>
mov    0x2db5(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xdee(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <atof@plt>
movss  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,%edi
call   1060 <srand@plt>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
movss  -0x28(%rbp),%xmm0
call   1030 <genData@plt>
mov    -0x20(%rbp),%rax
mov    0x2d3d(%rip),%rcx
cmp    (%rcx),%rax
je     12ad <main+0x11d>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
cmp    $0x3,%edi
jle    1239 <main+0xa9>
mov    %rsi,%rbx
mov    0x8(%rsi),%r15
mov    0x2e25(%rip),%r12
mov    (%r12),%r14
lea    0xe64(%rip),%rdi
mov    %r15,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11dd <main+0x4d>
lea    0xe52(%rip),%rsi
mov    %r15,%rdi
call   1090 <fopen@plt>
mov    %rax,%r14
test   %r14,%r14
je     125a <main+0xca>
mov    0x10(%rbx),%rdi
call   10a0 <atoi@plt>
mov    %eax,%ebp
mov    0x18(%rbx),%rdi
call   1040 <atof@plt>
movss  %xmm0,0xc(%rsp)
mov    0x20(%rbx),%rdi
call   10a0 <atoi@plt>
mov    %eax,%edi
call   1060 <srand@plt>
mov    %r14,%rdi
mov    %ebp,%esi
movss  0xc(%rsp),%xmm0
call   1030 <genData@plt>
cmp    (%r12),%r14
je     122a <main+0x9a>
mov    %r14,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2da0(%rip),%rax
mov    (%rax),%edi
lea    0xdb7(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    0x2d7f(%rip),%rax
mov    (%rax),%edi
lea    0xdbc(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"Use: filename nVec variance seed\0A\00"
@stdout = global i32* null
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [16 x i8] c"Cannot open %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 4
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
store i8* %19, i8** %6
%20 = load i32*, i32** @stdout
store i32* %20, i32** %7
%21 = load i8*, i8** %6
%22 = call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %16
%25 = load i8*, i8** %6
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %26, i32** %7
br label %27
27: ; preds = %24, %16
%28 = load i32*, i32** %7
%29 = icmp ne i32* %28, null
br i1 %29, label %35, label %30
30: ; preds = %27
%31 = load i32, i32* @stderr
%32 = load i8*, i8** %6
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %32)
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %27
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = call i32 @atoi(i8* %38)
store i32 %39, i32* %8
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 3
%42 = load i8*, i8** %41
%43 = call float @atof(i8* %42)
store float %43, float* %9
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 4
%46 = load i8*, i8** %45
%47 = call i32 @atoi(i8* %46)
%48 = call i32 @srand(i32 %47)
%49 = load i32*, i32** %7
%50 = load i32, i32* %8
%51 = load float, float* %9
%52 = call i32 @genData(i32* %49, i32 %50, float %51)
%53 = load i32*, i32** %7
%54 = load i32*, i32** @stdout
%55 = icmp ne i32* %53, %54
br i1 %55, label %56, label %59
56: ; preds = %35
%57 = load i32*, i32** %7
%58 = call i32 @fclose(i32* %57)
br label %59
59: ; preds = %56, %35
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"Use: filename nVec variance seed\0A\00"
@stdout = global i32* null
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [16 x i8] c"Cannot open %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 4
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = load i32*, i32** @stdout
%12 = tail call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %8
%15 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %8
%17 = phi i32* [ %15, %14 ], [ %11, %8 ]
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i32, i32* @stderr
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %10)
%22 = tail call i32 @exit(i32 1)
unreachable
23: ; preds = %16
%24 = getelementptr inbounds i8*, i8** %1, i64 2
%25 = load i8*, i8** %24
%26 = tail call i32 @atoi(i8* %25)
%27 = getelementptr inbounds i8*, i8** %1, i64 3
%28 = load i8*, i8** %27
%29 = tail call float @atof(i8* %28)
%30 = getelementptr inbounds i8*, i8** %1, i64 4
%31 = load i8*, i8** %30
%32 = tail call i32 @atoi(i8* %31)
%33 = tail call i32 @srand(i32 %32)
%34 = tail call i32 @genData(i32* %17, i32 %26, float %29)
%35 = load i32*, i32** @stdout
%36 = icmp eq i32* %17, %35
br i1 %36, label %39, label %37
37: ; preds = %23
%38 = tail call i32 @fclose(i32* %17)
br label %39
39: ; preds = %37, %23
ret i32 0
}