#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*/ Usage(char *);
int atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void Get_args(int argc, char *argv[], int *n_p, char *g_i_p) {
  if (argc != 3) {
    Usage(argv[0]);
    exit(0);
  }
  *n_p = atoi(argv[1]);
  *g_i_p = argv[2][0];
  if (*n_p <= 0 || (*g_i_p != 'g' && *g_i_p != 'i')) {
    Usage(argv[0]);
    exit(0);
  }
}


x86 assembly (clang, -O0):
<Get_args>:
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)
je     1164 <Get_args+0x34>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <Usage@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
jle    11b6 <Get_args+0x86>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x67,%eax
je     11c9 <Get_args+0x99>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x69,%eax
je     11c9 <Get_args+0x99>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <Usage@plt>
xor    %edi,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Get_args>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
cmp    $0x3,%edi
jne    116a <Get_args+0x3a>
mov    %rcx,%r15
mov    %rdx,%rbx
mov    0x8(%r14),%rdi
call   1040 <atoi@plt>
mov    %eax,(%rbx)
mov    0x10(%r14),%rax
mov    (%rax),%al
mov    %al,(%r15)
cmpl   $0x0,(%rbx)
jle    116a <Get_args+0x3a>
cmp    $0x67,%al
je     1164 <Get_args+0x34>
cmp    $0x69,%al
jne    116a <Get_args+0x3a>
pop    %rbx
pop    %r14
pop    %r15
ret
mov    (%r14),%rdi
call   1030 <Usage@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
define void @Get_args(i32 %0, i8** %1, i32* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i32*
%8 = alloca i8*
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i32* %2, i32** %7
store i8* %3, i8** %8
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 3
br i1 %10, label %11, label %17
11: ; preds = %4
%12 = load i8**, i8*** %6
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @Usage(i8* %14)
%16 = call i32 @exit(i32 0)
unreachable
17: ; preds = %4
%18 = load i8**, i8*** %6
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @atoi(i8* %20)
%22 = load i32*, i32** %7
store i32 %21, i32* %22
%23 = load i8**, i8*** %6
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = getelementptr inbounds i8, i8* %25, i64 0
%27 = load i8, i8* %26
%28 = load i8*, i8** %8
store i8 %27, i8* %28
%29 = load i32*, i32** %7
%30 = load i32, i32* %29
%31 = icmp sle i32 %30, 0
br i1 %31, label %42, label %32
32: ; preds = %17
%33 = load i8*, i8** %8
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp ne i32 %35, 103
br i1 %36, label %37, label %48
37: ; preds = %32
%38 = load i8*, i8** %8
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp ne i32 %40, 105
br i1 %41, label %42, label %48
42: ; preds = %37, %17
%43 = load i8**, i8*** %6
%44 = getelementptr inbounds i8*, i8** %43, i64 0
%45 = load i8*, i8** %44
%46 = call i32 @Usage(i8* %45)
%47 = call i32 @exit(i32 0)
unreachable
48: ; preds = %37, %32
ret void
}

LLVM IR (-O2):
define void @Get_args(i32 %0, i8** nocapture %1, i32* nocapture %2, i8* nocapture writeonly %3) {
%5 = icmp eq i32 %0, 3
br i1 %5, label %10, label %6
6: ; preds = %4
%7 = load i8*, i8** %1
%8 = tail call i32 @Usage(i8* %7)
%9 = tail call i32 @exit(i32 0)
unreachable
10: ; preds = %4
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
store i32 %13, i32* %2
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = load i8, i8* %15
store i8 %16, i8* %3
%17 = load i32, i32* %2
%18 = icmp slt i32 %17, 1
br i1 %18, label %20, label %19
19: ; preds = %10
switch i8 %16, label %20 [
i8 103, label %24
i8 105, label %24
]
20: ; preds = %19, %10
%21 = load i8*, i8** %1
%22 = tail call i32 @Usage(i8* %21)
%23 = tail call i32 @exit(i32 0)
unreachable
24: ; preds = %19, %19
ret void
}