#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*/ R_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ errhandler(int, char *, char *);
int /*<<< orphan*/ read_double(char *, char *, double *);
int /*<<< orphan*/ read_int(char *, char *, int *);
int readParameters(int *xlength, double *tau, double *velocity_wall,
                   int *timesteps, int *timesteps_per_plotting, int argc,
                   char *argv[]) {
  double *velocity_wall_1, *velocity_wall_2, *velocity_wall_3;
  if (argc < 2)
    errhandler(
        10,
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/nyxcalamity/classwork/refs/heads/master/tum/"
        "computational-fluid-dynamics/ws2/src/initialization.c",
        "Not enough arguments. At least a path to init file is required.");
  if (access(argv[1], R_OK) != 0)
    errhandler(
        12,
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/nyxcalamity/classwork/refs/heads/master/tum/"
        "computational-fluid-dynamics/ws2/src/initialization.c",
        "Provided file path either doesn't exist or can not be read.");
  read_double(argv[1], "*tau", &(*tau));
  velocity_wall_1 = &velocity_wall[0];
  velocity_wall_2 = &velocity_wall[1];
  velocity_wall_3 = &velocity_wall[2];
  read_double(argv[1], "*velocity_wall_1", &(*velocity_wall_1));
  read_double(argv[1], "*velocity_wall_2", &(*velocity_wall_2));
  read_double(argv[1], "*velocity_wall_3", &(*velocity_wall_3));
  read_int(argv[1], "*xlength", &(*xlength));
  read_int(argv[1], "*timesteps", &(*timesteps));
  read_int(argv[1], "*timesteps_per_plotting", &(*timesteps_per_plotting));
  return 1;
}


