#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 rand();
int /*<<< orphan*/ sort_of_random(int *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  srand(time(NULL));
  int i = 0;
  int r;
  char *maybe;
  if (argc > 1) {
    maybe = argv[1];
  }
  while (i == 0) {
    int base = rand();
    sort_of_random(&r);
    if (base % r == 0) {
      maybe = "y";
    } else {
      maybe = "n";
    }
    printf("%s\n", maybe);
  }
}


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)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1193 <main+0x43>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    1198 <main+0x48>
cmpl   $0x0,-0x14(%rbp)
jne    11f5 <main+0xa5>
mov    $0x0,%al
call   1070 <rand@plt>
mov    %eax,-0x24(%rbp)
lea    -0x18(%rbp),%rdi
call   1030 <sort_of_random@plt>
mov    -0x24(%rbp),%eax
cltd
idivl  -0x18(%rbp)
cmp    $0x0,%edx
jne    11d5 <main+0x85>
lea    0xe34(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11e0 <main+0x90>
lea    0xe26(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe19(%rip),%rdi
call   1040 <printf@plt>
jmp    1198 <main+0x48>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    0xc(%rsp),%r14
lea    0xe8a(%rip),%r15
lea    0xe85(%rip),%r12
lea    0xe80(%rip),%rbx
jmp    1198 <main+0x48>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <sort_of_random@plt>
mov    %ebp,%eax
cltd
idivl  0xc(%rsp)
mov    %r15,%rsi
test   %edx,%edx
je     1190 <main+0x40>
mov    %r12,%rsi
jmp    1190 <main+0x40>

LLVM IR (-O0):
@.str = [2 x i8] c"y\00"
@.str.1 = [2 x i8] c"n\00"
@.str.2 = [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
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 @time(i32* null)
%11 = call i32 @srand(i32 %10)
store i32 0, i32* %6
%12 = load i32, i32* %4
%13 = icmp sgt i32 %12, 1
br i1 %13, label %14, label %18
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
store i8* %17, i8** %8
br label %18
18: ; preds = %14, %2
br label %19
19: ; preds = %31, %18
%20 = load i32, i32* %6
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %34
22: ; preds = %19
%23 = call i32 (...) @rand()
store i32 %23, i32* %9
%24 = call i32 @sort_of_random(i32* %7)
%25 = load i32, i32* %9
%26 = load i32, i32* %7
%27 = srem i32 %25, %26
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %22
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %8
br label %31
30: ; preds = %22
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %8
br label %31
31: ; preds = %30, %29
%32 = load i8*, i8** %8
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %32)
br label %19
34: ; preds = %19
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
@.str = [2 x i8] c"y\00"
@.str.1 = [2 x i8] c"n\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = tail call i32 @time(i32* null)
%5 = tail call i32 @srand(i32 %4)
%6 = bitcast i32* %3 to i8*
br label %7
7: ; preds = %7, %2
%8 = call i32 (...) @rand()
%9 = call i32 @sort_of_random(i32* %3)
%10 = load i32, i32* %3
%11 = srem i32 %8, %10
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %13)
br label %7
}