#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 *, ...);
scalar_t__ strncmp(char *, char *, int);
void arg_control(int argc, char *argv[]) {
  if (argc > 4) {
    printf("\nIncorrect arguments number!!\nMode \"-e\" takes exactly two "
           "arguments.\nMode \"-d\" takes exactly one argument.");
    exit(1);
  }
  if ((argc != 3) && (strncmp(argv[1], "-d", 2) == 0)) {
    printf("\nThe \"-d\" mode takes exactly one argument.\n");
    exit(1);
  }
  if ((argc != 4) && (strncmp(argv[1], "-e", 2) == 0)) {
    printf("\nThe \"-e\" mode takes exactly two arguments.\n");
    exit(1);
  }
  if (!strncmp(argv[1], "-d", 2) && !strncmp(argv[1], "-e", 2)) {
    printf("\nMode \"%s\" not recognized\n", argv[1]);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<arg_control>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x4(%rbp)
jle    1161 <arg_control+0x31>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
cmpl   $0x3,-0x4(%rbp)
je     11a6 <arg_control+0x76>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xef1(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11a6 <arg_control+0x76>
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
cmpl   $0x4,-0x4(%rbp)
je     11eb <arg_control+0xbb>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xedb(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11eb <arg_control+0xbb>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe71(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1251 <arg_control+0x121>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe7d(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1251 <arg_control+0x121>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arg_control>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x5,%edi
jge    11c6 <arg_control+0x86>
mov    %rsi,%rbx
mov    %edi,%ebp
cmp    $0x3,%edi
je     1171 <arg_control+0x31>
mov    0x8(%rbx),%rdi
lea    0xf0e(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11e7 <arg_control+0xa7>
cmp    $0x4,%ebp
je     118b <arg_control+0x4b>
mov    0x8(%rbx),%rdi
lea    0xef2(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11de <arg_control+0x9e>
mov    0x8(%rbx),%rdi
lea    0xed5(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    11bf <arg_control+0x7f>
mov    0x8(%rbx),%rdi
lea    0xebe(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11fd <arg_control+0xbd>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe33(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    0xea7(%rip),%rdi
jmp    11ee <arg_control+0xae>
lea    0xeca(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    0x8(%rbx),%rsi
lea    0xe69(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [107 x i8] c"\0AIncorrect arguments number!!\0AMode \22-e\22 takes exactly two arguments.\0AMode \22-d\22 takes exactly one argument.\00"
@.str.1 = [3 x i8] c"-d\00"
@.str.2 = [44 x i8] c"\0AThe \22-d\22 mode takes exactly one argument.\0A\00"
@.str.3 = [3 x i8] c"-e\00"
@.str.4 = [45 x i8] c"\0AThe \22-e\22 mode takes exactly two arguments.\0A\00"
@.str.5 = [27 x i8] c"\0AMode \22%s\22 not recognized\0A\00"
define void @arg_control(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp sgt i32 %5, 4
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([107 x i8], [107 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = load i32, i32* %3
%12 = icmp ne i32 %11, 3
br i1 %12, label %13, label %22
13: ; preds = %10
%14 = load i8**, i8*** %4
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i64 @strncmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %13
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %13, %10
%23 = load i32, i32* %3
%24 = icmp ne i32 %23, 4
br i1 %24, label %25, label %34
25: ; preds = %22
%26 = load i8**, i8*** %4
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i64 @strncmp(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 2)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %25
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0))
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %25, %22
%35 = load i8**, i8*** %4
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = call i64 @strncmp(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%39 = icmp ne i64 %38, 0
br i1 %39, label %52, label %40
40: ; preds = %34
%41 = load i8**, i8*** %4
%42 = getelementptr inbounds i8*, i8** %41, i64 1
%43 = load i8*, i8** %42
%44 = call i64 @strncmp(i8* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 2)
%45 = icmp ne i64 %44, 0
br i1 %45, label %52, label %46
46: ; preds = %40
%47 = load i8**, i8*** %4
%48 = getelementptr inbounds i8*, i8** %47, i64 1
%49 = load i8*, i8** %48
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i8* %49)
%51 = call i32 @exit(i32 1)
unreachable
52: ; preds = %40, %34
ret void
}

LLVM IR (-O2):
@.str = [107 x i8] c"\0AIncorrect arguments number!!\0AMode \22-e\22 takes exactly two arguments.\0AMode \22-d\22 takes exactly one argument.\00"
@.str.1 = [3 x i8] c"-d\00"
@.str.3 = [3 x i8] c"-e\00"
@.str.5 = [27 x i8] c"\0AMode \22%s\22 not recognized\0A\00"
@str = [44 x i8] c"\0AThe \22-e\22 mode takes exactly two arguments.\00"
@str.6 = [43 x i8] c"\0AThe \22-d\22 mode takes exactly one argument.\00"
define void @arg_control(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 4
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([107 x i8], [107 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %2
%8 = icmp eq i32 %0, 3
br i1 %8, label %19, label %9
9: ; preds = %7
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i64 @strncmp(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.6, i64 0, i64 0))
%16 = tail call i32 @exit(i32 1)
unreachable
17: ; preds = %9
%18 = icmp eq i32 %0, 4
br i1 %18, label %27, label %19
19: ; preds = %7, %17
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = tail call i64 @strncmp(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 2)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %19
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%26 = tail call i32 @exit(i32 1)
unreachable
27: ; preds = %19, %17
%28 = getelementptr inbounds i8*, i8** %1, i64 1
%29 = load i8*, i8** %28
%30 = tail call i64 @strncmp(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %40
32: ; preds = %27
%33 = load i8*, i8** %28
%34 = tail call i64 @strncmp(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 2)
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %32
%37 = load i8*, i8** %28
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i8* %37)
%39 = tail call i32 @exit(i32 1)
unreachable
40: ; preds = %32, %27
ret void
}