#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*/ fprintf(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcat(char *, char *);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int system(char *);
int main(int argc, char **argv) {
  int verbose = 0;
  int i;
  char cmd[2048];
  char *pch;
  int res;
  strcpy(cmd, "Rscript -e ursa::glance()");
  for (i = 1; i < argc; i++) {
    pch = strchr(argv[i], ' ');
    if (verbose)
      fprintf(stdout, "%d: %s\n", i, argv[i]);
    strcat(cmd, " ");
    if (pch != NULL)
      strcat(cmd, "\"");
    strcat(cmd, argv[i]);
    if (pch != NULL)
      strcat(cmd, "\"");
  }
  if (verbose)
    fprintf(stdout, "%d: %s\n", i, argv[i]);
  res = system(cmd);
  return res;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x830,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x820(%rbp),%rdi
lea    0xe82(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1261 <main+0x111>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    $0x20,%esi
call   1050 <strchr@plt>
mov    %rax,-0x828(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11e1 <main+0x91>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xe3e(%rip),%rsi
call   1060 <fprintf@plt>
lea    -0x820(%rbp),%rdi
lea    0xe33(%rip),%rsi
call   1070 <strcat@plt>
cmpq   $0x0,-0x828(%rbp)
je     1215 <main+0xc5>
lea    -0x820(%rbp),%rdi
lea    0xe14(%rip),%rsi
call   1070 <strcat@plt>
lea    -0x820(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1070 <strcat@plt>
cmpq   $0x0,-0x828(%rbp)
je     124e <main+0xfe>
lea    -0x820(%rbp),%rdi
lea    0xddb(%rip),%rsi
call   1070 <strcat@plt>
jmp    1253 <main+0x103>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    118a <main+0x3a>
cmpl   $0x0,-0x14(%rbp)
je     128f <main+0x13f>
mov    0x2d6e(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xd90(%rip),%rsi
call   1060 <fprintf@plt>
lea    -0x820(%rbp),%rdi
call   1040 <system@plt>
mov    %eax,-0x82c(%rbp)
mov    -0x82c(%rbp),%eax
add    $0x830,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x808,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xea3(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
cmp    $0x2,%ebp
jl     11d6 <main+0x96>
mov    %ebp,%r13d
mov    $0x1,%r14d
mov    %rsp,%r15
lea    0xe9f(%rip),%r12
jmp    1195 <main+0x55>
nop
mov    (%rbx,%r14,8),%rsi
mov    %r15,%rdi
call   1060 <strcat@plt>
add    $0x1,%r14
cmp    %r14,%r13
je     11d6 <main+0x96>
mov    (%rbx,%r14,8),%rdi
mov    $0x20,%esi
call   1050 <strchr@plt>
mov    %rax,%rbp
mov    %r15,%rdi
lea    0xe6a(%rip),%rsi
call   1060 <strcat@plt>
test   %rbp,%rbp
je     1180 <main+0x40>
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <strcat@plt>
mov    (%rbx,%r14,8),%rsi
mov    %r15,%rdi
call   1060 <strcat@plt>
mov    %r12,%rsi
jmp    1184 <main+0x44>
mov    %rsp,%rdi
call   1040 <system@plt>
add    $0x808,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Rscript -e ursa::glance()\00"
@stdout = global i32 0
@.str.1 = [8 x i8] c"%d: %s\0A\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [2 x i8] c"\22\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 [2048 x i8]
%9 = alloca i8*
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%11 = getelementptr inbounds [2048 x i8], [2048 x i8]* %8, i64 0, i64 0
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %7
br label %13
13: ; preds = %57, %2
%14 = load i32, i32* %7
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %60
17: ; preds = %13
%18 = load i8**, i8*** %5
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i8* @strchr(i8* %22, i8 signext 32)
store i8* %23, i8** %9
%24 = load i32, i32* %6
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %35
26: ; preds = %17
%27 = load i32, i32* @stdout
%28 = load i32, i32* %7
%29 = load i8**, i8*** %5
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %29, i64 %31
%33 = load i8*, i8** %32
%34 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %28, i8* %33)
br label %35
35: ; preds = %26, %17
%36 = getelementptr inbounds [2048 x i8], [2048 x i8]* %8, i64 0, i64 0
%37 = call i32 @strcat(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%38 = load i8*, i8** %9
%39 = icmp ne i8* %38, null
br i1 %39, label %40, label %43
40: ; preds = %35
%41 = getelementptr inbounds [2048 x i8], [2048 x i8]* %8, i64 0, i64 0
%42 = call i32 @strcat(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %43
43: ; preds = %40, %35
%44 = getelementptr inbounds [2048 x i8], [2048 x i8]* %8, i64 0, i64 0
%45 = load i8**, i8*** %5
%46 = load i32, i32* %7
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %45, i64 %47
%49 = load i8*, i8** %48
%50 = call i32 @strcat(i8* %44, i8* %49)
%51 = load i8*, i8** %9
%52 = icmp ne i8* %51, null
br i1 %52, label %53, label %56
53: ; preds = %43
%54 = getelementptr inbounds [2048 x i8], [2048 x i8]* %8, i64 0, i64 0
%55 = call i32 @strcat(i8* %54, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %56
56: ; preds = %53, %43
br label %57
57: ; preds = %56
%58 = load i32, i32* %7
%59 = add nsw i32 %58, 1
store i32 %59, i32* %7
br label %13
60: ; preds = %13
%61 = load i32, i32* %6
%62 = icmp ne i32 %61, 0
br i1 %62, label %63, label %72
63: ; preds = %60
%64 = load i32, i32* @stdout
%65 = load i32, i32* %7
%66 = load i8**, i8*** %5
%67 = load i32, i32* %7
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8*, i8** %66, i64 %68
%70 = load i8*, i8** %69
%71 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %65, i8* %70)
br label %72
72: ; preds = %63, %60
%73 = getelementptr inbounds [2048 x i8], [2048 x i8]* %8, i64 0, i64 0
%74 = call i32 @system(i8* %73)
store i32 %74, i32* %10
%75 = load i32, i32* %10
ret i32 %75
}

LLVM IR (-O2):
@.str = [26 x i8] c"Rscript -e ursa::glance()\00"
@stdout = global i32 0
@.str.2 = [2 x i8] c" \00"
@.str.3 = [2 x i8] c"\22\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2048 x i8]
%4 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%6 = icmp sgt i32 %0, 1
br i1 %6, label %7, label %27
7: ; preds = %2
%8 = zext i32 %0 to i64
br label %9
9: ; preds = %7, %22
%10 = phi i64 [ 1, %7 ], [ %25, %22 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = load i8*, i8** %11
%13 = call i8* @strchr(i8* dereferenceable(1) %12, i8 signext 32)
%14 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i8* %13, null
br i1 %15, label %20, label %16
16: ; preds = %9
%17 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%18 = load i8*, i8** %11
%19 = call i32 @strcat(i8* %4, i8* %18)
br label %22
20: ; preds = %9
%21 = load i8*, i8** %11
br label %22
22: ; preds = %20, %16
%23 = phi i8* [ %21, %20 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), %16 ]
%24 = call i32 @strcat(i8* %4, i8* %23)
%25 = add nuw nsw i64 %10, 1
%26 = icmp eq i64 %25, %8
br i1 %26, label %27, label %9
27: ; preds = %22, %2
%28 = call i32 @system(i8* %4)
ret i32 %28
}