#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*/ random_walk(float *, float, float, float, float);
void random_walk_all(float *turtles, int num_turtles, float magnitude,
                     float half_w, float half_h, float degrees) {
  int i;
  for (i = 0; i < num_turtles; ++i) {
    random_walk(turtles + (i * 16), magnitude, half_w, half_h, degrees);
  }
}


x86 assembly (clang, -O0):
<random_walk_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movss  %xmm0,-0x10(%rbp)
movss  %xmm1,-0x14(%rbp)
movss  %xmm2,-0x18(%rbp)
movss  %xmm3,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1180 <random_walk_all+0x70>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%eax
shl    $0x4,%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
movss  -0x10(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
movss  -0x18(%rbp),%xmm2
movss  -0x1c(%rbp),%xmm3
call   1030 <random_walk@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    113a <random_walk_all+0x2a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_walk_all>:
push   %r14
push   %rbx
sub    $0x18,%rsp
test   %esi,%esi
jle    116a <random_walk_all+0x5a>
mov    %rdi,%rbx
mov    %esi,%r14d
movss  %xmm3,0x14(%rsp)
movss  %xmm2,0x10(%rsp)
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x8(%rsp)
nopl   0x0(%rax)
mov    %rbx,%rdi
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
movss  0x10(%rsp),%xmm2
movss  0x14(%rsp),%xmm3
call   1030 <random_walk@plt>
add    $0x40,%rbx
add    $0xffffffffffffffff,%r14
jne    1140 <random_walk_all+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @random_walk_all(float* %0, i32 %1, float %2, float %3, float %4, float %5) {
%7 = alloca float*
%8 = alloca i32
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca i32
store float* %0, float** %7
store i32 %1, i32* %8
store float %2, float* %9
store float %3, float* %10
store float %4, float* %11
store float %5, float* %12
store i32 0, i32* %13
br label %14
14: ; preds = %29, %6
%15 = load i32, i32* %13
%16 = load i32, i32* %8
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %32
18: ; preds = %14
%19 = load float*, float** %7
%20 = load i32, i32* %13
%21 = mul nsw i32 %20, 16
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds float, float* %19, i64 %22
%24 = load float, float* %9
%25 = load float, float* %10
%26 = load float, float* %11
%27 = load float, float* %12
%28 = call i32 @random_walk(float* %23, float %24, float %25, float %26, float %27)
br label %29
29: ; preds = %18
%30 = load i32, i32* %13
%31 = add nsw i32 %30, 1
store i32 %31, i32* %13
br label %14
32: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @random_walk_all(float* %0, i32 %1, float %2, float %3, float %4, float %5) {
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %17
8: ; preds = %6
%9 = zext i32 %1 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 0, %8 ], [ %15, %10 ]
%12 = shl nsw i64 %11, 4
%13 = getelementptr inbounds float, float* %0, i64 %12
%14 = tail call i32 @random_walk(float* %13, float %2, float %3, float %4, float %5)
%15 = add nuw nsw i64 %11, 1
%16 = icmp eq i64 %15, %9
br i1 %16, label %17, label %10
17: ; preds = %10, %6
ret void
}