#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_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int random();
int /*<<< orphan*/ srandom(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int num;
  if (argc < 2) {
    fprintf(stderr, "Usage: %s args...\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  srandom(time(0));
  num = random() % (argc - 1);
  printf("%s\n", argv[num + 1]);
  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)
cmpl   $0x2,-0x8(%rbp)
jge    11aa <main+0x4a>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe69(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
mov    $0x0,%al
call   1070 <random@plt>
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe30(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x1,%edi
jle    11a5 <main+0x45>
mov    %edi,%ebp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
xor    %eax,%eax
call   1070 <random@plt>
add    $0xffffffff,%ebp
cltd
idiv   %ebp
movslq %edx,%rax
mov    0x8(%rbx,%rax,8),%rsi
lea    0xe7c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe48(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"Usage: %s args...\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %17
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
17: ; preds = %2
%18 = call i32 @time(i32 0)
%19 = call i32 @srandom(i32 %18)
%20 = call i32 (...) @random()
%21 = load i32, i32* %4
%22 = sub nsw i32 %21, 1
%23 = srem i32 %20, %22
store i32 %23, i32* %6
%24 = load i8**, i8*** %5
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %24, i64 %27
%29 = load i8*, i8** %28
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %29)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"Usage: %s args...\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %2
%11 = tail call i32 @time(i32 0)
%12 = tail call i32 @srandom(i32 %11)
%13 = tail call i32 (...) @random()
%14 = add nsw i32 %0, -1
%15 = srem i32 %13, %14
%16 = add nsw i32 %15, 1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %1, i64 %17
%19 = load i8*, i8** %18
%20 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %19)
ret i32 0
}