#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 *);
int getArgs(int argc, char **argv, int *nX, int *nY) {
  if (argc == 3) {
    sscanf(argv[1], "%d", &(*nX));
    sscanf(argv[2], "%d", &(*nY));
  } else {
    printf("\n*** User Error: Command line arguments needed! ***\n\n");
    printf("Please run with the following arguments:\n\n");
    printf("./poisson2D <number of data points in X> <number of data points in "
           "Y>\n\n");
    printf("Exiting...\n\n");
    exit(-1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<getArgs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x3,-0x4(%rbp)
jne    1186 <getArgs+0x56>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe9c(%rip),%rsi
call   1040 <sscanf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe84(%rip),%rsi
call   1040 <sscanf@plt>
jmp    11c0 <getArgs+0x90>
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
lea    0xefb(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getArgs>:
push   %r15
push   %r14
push   %rbx
cmp    $0x3,%edi
jne    116a <getArgs+0x3a>
mov    %rcx,%r14
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xeb5(%rip),%r15
mov    %r15,%rsi
call   1040 <sscanf@plt>
mov    0x10(%rbx),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1040 <sscanf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe92(%rip),%rdi
call   1030 <puts@plt>
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
lea    0xf14(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [54 x i8] c"\0A*** User Error: Command line arguments needed! ***\0A\0A\00"
@.str.2 = [43 x i8] c"Please run with the following arguments:\0A\0A\00"
@.str.3 = [72 x i8] c"./poisson2D <number of data points in X> <number of data points in Y>\0A\0A\00"
@.str.4 = [13 x i8] c"Exiting...\0A\0A\00"
define i32 @getArgs(i32 %0, i8** %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i32*
%8 = alloca i32*
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 3
br i1 %10, label %11, label %22
11: ; preds = %4
%12 = load i8**, i8*** %6
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = load i32*, i32** %7
%16 = call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %15)
%17 = load i8**, i8*** %6
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = load i32*, i32** %8
%21 = call i32 @sscanf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %20)
br label %28
22: ; preds = %4
%23 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%24 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%25 = call i32 @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.3, i64 0, i64 0))
%26 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%27 = call i32 @exit(i32 -1)
unreachable
28: ; preds = %11
ret i32 0
}

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