#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*/ exit(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sscanf(char *, char *, ...);
int getArgs(int argc, char **argv, double *step, double *totalTime,
            int *interval) {
  if (argc == 4) {
    sscanf(argv[1], "%lf", &(*step));
    sscanf(argv[2], "%lf", &(*totalTime));
    sscanf(argv[3], "%d", &(*interval));
  } else {
    printf("\n*** User Error: Command line arguments needed! ***\n\n");
    printf("Please run with the following arguments:\n\n");
    printf("./RK4_1 <timestep> <length> <output interval>\n\n");
    printf("Exiting...\n\n");
    exit(-1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<getArgs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpl   $0x4,-0x4(%rbp)
jne    11a8 <getArgs+0x78>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe98(%rip),%rsi
mov    $0x0,%al
call   1040 <sscanf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe7e(%rip),%rsi
mov    $0x0,%al
call   1040 <sscanf@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
mov    -0x28(%rbp),%rdx
lea    0xe68(%rip),%rsi
mov    $0x0,%al
call   1040 <sscanf@plt>
jmp    11e2 <getArgs+0xb2>
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getArgs>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x4,%edi
jne    118f <getArgs+0x5f>
mov    %r8,%r14
mov    %rcx,%r15
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xeaf(%rip),%r12
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <sscanf@plt>
mov    0x10(%rbx),%rdi
mov    %r12,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
mov    0x18(%rbx),%rdi
lea    0xe8d(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xe71(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9a(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [54 x i8] c"\0A*** User Error: Command line arguments needed! ***\0A\0A\00"
@.str.3 = [43 x i8] c"Please run with the following arguments:\0A\0A\00"
@.str.4 = [48 x i8] c"./RK4_1 <timestep> <length> <output interval>\0A\0A\00"
@.str.5 = [13 x i8] c"Exiting...\0A\0A\00"
define i32 @getArgs(i32 %0, i8** %1, double* %2, double* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i8**
%8 = alloca double*
%9 = alloca double*
%10 = alloca i32*
store i32 %0, i32* %6
store i8** %1, i8*** %7
store double* %2, double** %8
store double* %3, double** %9
store i32* %4, i32** %10
%11 = load i32, i32* %6
%12 = icmp eq i32 %11, 4
br i1 %12, label %13, label %29
13: ; preds = %5
%14 = load i8**, i8*** %7
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = load double*, double** %8
%18 = call i32 (i8*, i8*, ...) @sscanf(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %17)
%19 = load i8**, i8*** %7
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = load double*, double** %9
%23 = call i32 (i8*, i8*, ...) @sscanf(i8* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %22)
%24 = load i8**, i8*** %7
%25 = getelementptr inbounds i8*, i8** %24, i64 3
%26 = load i8*, i8** %25
%27 = load i32*, i32** %10
%28 = call i32 (i8*, i8*, ...) @sscanf(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %27)
br label %35
29: ; preds = %5
%30 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0))
%31 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%32 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0))
%33 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%34 = call i32 @exit(i32 -1)
unreachable
35: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [3 x i8] c"%d\00"
@str = [53 x i8] c"\0A*** User Error: Command line arguments needed! ***\0A\00"
@str.6 = [42 x i8] c"Please run with the following arguments:\0A\00"
@str.7 = [47 x i8] c"./RK4_1 <timestep> <length> <output interval>\0A\00"
@str.8 = [12 x i8] c"Exiting...\0A\00"
define i32 @getArgs(i32 %0, i8** nocapture %1, double* %2, double* %3, i32* %4) {
%6 = icmp eq i32 %0, 4
br i1 %6, label %7, label %17
7: ; preds = %5
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 (i8*, i8*, ...) @sscanf(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 (i8*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %3)
%14 = getelementptr inbounds i8*, i8** %1, i64 3
%15 = load i8*, i8** %14
%16 = tail call i32 (i8*, i8*, ...) @sscanf(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
ret i32 0
17: ; preds = %5
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.6, i64 0, i64 0))
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.7, i64 0, i64 0))
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.8, i64 0, i64 0))
%22 = tail call i32 @exit(i32 -1)
unreachable
}