#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*/ printf(char *, char *);
int repl();
int run(char *);
int main(int argc, char **argv) {
  switch (argc) {
  case 1:
    return repl();
  case 2:
    return run(argv[1]);
  default:
    printf("Usage: %s [SCRIPT URL]\n", argv[0]);
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     116b <main+0x3b>
jmp    115a <main+0x2a>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     117a <main+0x4a>
jmp    118f <main+0x5f>
mov    $0x0,%al
call   1030 <repl@plt>
mov    %eax,-0x4(%rbp)
jmp    11a9 <main+0x79>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <run@plt>
mov    %eax,-0x4(%rbp)
jmp    11a9 <main+0x79>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe63(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
je     1143 <main+0x13>
cmp    $0x1,%edi
jne    114d <main+0x1d>
xor    %eax,%eax
pop    %rcx
jmp    1030 <repl@plt>
mov    0x8(%rsi),%rdi
pop    %rax
jmp    1040 <run@plt>
mov    (%rsi),%rsi
lea    0xea9(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Usage: %s [SCRIPT URL]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
switch i32 %6, label %14 [
i32 1, label %7
i32 2, label %9
]
7: ; preds = %2
%8 = call i32 (...) @repl()
store i32 %8, i32* %3
br label %20
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @run(i8* %12)
store i32 %13, i32* %3
br label %20
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %17)
br label %19
19: ; preds = %14
store i32 0, i32* %3
br label %20
20: ; preds = %19, %9, %7
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@.str = [24 x i8] c"Usage: %s [SCRIPT URL]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %9 [
i32 1, label %3
i32 2, label %5
]
3: ; preds = %2
%4 = tail call i32 (...) @repl()
br label %12
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @run(i8* %7)
br label %12
9: ; preds = %2
%10 = load i8*, i8** %1
%11 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %9, %5, %3
%13 = phi i32 [ 0, %9 ], [ %8, %5 ], [ %4, %3 ]
ret i32 %13
}