#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 */
float RAND_MAX;
int /*<<< orphan*/ getmaxyx(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ new_particle(int, float, float, float, char, float, int);
int rand();
int /*<<< orphan*/ stdscr;
void spawn_rand_particle() {
  int row, col;
  getmaxyx(stdscr, row, col);
  float dx = (((float)rand() / RAND_MAX) * 20) - 10;
  float dy = (((float)rand() / RAND_MAX) * 7) + 3;
  new_particle(col / 2.f, 0.f, dx, dy, 'O', 1.0f, rand() % 6);
}


x86 assembly (clang, -O0):
<spawn_rand_particle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1030 <getmaxyx@plt>
mov    $0x0,%al
call   1050 <rand@plt>
cvtsi2ss %eax,%xmm0
mov    0x2e8a(%rip),%rax
divss  (%rax),%xmm0
movss  0xea6(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe9e(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
cvtsi2ss %eax,%xmm0
mov    0x2e57(%rip),%rax
divss  (%rax),%xmm0
movss  0xe6b(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe63(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
movss  0xe45(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x1c(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    -0x1c(%rbp),%edi
movss  -0x18(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
mov    $0x6,%ecx
cltd
idiv   %ecx
xorps  %xmm0,%xmm0
mov    $0x4f,%esi
movss  0xdf6(%rip),%xmm3
call   1040 <new_particle@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spawn_rand_particle>:
push   %rbx
sub    $0x10,%rsp
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
call   1030 <getmaxyx@plt>
xor    %eax,%eax
call   1050 <rand@plt>
cvtsi2ss %eax,%xmm0
mov    0x2e93(%rip),%rbx
divss  (%rbx),%xmm0
mulss  0xe9f(%rip),%xmm0
addss  0xe9b(%rip),%xmm0
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
call   1050 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  (%rbx),%xmm0
mulss  0xe7f(%rip),%xmm0
addss  0xe7b(%rip),%xmm0
movss  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1050 <rand@plt>
movslq %eax,%rdx
imul   $0x2aaaaaab,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%edx
movss  0xe4c(%rip),%xmm3
xorps  %xmm0,%xmm0
xor    %edi,%edi
movss  0xc(%rsp),%xmm1
movss  0x8(%rsp),%xmm2
mov    $0x4f,%esi
add    $0x10,%rsp
pop    %rbx
jmp    1040 <new_particle@plt>

LLVM IR (-O0):
@stdscr = global i32 0
@RAND_MAX = global float 0.000000e+00
define void @spawn_rand_particle() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = load i32, i32* @stdscr
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = call i32 @getmaxyx(i32 %5, i32 %6, i32 %7)
%9 = call i32 (...) @rand()
%10 = sitofp i32 %9 to float
%11 = load float, float* @RAND_MAX
%12 = fdiv float %10, %11
%13 = call float @llvm.fmuladd.f32(float %12, float 2.000000e+01, float -1.000000e+01)
store float %13, float* %3
%14 = call i32 (...) @rand()
%15 = sitofp i32 %14 to float
%16 = load float, float* @RAND_MAX
%17 = fdiv float %15, %16
%18 = call float @llvm.fmuladd.f32(float %17, float 7.000000e+00, float 3.000000e+00)
store float %18, float* %4
%19 = load i32, i32* %2
%20 = sitofp i32 %19 to float
%21 = fdiv float %20, 2.000000e+00
%22 = fptosi float %21 to i32
%23 = load float, float* %3
%24 = load float, float* %4
%25 = call i32 (...) @rand()
%26 = srem i32 %25, 6
%27 = call i32 @new_particle(i32 %22, float 0.000000e+00, float %23, float %24, i8 signext 79, float 1.000000e+00, i32 %26)
ret void
}

LLVM IR (-O2):
@stdscr = global i32 0
@RAND_MAX = global float 0.000000e+00
define void @spawn_rand_particle() {
%1 = load i32, i32* @stdscr
%2 = tail call i32 @getmaxyx(i32 %1, i32 undef, i32 undef)
%3 = tail call i32 (...) @rand()
%4 = sitofp i32 %3 to float
%5 = load float, float* @RAND_MAX
%6 = fdiv float %4, %5
%7 = tail call float @llvm.fmuladd.f32(float %6, float 2.000000e+01, float -1.000000e+01)
%8 = tail call i32 (...) @rand()
%9 = sitofp i32 %8 to float
%10 = load float, float* @RAND_MAX
%11 = fdiv float %9, %10
%12 = tail call float @llvm.fmuladd.f32(float %11, float 7.000000e+00, float 3.000000e+00)
%13 = tail call i32 (...) @rand()
%14 = srem i32 %13, 6
%15 = tail call i32 @new_particle(i32 0, float 0.000000e+00, float %7, float %12, i8 signext 79, float 1.000000e+00, i32 %14)
ret void
}