#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 rand();
int /*<<< orphan*/ srand(float *);
void generateTemperatures(float *firstEntry, int numDays, float startTemp) {
  int i;
  float newRandTemp;
  *firstEntry = startTemp;
  for (i = 0; i < numDays - 1; i++) {
    srand(firstEntry);
    firstEntry++;
    *firstEntry = rand() % 51;
  }
}


x86 assembly (clang, -O0):
<generateTemperatures>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1197 <generateTemperatures+0x77>
mov    -0x8(%rbp),%rdi
call   1030 <srand@plt>
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x33,%ecx
cltd
idiv   %ecx
cvtsi2ss %edx,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1148 <generateTemperatures+0x28>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generateTemperatures>:
push   %rbp
push   %r14
push   %rbx
movss  %xmm0,(%rdi)
cmp    $0x2,%esi
jl     1185 <generateTemperatures+0x65>
mov    %esi,%ebp
mov    %rdi,%rbx
add    $0xffffffff,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1030 <srand@plt>
lea    0x4(%rbx),%r14
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0xffffffffa0a0a0a1,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x33,%ecx,%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x4(%rbx)
mov    %r14,%rbx
add    $0xffffffff,%ebp
jne    1140 <generateTemperatures+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @generateTemperatures(float* %0, i32 %1, float %2) {
%4 = alloca float*
%5 = alloca i32
%6 = alloca float
%7 = alloca i32
%8 = alloca float
store float* %0, float** %4
store i32 %1, i32* %5
store float %2, float* %6
%9 = load float, float* %6
%10 = load float*, float** %4
store float %9, float* %10
store i32 0, i32* %7
br label %11
11: ; preds = %25, %3
%12 = load i32, i32* %7
%13 = load i32, i32* %5
%14 = sub nsw i32 %13, 1
%15 = icmp slt i32 %12, %14
br i1 %15, label %16, label %28
16: ; preds = %11
%17 = load float*, float** %4
%18 = call i32 @srand(float* %17)
%19 = load float*, float** %4
%20 = getelementptr inbounds float, float* %19, i32 1
store float* %20, float** %4
%21 = call i32 (...) @rand()
%22 = srem i32 %21, 51
%23 = sitofp i32 %22 to float
%24 = load float*, float** %4
store float %23, float* %24
br label %25
25: ; preds = %16
%26 = load i32, i32* %7
%27 = add nsw i32 %26, 1
store i32 %27, i32* %7
br label %11
28: ; preds = %11
ret void
}

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