#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(int);
int getRndNum(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ usleep(int);
int main() {
  printf("\nStart\n");
  srand(time(NULL));
  usleep(500000);
  printf("\nRunning...\n");
  usleep(500000 + getRndNum(100000));
  int rndnum = getRndNum(99);
  if (rndnum == 0) {
    printf("\nSimulating fail run...\n\n");
    exit(1);
  } else {
    printf("\nSuccessful run...\n\n");
    exit(0);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x7a120,%edi
call   1080 <usleep@plt>
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
mov    $0x186a0,%edi
call   1060 <getRndNum@plt>
mov    %eax,%edi
add    $0x7a120,%edi
call   1080 <usleep@plt>
mov    $0x63,%edi
call   1060 <getRndNum@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    11e5 <main+0x85>
lea    0xe3f(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xe98(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x7a120,%edi
call   1080 <usleep@plt>
lea    0xe7b(%rip),%rdi
call   1030 <puts@plt>
mov    $0x186a0,%edi
call   1060 <getRndNum@plt>
lea    0x7a120(%rax),%edi
call   1080 <usleep@plt>
mov    $0x63,%edi
call   1060 <getRndNum@plt>
test   %eax,%eax
jne    11ca <main+0x6a>
lea    0xe6c(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    0xe42(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"\0AStart\0A\00"
@.str.1 = [13 x i8] c"\0ARunning...\0A\00"
@.str.2 = [26 x i8] c"\0ASimulating fail run...\0A\0A\00"
@.str.3 = [21 x i8] c"\0ASuccessful run...\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @time(i32* null)
%5 = call i32 @srand(i32 %4)
%6 = call i32 @usleep(i32 500000)
%7 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @getRndNum(i32 100000)
%9 = add nsw i32 500000, %8
%10 = call i32 @usleep(i32 %9)
%11 = call i32 @getRndNum(i32 99)
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %0
%18 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [7 x i8] c"\0AStart\00"
@str.4 = [12 x i8] c"\0ARunning...\00"
@str.5 = [20 x i8] c"\0ASuccessful run...\0A\00"
@str.6 = [25 x i8] c"\0ASimulating fail run...\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @time(i32* null)
%3 = tail call i32 @srand(i32 %2)
%4 = tail call i32 @usleep(i32 500000)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.4, i64 0, i64 0))
%6 = tail call i32 @getRndNum(i32 100000)
%7 = add nsw i32 %6, 500000
%8 = tail call i32 @usleep(i32 %7)
%9 = tail call i32 @getRndNum(i32 99)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %0
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.6, i64 0, i64 0))
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %0
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.5, i64 0, i64 0))
%16 = tail call i32 @exit(i32 0)
unreachable
}