#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*/ errhandler(int, char *, char *);
int /*<<< orphan*/ read_double(char const *, char *, double *);
int /*<<< orphan*/ read_int(char const *, char *, int *);
int readParameters(int *xlength, double *tau, double *velocityWall,
                   int *timesteps, int *timestepsPerPlotting, int argc,
                   char *argv[]) {
  const char *szFileName = argv[1];
  if (argc != 2) {
    errhandler(23,
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/nathanwbrei/cfdlab/refs/"
               "heads/master/worksheet2/initLB.c",
               "number of arguments is incorrect");
  }
  read_int(szFileName, "xlength", xlength);
  read_double(szFileName, "tau", tau);
  read_double(szFileName, "characteristicvelocity_x", &velocityWall[0]);
  read_double(szFileName, "characteristicvelocity_y", &velocityWall[1]);
  read_double(szFileName, "characteristicvelocity_z", &velocityWall[2]);
  read_int(szFileName, "timesteps", timesteps);
  read_int(szFileName, "vtkoutput", timestepsPerPlotting);
  return 0;
}


x86 assembly (clang, -O0):
<readParameters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x38(%rbp)
cmpl   $0x2,-0x2c(%rbp)
je     1182 <readParameters+0x52>
mov    $0x17,%edi
lea    0xe8a(%rip),%rsi
lea    0xf16(%rip),%rdx
call   1030 <errhandler@plt>
mov    -0x38(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xf23(%rip),%rsi
call   1040 <read_int@plt>
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xf17(%rip),%rsi
call   1050 <read_double@plt>
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xf07(%rip),%rsi
call   1050 <read_double@plt>
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
lea    0xf08(%rip),%rsi
call   1050 <read_double@plt>
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rdx
add    $0x10,%rdx
lea    0xf09(%rip),%rsi
call   1050 <read_double@plt>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xf0e(%rip),%rsi
call   1040 <read_int@plt>
mov    -0x38(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xf04(%rip),%rsi
call   1040 <read_int@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readParameters>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbp
mov    0x40(%rsp),%rax
mov    0x8(%rax),%rbx
cmp    $0x2,%r9d
je     1171 <readParameters+0x41>
lea    0xea0(%rip),%rsi
lea    0xf2c(%rip),%rdx
mov    $0x17,%edi
call   1030 <errhandler@plt>
lea    0xf3c(%rip),%rsi
mov    %rbx,%rdi
mov    %rbp,%rdx
call   1040 <read_int@plt>
lea    0xf32(%rip),%rsi
mov    %rbx,%rdi
mov    %r13,%rdx
call   1050 <read_double@plt>
lea    0xf24(%rip),%rsi
mov    %rbx,%rdi
mov    %r12,%rdx
call   1050 <read_double@plt>
lea    0x8(%r12),%rdx
lea    0xf26(%rip),%rsi
mov    %rbx,%rdi
call   1050 <read_double@plt>
add    $0x10,%r12
lea    0xf2c(%rip),%rsi
mov    %rbx,%rdi
mov    %r12,%rdx
call   1050 <read_double@plt>
lea    0xf33(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
call   1040 <read_int@plt>
lea    0xf2b(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1040 <read_int@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/nathanwbrei/cfdlab/refs/heads/master/worksheet2/initLB.c\00"
@.str.1 = [33 x i8] c"number of arguments is incorrect\00"
@.str.2 = [8 x i8] c"xlength\00"
@.str.3 = [4 x i8] c"tau\00"
@.str.4 = [25 x i8] c"characteristicvelocity_x\00"
@.str.5 = [25 x i8] c"characteristicvelocity_y\00"
@.str.6 = [25 x i8] c"characteristicvelocity_z\00"
@.str.7 = [10 x i8] c"timesteps\00"
@.str.8 = [10 x i8] c"vtkoutput\00"
define i32 @readParameters(i32* %0, double* %1, double* %2, i32* %3, i32* %4, i32 %5, i8** %6) {
%8 = alloca i32*
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i8**
%15 = alloca i8*
store i32* %0, i32** %8
store double* %1, double** %9
store double* %2, double** %10
store i32* %3, i32** %11
store i32* %4, i32** %12
store i32 %5, i32* %13
store i8** %6, i8*** %14
%16 = load i8**, i8*** %14
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
store i8* %18, i8** %15
%19 = load i32, i32* %13
%20 = icmp ne i32 %19, 2
br i1 %20, label %21, label %23
21: ; preds = %7
%22 = call i32 @errhandler(i32 23, i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %21, %7
%24 = load i8*, i8** %15
%25 = load i32*, i32** %8
%26 = call i32 @read_int(i8* %24, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32* %25)
%27 = load i8*, i8** %15
%28 = load double*, double** %9
%29 = call i32 @read_double(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %28)
%30 = load i8*, i8** %15
%31 = load double*, double** %10
%32 = getelementptr inbounds double, double* %31, i64 0
%33 = call i32 @read_double(i8* %30, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), double* %32)
%34 = load i8*, i8** %15
%35 = load double*, double** %10
%36 = getelementptr inbounds double, double* %35, i64 1
%37 = call i32 @read_double(i8* %34, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), double* %36)
%38 = load i8*, i8** %15
%39 = load double*, double** %10
%40 = getelementptr inbounds double, double* %39, i64 2
%41 = call i32 @read_double(i8* %38, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), double* %40)
%42 = load i8*, i8** %15
%43 = load i32*, i32** %11
%44 = call i32 @read_int(i8* %42, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32* %43)
%45 = load i8*, i8** %15
%46 = load i32*, i32** %12
%47 = call i32 @read_int(i8* %45, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32* %46)
ret i32 0
}

LLVM IR (-O2):
@.str = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/nathanwbrei/cfdlab/refs/heads/master/worksheet2/initLB.c\00"
@.str.1 = [33 x i8] c"number of arguments is incorrect\00"
@.str.2 = [8 x i8] c"xlength\00"
@.str.3 = [4 x i8] c"tau\00"
@.str.4 = [25 x i8] c"characteristicvelocity_x\00"
@.str.5 = [25 x i8] c"characteristicvelocity_y\00"
@.str.6 = [25 x i8] c"characteristicvelocity_z\00"
@.str.7 = [10 x i8] c"timesteps\00"
@.str.8 = [10 x i8] c"vtkoutput\00"
define i32 @readParameters(i32* %0, double* %1, double* %2, i32* %3, i32* %4, i32 %5, i8** nocapture %6) {
%8 = getelementptr inbounds i8*, i8** %6, i64 1
%9 = load i8*, i8** %8
%10 = icmp eq i32 %5, 2
br i1 %10, label %13, label %11
11: ; preds = %7
%12 = tail call i32 @errhandler(i32 23, i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %7
%14 = tail call i32 @read_int(i8* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32* %0)
%15 = tail call i32 @read_double(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %1)
%16 = tail call i32 @read_double(i8* %9, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), double* %2)
%17 = getelementptr inbounds double, double* %2, i64 1
%18 = tail call i32 @read_double(i8* %9, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), double* %17)
%19 = getelementptr inbounds double, double* %2, i64 2
%20 = tail call i32 @read_double(i8* %9, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), double* %19)
%21 = tail call i32 @read_int(i8* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32* %3)
%22 = tail call i32 @read_int(i8* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32* %4)
ret i32 0
}