#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 *, ...);
int main(int argc, char **argv) {
  if (argc > 2) {
    printf("none or one arg\n");
    return -1;
  }
  if (argv[1] != NULL && argv[1][0] == '-') {
    printf("no options\n");
    return -1;
  }
  if (argv[1] == NULL) {
    while (1)
      printf("y\n");
  } else {
    while (1)
      printf("%s\n", argv[1]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    114a <main+0x3a>
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ce <main+0xbe>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     1187 <main+0x77>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1187 <main+0x77>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ce <main+0xbe>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
jne    11ae <main+0x9e>
jmp    119b <main+0x8b>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119b <main+0x8b>
jmp    11b3 <main+0xa3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b3 <main+0xa3>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jle    111f <main+0xf>
lea    0xef0(%rip),%rdi
jmp    1137 <main+0x27>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
test   %rdi,%rdi
je     115b <main+0x4b>
cmpb   $0x2d,(%rdi)
jne    1150 <main+0x40>
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1030 <puts@plt>
mov    0x8(%rbx),%rdi
jmp    1150 <main+0x40>
lea    0xe9e(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <puts@plt>
jmp    1170 <main+0x60>

LLVM IR (-O0):
@.str = [17 x i8] c"none or one arg\0A\00"
@.str.1 = [12 x i8] c"no options\0A\00"
@.str.2 = [3 x i8] c"y\0A\00"
@.str.3 = [4 x i8] c"%s\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
%7 = icmp sgt i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %39
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %25
15: ; preds = %10
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = getelementptr inbounds i8, i8* %18, i64 0
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 45
br i1 %22, label %23, label %25
23: ; preds = %15
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %39
25: ; preds = %15, %10
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = icmp eq i8* %28, null
br i1 %29, label %30, label %33
30: ; preds = %25
br label %31
31: ; preds = %30, %31
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %31
33: ; preds = %25
br label %34
34: ; preds = %33, %34
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %37)
br label %34
39: ; preds = %23, %8
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@str = [2 x i8] c"y\00"
@str.4 = [11 x i8] c"no options\00"
@str.5 = [16 x i8] c"none or one arg\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 2
br i1 %3, label %17, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
br i1 %7, label %11, label %8
8: ; preds = %4
%9 = load i8, i8* %6
%10 = icmp eq i8 %9, 45
br i1 %10, label %17, label %13
11: ; preds = %4, %11
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %11
13: ; preds = %8, %13
%14 = phi i8* [ %16, %13 ], [ %6, %8 ]
%15 = tail call i32 @puts(i8* dereferenceable(1) %14)
%16 = load i8*, i8** %5
br label %13
17: ; preds = %8, %2
%18 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.5, i64 0, i64 0), %2 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @str.4, i64 0, i64 0), %8 ]
%19 = tail call i32 @puts(i8* dereferenceable(1) %18)
ret i32 -1
}