#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 list_version(char *, int);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  char *filename = NULL;
  int filec = 1;
  int show_versions = 0;
  int ret;
  if (argc < 2)
    usage();
  if (!strcmp(argv[1], "-s")) {
    show_versions = 1;
    filec++;
  }
  filename = argv[filec];
  ret = list_version(filename, show_versions);
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    116d <main+0x3d>
mov    $0x0,%al
call   1050 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe84(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    119a <main+0x6a>
movl   $0x1,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1030 <list_version@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     1140 <main+0x10>
xor    %eax,%eax
call   1050 <usage@plt>
mov    0x8(%rbx),%rdi
lea    0xeb5(%rip),%rsi
call   1040 <strcmp@plt>
xor    %esi,%esi
test   %eax,%eax
sete   %sil
mov    0x8(%rbx,%rsi,8),%rdi
pop    %rbx
jmp    1030 <list_version@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i32 1, i32* %7
store i32 0, i32* %8
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 (...) @usage()
br label %14
14: ; preds = %12, %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @strcmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%19 = icmp ne i32 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %14
store i32 1, i32* %8
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
store i32 %22, i32* %7
br label %23
23: ; preds = %20, %14
%24 = load i8**, i8*** %5
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
store i8* %28, i8** %6
%29 = load i8*, i8** %6
%30 = load i32, i32* %8
%31 = call i32 @list_version(i8* %29, i32 %30)
store i32 %31, i32* %9
%32 = load i32, i32* %9
ret i32 %32
}

LLVM IR (-O2):
@.str = [3 x i8] c"-s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @usage()
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i64 2, i64 1
%12 = zext i1 %10 to i32
%13 = getelementptr inbounds i8*, i8** %1, i64 %11
%14 = load i8*, i8** %13
%15 = tail call i32 @list_version(i8* %14, i32 %12)
ret i32 %15
}