#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 /*<<< orphan*/);
int /*<<< orphan*/ putenv(char *);
int /*<<< orphan*/ rcmdfn(int, int, char **);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  int cmdarg = 0;
  if (argc > 1) {
    if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0)
      cmdarg = 1;
    else {
      for (int i = 1; i < argc; i++)
        if (strcmp(argv[i], "CMD") == 0) {
          cmdarg = i + 1;
          break;
        }
      if (cmdarg >= 3) {
        char *Init = "R_PROFILE_USER=\r", *Site = "R_RPOFILE=\r",
             *Env1 = "R_ENVIRON=\r", *Env2 = "R_ENVIRON_USER=\r";
        for (int i = 1; i < cmdarg; i++) {
          char *a = argv[i];
          if (strcmp(a, "--no-init-file") == 0 || strcmp(a, "--vanilla") == 0)
            putenv(Init);
          if (strcmp(a, "--no-site-file") == 0 || strcmp(a, "--vanilla") == 0)
            putenv(Site);
          if (strcmp(a, "--no-environ") == 0 || strcmp(a, "--vanilla") == 0) {
            putenv(Env1);
            putenv(Env2);
          }
        }
      }
    }
  }
  exit(rcmdfn(cmdarg, argc, argv));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1340 <main+0x200>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe8a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11a3 <main+0x63>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe6f(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11af <main+0x6f>
movl   $0x1,-0x14(%rbp)
jmp    133b <main+0x1fb>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1205 <main+0xc5>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe35(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11f2 <main+0xb2>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1205 <main+0xc5>
jmp    11f7 <main+0xb7>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11b6 <main+0x76>
cmpl   $0x3,-0x14(%rbp)
jl     1336 <main+0x1f6>
lea    0xdf8(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xdfe(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xdff(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe00(%rip),%rax
mov    %rax,-0x38(%rbp)
movl   $0x1,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1331 <main+0x1f1>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
lea    0xddf(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1292 <main+0x152>
mov    -0x48(%rbp),%rdi
lea    0xdd4(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    129b <main+0x15b>
mov    -0x20(%rbp),%rdi
call   1040 <putenv@plt>
mov    -0x48(%rbp),%rdi
lea    0xdbb(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     12cf <main+0x18f>
mov    -0x48(%rbp),%rdi
lea    0xd97(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12d8 <main+0x198>
mov    -0x28(%rbp),%rdi
call   1040 <putenv@plt>
mov    -0x48(%rbp),%rdi
lea    0xd8d(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     130c <main+0x1cc>
mov    -0x48(%rbp),%rdi
lea    0xd5a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    131e <main+0x1de>
mov    -0x30(%rbp),%rdi
call   1040 <putenv@plt>
mov    -0x38(%rbp),%rdi
call   1040 <putenv@plt>
jmp    1323 <main+0x1e3>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1242 <main+0x102>
jmp    1336 <main+0x1f6>
jmp    133b <main+0x1fb>
jmp    1340 <main+0x200>
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <rcmdfn@plt>
mov    %eax,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r15
mov    %edi,%r14d
cmp    $0x2,%edi
jl     11ba <main+0x7a>
mov    0x8(%r15),%rdi
lea    0xe9c(%rip),%rsi
call   1050 <strcmp@plt>
mov    $0x1,%ebx
test   %rax,%rax
je     11bc <main+0x7c>
mov    0x8(%r15),%rdi
lea    0xe85(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11bc <main+0x7c>
mov    %r14d,%ebx
mov    $0x1,%r13d
lea    0xe72(%rip),%rbp
nopl   0x0(%rax,%rax,1)
mov    (%r15,%r13,8),%rdi
mov    %rbp,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11d0 <main+0x90>
add    $0x1,%r13
cmp    %r13,%rbx
jne    11a0 <main+0x60>
xor    %ebx,%ebx
mov    %ebx,%edi
mov    %r14d,%esi
mov    %r15,%rdx
call   1030 <rcmdfn@plt>
mov    %eax,%edi
call   1060 <exit@plt>
lea    0x1(%r13),%rbx
cmp    $0x1,%r13d
jbe    11bc <main+0x7c>
mov    %rbx,0x10(%rsp)
mov    %r14d,0xc(%rsp)
xor    %ebp,%ebp
lea    0xe83(%rip),%rbx
lea    0xe63(%rip),%r12
jmp    1225 <main+0xe5>
cs nopw 0x0(%rax,%rax,1)
lea    0xe24(%rip),%rdi
call   1040 <putenv@plt>
lea    0xe24(%rip),%rdi
call   1040 <putenv@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
je     12b7 <main+0x177>
mov    0x8(%r15,%rbp,8),%r14
mov    %r14,%rdi
lea    0xe14(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     124e <main+0x10e>
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    125a <main+0x11a>
lea    0xdb9(%rip),%rdi
call   1040 <putenv@plt>
mov    %r14,%rdi
lea    0xdfd(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     127e <main+0x13e>
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    128a <main+0x14a>
lea    0xd9a(%rip),%rdi
call   1040 <putenv@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1200 <main+0xc0>
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    1218 <main+0xd8>
jmp    1200 <main+0xc0>
mov    0xc(%rsp),%r14d
mov    0x10(%rsp),%rbx
jmp    11bc <main+0x7c>

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [4 x i8] c"CMD\00"
@.str.3 = [17 x i8] c"R_PROFILE_USER=\0D\00"
@.str.4 = [12 x i8] c"R_RPOFILE=\0D\00"
@.str.5 = [12 x i8] c"R_ENVIRON=\0D\00"
@.str.6 = [17 x i8] c"R_ENVIRON_USER=\0D\00"
@.str.7 = [15 x i8] c"--no-init-file\00"
@.str.8 = [10 x i8] c"--vanilla\00"
@.str.9 = [15 x i8] c"--no-site-file\00"
@.str.10 = [13 x i8] c"--no-environ\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 1
br i1 %15, label %16, label %104
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %28, label %22
22: ; preds = %16
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %22, %16
store i32 1, i32* %6
br label %103
29: ; preds = %22
store i32 1, i32* %7
br label %30
30: ; preds = %46, %29
%31 = load i32, i32* %7
%32 = load i32, i32* %4
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %49
34: ; preds = %30
%35 = load i8**, i8*** %5
%36 = load i32, i32* %7
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8*, i8** %35, i64 %37
%39 = load i8*, i8** %38
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %34
%43 = load i32, i32* %7
%44 = add nsw i32 %43, 1
store i32 %44, i32* %6
br label %49
45: ; preds = %34
br label %46
46: ; preds = %45
%47 = load i32, i32* %7
%48 = add nsw i32 %47, 1
store i32 %48, i32* %7
br label %30
49: ; preds = %42, %30
%50 = load i32, i32* %6
%51 = icmp sge i32 %50, 3
br i1 %51, label %52, label %102
52: ; preds = %49
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8** %8
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8** %9
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8** %10
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i8** %11
store i32 1, i32* %12
br label %53
53: ; preds = %98, %52
%54 = load i32, i32* %12
%55 = load i32, i32* %6
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %101
57: ; preds = %53
%58 = load i8**, i8*** %5
%59 = load i32, i32* %12
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8*, i8** %58, i64 %60
%62 = load i8*, i8** %61
store i8* %62, i8** %13
%63 = load i8*, i8** %13
%64 = call i64 @strcmp(i8* %63, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%65 = icmp eq i64 %64, 0
br i1 %65, label %70, label %66
66: ; preds = %57
%67 = load i8*, i8** %13
%68 = call i64 @strcmp(i8* %67, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%69 = icmp eq i64 %68, 0
br i1 %69, label %70, label %73
70: ; preds = %66, %57
%71 = load i8*, i8** %8
%72 = call i32 @putenv(i8* %71)
br label %73
73: ; preds = %70, %66
%74 = load i8*, i8** %13
%75 = call i64 @strcmp(i8* %74, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
%76 = icmp eq i64 %75, 0
br i1 %76, label %81, label %77
77: ; preds = %73
%78 = load i8*, i8** %13
%79 = call i64 @strcmp(i8* %78, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%80 = icmp eq i64 %79, 0
br i1 %80, label %81, label %84
81: ; preds = %77, %73
%82 = load i8*, i8** %9
%83 = call i32 @putenv(i8* %82)
br label %84
84: ; preds = %81, %77
%85 = load i8*, i8** %13
%86 = call i64 @strcmp(i8* %85, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
%87 = icmp eq i64 %86, 0
br i1 %87, label %92, label %88
88: ; preds = %84
%89 = load i8*, i8** %13
%90 = call i64 @strcmp(i8* %89, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%91 = icmp eq i64 %90, 0
br i1 %91, label %92, label %97
92: ; preds = %88, %84
%93 = load i8*, i8** %10
%94 = call i32 @putenv(i8* %93)
%95 = load i8*, i8** %11
%96 = call i32 @putenv(i8* %95)
br label %97
97: ; preds = %92, %88
br label %98
98: ; preds = %97
%99 = load i32, i32* %12
%100 = add nsw i32 %99, 1
store i32 %100, i32* %12
br label %53
101: ; preds = %53
br label %102
102: ; preds = %101, %49
br label %103
103: ; preds = %102, %28
br label %104
104: ; preds = %103, %2
%105 = load i32, i32* %6
%106 = load i32, i32* %4
%107 = load i8**, i8*** %5
%108 = call i32 @rcmdfn(i32 %105, i32 %106, i8** %107)
%109 = call i32 @exit(i32 %108)
unreachable
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [4 x i8] c"CMD\00"
@.str.3 = [17 x i8] c"R_PROFILE_USER=\0D\00"
@.str.4 = [12 x i8] c"R_RPOFILE=\0D\00"
@.str.5 = [12 x i8] c"R_ENVIRON=\0D\00"
@.str.6 = [17 x i8] c"R_ENVIRON_USER=\0D\00"
@.str.7 = [15 x i8] c"--no-init-file\00"
@.str.8 = [10 x i8] c"--vanilla\00"
@.str.9 = [15 x i8] c"--no-site-file\00"
@.str.10 = [13 x i8] c"--no-environ\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %61
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %61, label %9
9: ; preds = %4
%10 = load i8*, i8** %5
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %61, label %13
13: ; preds = %9
%14 = zext i32 %0 to i64
br label %15
15: ; preds = %13, %21
%16 = phi i64 [ 1, %13 ], [ %22, %21 ]
%17 = getelementptr inbounds i8*, i8** %1, i64 %16
%18 = load i8*, i8** %17
%19 = tail call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %15
%22 = add nuw nsw i64 %16, 1
%23 = icmp eq i64 %22, %14
br i1 %23, label %61, label %15
24: ; preds = %15
%25 = trunc i64 %16 to i32
%26 = add nuw nsw i32 %25, 1
%27 = icmp ugt i32 %25, 1
br i1 %27, label %28, label %61
28: ; preds = %24
%29 = zext i32 %26 to i64
br label %30
30: ; preds = %28, %58
%31 = phi i64 [ 1, %28 ], [ %59, %58 ]
%32 = getelementptr inbounds i8*, i8** %1, i64 %31
%33 = load i8*, i8** %32
%34 = tail call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %39, label %36
36: ; preds = %30
%37 = tail call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %36, %30
%40 = tail call i32 @putenv(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %41
41: ; preds = %39, %36
%42 = tail call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %47, label %44
44: ; preds = %41
%45 = tail call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %44, %41
%48 = tail call i32 @putenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %49
49: ; preds = %47, %44
%50 = tail call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %55, label %52
52: ; preds = %49
%53 = tail call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %52, %49
%56 = tail call i32 @putenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%57 = tail call i32 @putenv(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
br label %58
58: ; preds = %55, %52
%59 = add nuw nsw i64 %31, 1
%60 = icmp eq i64 %59, %29
br i1 %60, label %61, label %30
61: ; preds = %21, %58, %4, %9, %24, %2
%62 = phi i32 [ %26, %24 ], [ 0, %2 ], [ 1, %9 ], [ 1, %4 ], [ %26, %58 ], [ 0, %21 ]
%63 = tail call i32 @rcmdfn(i32 %62, i32 %0, i8** %1)
%64 = tail call i32 @exit(i32 %63)
unreachable
}