x86 assembly (clang, -O0):
<readParameters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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)
cmpl   $0x2,-0x2c(%rbp)
jge    1186 <readParameters+0x46>
mov    $0xa,%edi
lea    0xe86(%rip),%rsi
lea    0xf3b(%rip),%rdx
call   1030 <errhandler@plt>
mov    0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e4b(%rip),%rax
mov    (%rax),%esi
call   1050 <access@plt>
cmp    $0x0,%rax
je     11be <readParameters+0x7e>
mov    $0xc,%edi
lea    0xe4e(%rip),%rsi
lea    0xf43(%rip),%rdx
call   1030 <errhandler@plt>
mov    0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rdx
lea    0xf67(%rip),%rsi
call   1060 <read_double@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x48(%rbp)
mov    0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x38(%rbp),%rdx
lea    0xf34(%rip),%rsi
call   1060 <read_double@plt>
mov    0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x40(%rbp),%rdx
lea    0xf2d(%rip),%rsi
call   1060 <read_double@plt>
mov    0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x48(%rbp),%rdx
lea    0xf26(%rip),%rsi
call   1060 <read_double@plt>
mov    0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x8(%rbp),%rdx
lea    0xf1f(%rip),%rsi
call   1040 <read_int@plt>
mov    0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x20(%rbp),%rdx
lea    0xf10(%rip),%rsi
call   1040 <read_int@plt>
mov    0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x28(%rbp),%rdx
lea    0xf03(%rip),%rsi
call   1040 <read_int@plt>
mov    $0x1,%eax
add    $0x50,%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,(%rsp)
mov    %rcx,%r15
mov    %rdx,%rbp
mov    %rsi,%r13
mov    %rdi,%r12
mov    0x40(%rsp),%r14
cmp    $0x1,%r9d
jg     117e <readParameters+0x3e>
lea    0xe93(%rip),%rsi
lea    0xf48(%rip),%rdx
mov    $0xa,%edi
call   1030 <errhandler@plt>
mov    0x8(%r14),%rdi
mov    0x2e57(%rip),%rax
mov    (%rax),%esi
call   1050 <access@plt>
test   %rax,%rax
je     11ad <readParameters+0x6d>
lea    0xe64(%rip),%rsi
lea    0xf59(%rip),%rdx
mov    $0xc,%edi
call   1030 <errhandler@plt>
mov    0x8(%r14),%rdi
lea    0xf80(%rip),%rsi
mov    %r13,%rdx
call   1060 <read_double@plt>
lea    0x8(%rbp),%rbx
lea    0x10(%rbp),%r13
mov    0x8(%r14),%rdi
lea    0xf6a(%rip),%rsi
mov    %rbp,%rdx
call   1060 <read_double@plt>
mov    0x8(%r14),%rdi
lea    0xf68(%rip),%rsi
mov    %rbx,%rdx
call   1060 <read_double@plt>
mov    0x8(%r14),%rdi
lea    0xf66(%rip),%rsi
mov    %r13,%rdx
call   1060 <read_double@plt>
mov    0x8(%r14),%rdi
lea    0xf64(%rip),%rsi
mov    %r12,%rdx
call   1040 <read_int@plt>
mov    0x8(%r14),%rdi
lea    0xf5a(%rip),%rsi
mov    %r15,%rdx
call   1040 <read_int@plt>
mov    0x8(%r14),%rdi
lea    0xf52(%rip),%rsi
mov    (%rsp),%rdx
call   1040 <read_int@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [188 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/nyxcalamity/classwork/refs/heads/master/tum/computational-fluid-dynamics/ws2/src/initialization.c\00"
@.str.1 = [64 x i8] c"Not enough arguments. At least a path to init file is required.\00"
@R_OK = global i32 0
@.str.2 = [60 x i8] c"Provided file path either doesn't exist or can not be read.\00"
@.str.3 = [5 x i8] c"*tau\00"
@.str.4 = [17 x i8] c"*velocity_wall_1\00"
@.str.5 = [17 x i8] c"*velocity_wall_2\00"
@.str.6 = [17 x i8] c"*velocity_wall_3\00"
@.str.7 = [9 x i8] c"*xlength\00"
@.str.8 = [11 x i8] c"*timesteps\00"
@.str.9 = [24 x i8] c"*timesteps_per_plotting\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 double*
%16 = alloca double*
%17 = alloca double*
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
%18 = load i32, i32* %13
%19 = icmp slt i32 %18, 2
br i1 %19, label %20, label %22
20: ; preds = %7
%21 = call i32 @errhandler(i32 10, i8* getelementptr inbounds ([188 x i8], [188 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %7
%23 = load i8**, i8*** %14
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = load i32, i32* @R_OK
%27 = call i64 @access(i8* %25, i32 %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %22
%30 = call i32 @errhandler(i32 12, i8* getelementptr inbounds ([188 x i8], [188 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0))
br label %31
31: ; preds = %29, %22
%32 = load i8**, i8*** %14
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = load double*, double** %9
%36 = call i32 @read_double(i8* %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double* %35)
%37 = load double*, double** %10
%38 = getelementptr inbounds double, double* %37, i64 0
store double* %38, double** %15
%39 = load double*, double** %10
%40 = getelementptr inbounds double, double* %39, i64 1
store double* %40, double** %16
%41 = load double*, double** %10
%42 = getelementptr inbounds double, double* %41, i64 2
store double* %42, double** %17
%43 = load i8**, i8*** %14
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = load double*, double** %15
%47 = call i32 @read_double(i8* %45, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), double* %46)
%48 = load i8**, i8*** %14
%49 = getelementptr inbounds i8*, i8** %48, i64 1
%50 = load i8*, i8** %49
%51 = load double*, double** %16
%52 = call i32 @read_double(i8* %50, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), double* %51)
%53 = load i8**, i8*** %14
%54 = getelementptr inbounds i8*, i8** %53, i64 1
%55 = load i8*, i8** %54
%56 = load double*, double** %17
%57 = call i32 @read_double(i8* %55, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), double* %56)
%58 = load i8**, i8*** %14
%59 = getelementptr inbounds i8*, i8** %58, i64 1
%60 = load i8*, i8** %59
%61 = load i32*, i32** %8
%62 = call i32 @read_int(i8* %60, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32* %61)
%63 = load i8**, i8*** %14
%64 = getelementptr inbounds i8*, i8** %63, i64 1
%65 = load i8*, i8** %64
%66 = load i32*, i32** %11
%67 = call i32 @read_int(i8* %65, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32* %66)
%68 = load i8**, i8*** %14
%69 = getelementptr inbounds i8*, i8** %68, i64 1
%70 = load i8*, i8** %69
%71 = load i32*, i32** %12
%72 = call i32 @read_int(i8* %70, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), i32* %71)
ret i32 1
}

LLVM IR (-O2):
@.str = [188 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/nyxcalamity/classwork/refs/heads/master/tum/computational-fluid-dynamics/ws2/src/initialization.c\00"
@.str.1 = [64 x i8] c"Not enough arguments. At least a path to init file is required.\00"
@R_OK = global i32 0
@.str.2 = [60 x i8] c"Provided file path either doesn't exist or can not be read.\00"
@.str.3 = [5 x i8] c"*tau\00"
@.str.4 = [17 x i8] c"*velocity_wall_1\00"
@.str.5 = [17 x i8] c"*velocity_wall_2\00"
@.str.6 = [17 x i8] c"*velocity_wall_3\00"
@.str.7 = [9 x i8] c"*xlength\00"
@.str.8 = [11 x i8] c"*timesteps\00"
@.str.9 = [24 x i8] c"*timesteps_per_plotting\00"
define i32 @readParameters(i32* %0, double* %1, double* %2, i32* %3, i32* %4, i32 %5, i8** nocapture %6) {
%8 = icmp slt i32 %5, 2
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call i32 @errhandler(i32 10, i8* getelementptr inbounds ([188 x i8], [188 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %7
%12 = getelementptr inbounds i8*, i8** %6, i64 1
%13 = load i8*, i8** %12
%14 = load i32, i32* @R_OK
%15 = tail call i64 @access(i8* %13, i32 %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %11
%18 = tail call i32 @errhandler(i32 12, i8* getelementptr inbounds ([188 x i8], [188 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17, %11
%20 = load i8*, i8** %12
%21 = tail call i32 @read_double(i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double* %1)
%22 = getelementptr inbounds double, double* %2, i64 1
%23 = getelementptr inbounds double, double* %2, i64 2
%24 = load i8*, i8** %12
%25 = tail call i32 @read_double(i8* %24, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), double* %2)
%26 = load i8*, i8** %12
%27 = tail call i32 @read_double(i8* %26, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), double* %22)
%28 = load i8*, i8** %12
%29 = tail call i32 @read_double(i8* %28, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), double* %23)
%30 = load i8*, i8** %12
%31 = tail call i32 @read_int(i8* %30, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32* %0)
%32 = load i8*, i8** %12
%33 = tail call i32 @read_int(i8* %32, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32* %3)
%34 = load i8*, i8** %12
%35 = tail call i32 @read_int(i8* %34, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), i32* %4)
ret i32 1
}