#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 */
scalar_t__ RAND_MAX;
float fmod(float, double);
int /*<<< orphan*/ printf(char *, float, int, char *, float);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int i = 200000;
  float grado;
  int id;
  char *accion[2] = {"avanzar", "disparar"};
  float valor;
  srand(time(NULL));
  while (i > 0) {
    grado = ((float)rand() / (float)RAND_MAX);
    id = rand();
    id = id % 1000;
    if (id < 100) {
      id = id + 100;
    }
    valor = ((float)rand() / (float)RAND_MAX) + 100;
    valor = fmod(valor, 4.2);
    if (valor < 0.8) {
      valor = valor + 0.8;
    }
    printf("%0.2f|%d|%s|%0.1f\n", grado, id, accion[rand() % 2], valor);
    i--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x30d40,-0x8(%rbp)
mov    0x2c93(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2c90(%rip),%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
cmpl   $0x0,-0x8(%rbp)
jle    12ab <main+0x15b>
mov    $0x0,%al
call   1070 <rand@plt>
cvtsi2ss %eax,%xmm0
mov    0x2e38(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    $0x0,%al
call   1070 <rand@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
cmpl   $0x64,-0x10(%rbp)
jge    11e1 <main+0x91>
mov    -0x10(%rbp),%eax
add    $0x64,%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1070 <rand@plt>
cvtsi2ss %eax,%xmm0
mov    0x2ded(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
movss  0xe0c(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
movsd  0xdee(%rip),%xmm1
call   1040 <fmod@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdcb(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    125d <main+0x10d>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdb0(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    $0x0,%al
call   1070 <rand@plt>
movss  -0x2c(%rbp),%xmm0
mov    -0x28(%rbp),%esi
mov    $0x2,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
mov    -0x20(%rbp,%rax,8),%rdx
movss  -0x24(%rbp),%xmm1
lea    0xd8d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    118c <main+0x3c>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0x30d41,%ebp
mov    0x2e73(%rip),%r12
lea    0xec0(%rip),%r13
lea    0xea6(%rip),%r14
jmp    11ea <main+0x9a>
cs nopw 0x0(%rax,%rax,1)
nop
movss  (%rsp),%xmm1
movss  %xmm0,0x4(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %r15d,%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%eax
cltq
movslq 0x0(%r13,%rax,4),%rdx
add    %r13,%rdx
mov    %r14,%rdi
movss  (%rsp),%xmm0
mov    %ebx,%esi
movss  0x4(%rsp),%xmm1
call   1030 <printf@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
jbe    1299 <main+0x149>
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%r15d
xorps  %xmm0,%xmm0
cvtsi2ssq (%r12),%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
mov    %eax,%edx
sub    %ecx,%edx
neg    %ecx
cmp    $0x64,%edx
lea    0x64(%rax,%rcx,1),%ebx
cmovge %edx,%ebx
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2ssq (%r12),%xmm1
divss  %xmm1,%xmm0
addss  0xda8(%rip),%xmm0
movsd  0xda8(%rip),%xmm1
call   1040 <fmod@plt>
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
movsd  0xd9c(%rip),%xmm1
ucomisd %xmm2,%xmm1
jbe    1190 <main+0x40>
addsd  %xmm1,%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
movss  %xmm0,0x4(%rsp)
movss  (%rsp),%xmm1
jmp    119b <main+0x4b>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"avanzar\00"
@.str.1 = [9 x i8] c"disparar\00"
@__const.main.accion = [2 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0)]
@RAND_MAX = global i64 0
@.str.2 = [19 x i8] c"%0.2f|%d|%s|%0.1f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca i32
%5 = alloca [2 x i8*]
%6 = alloca float
store i32 0, i32* %1
store i32 200000, i32* %2
%7 = bitcast [2 x i8*]* %5 to i8*
%8 = call i32 @time(i32* null)
%9 = call i32 @srand(i32 %8)
br label %10
10: ; preds = %44, %0
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %56
13: ; preds = %10
%14 = call i32 (...) @rand()
%15 = sitofp i32 %14 to float
%16 = load i64, i64* @RAND_MAX
%17 = sitofp i64 %16 to float
%18 = fdiv float %15, %17
store float %18, float* %3
%19 = call i32 (...) @rand()
store i32 %19, i32* %4
%20 = load i32, i32* %4
%21 = srem i32 %20, 1000
store i32 %21, i32* %4
%22 = load i32, i32* %4
%23 = icmp slt i32 %22, 100
br i1 %23, label %24, label %27
24: ; preds = %13
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 100
store i32 %26, i32* %4
br label %27
27: ; preds = %24, %13
%28 = call i32 (...) @rand()
%29 = sitofp i32 %28 to float
%30 = load i64, i64* @RAND_MAX
%31 = sitofp i64 %30 to float
%32 = fdiv float %29, %31
%33 = fadd float %32, 1.000000e+02
store float %33, float* %6
%34 = load float, float* %6
%35 = call float @fmod(float %34, double 4.200000e+00)
store float %35, float* %6
%36 = load float, float* %6
%37 = fpext float %36 to double
%38 = fcmp olt double %37, 8.000000e-01
br i1 %38, label %39, label %44
39: ; preds = %27
%40 = load float, float* %6
%41 = fpext float %40 to double
%42 = fadd double %41, 8.000000e-01
%43 = fptrunc double %42 to float
store float %43, float* %6
br label %44
44: ; preds = %39, %27
%45 = load float, float* %3
%46 = load i32, i32* %4
%47 = call i32 (...) @rand()
%48 = srem i32 %47, 2
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [2 x i8*], [2 x i8*]* %5, i64 0, i64 %49
%51 = load i8*, i8** %50
%52 = load float, float* %6
%53 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), float %45, i32 %46, i8* %51, float %52)
%54 = load i32, i32* %2
%55 = add nsw i32 %54, -1
store i32 %55, i32* %2
br label %10
56: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"avanzar\00"
@.str.1 = [9 x i8] c"disparar\00"
@reltable.main = [2 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str to i64), i64 ptrtoint ([2 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.1 to i64), i64 ptrtoint ([2 x i32]* @reltable.main to i64)) to i32)]
@RAND_MAX = global i64 0
@.str.2 = [19 x i8] c"%0.2f|%d|%s|%0.1f\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 200000, %0 ], [ %33, %3 ]
%5 = tail call i32 (...) @rand()
%6 = sitofp i32 %5 to float
%7 = load i64, i64* @RAND_MAX
%8 = sitofp i64 %7 to float
%9 = fdiv float %6, %8
%10 = tail call i32 (...) @rand()
%11 = srem i32 %10, 1000
%12 = icmp slt i32 %11, 100
%13 = add nsw i32 %11, 100
%14 = select i1 %12, i32 %13, i32 %11
%15 = tail call i32 (...) @rand()
%16 = sitofp i32 %15 to float
%17 = load i64, i64* @RAND_MAX
%18 = sitofp i64 %17 to float
%19 = fdiv float %16, %18
%20 = fadd float %19, 1.000000e+02
%21 = tail call float @fmod(float %20, double 4.200000e+00)
%22 = fpext float %21 to double
%23 = fcmp olt double %22, 8.000000e-01
%24 = fadd double %22, 8.000000e-01
%25 = fptrunc double %24 to float
%26 = select i1 %23, float %25, float %21
%27 = tail call i32 (...) @rand()
%28 = srem i32 %27, 2
%29 = sext i32 %28 to i64
%30 = shl i64 %29, 2
%31 = call i8* @llvm.load.relative.i64(i8* bitcast ([2 x i32]* @reltable.main to i8*), i64 %30)
%32 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), float %9, i32 %14, i8* %31, float %26)
%33 = add nsw i32 %4, -1
%34 = icmp ugt i32 %4, 1
br i1 %34, label %3, label %35
35: ; preds = %3
ret i32 0
}