#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 */
struct BasePRNGObject {
  int dummy;
};

/* Variables and functions */
struct BasePRNGObject *mock_prng_allocate(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdlib_base_prng_free(struct BasePRNGObject *);
size_t stdlib_base_prng_state_size(struct BasePRNGObject *);
double tic();
double benchmark7() {
  double elapsed;
  size_t v;
  double t;
  int i;
  struct BasePRNGObject *obj = mock_prng_allocate(1);
  t = tic();
  for (i = 0; i < 1000000; i++) {
    v = stdlib_base_prng_state_size(obj);
    if (v == 0) {
      printf("unexpected result\n");
      break;
    }
  }
  elapsed = tic() - t;
  if (v == 0) {
    printf("unexpected result\n");
  }
  stdlib_base_prng_free(obj);
  return elapsed;
}


x86 assembly (clang, -O0):
<benchmark7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x1,%edi
call   1050 <mock_prng_allocate@plt>
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1040 <tic@plt>
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0xf4240,-0x1c(%rbp)
jge    11c2 <benchmark7+0x72>
mov    -0x28(%rbp),%rdi
call   1060 <stdlib_base_prng_state_size@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11af <benchmark7+0x5f>
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
jmp    11c2 <benchmark7+0x72>
jmp    11b4 <benchmark7+0x64>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1179 <benchmark7+0x29>
mov    $0x0,%al
call   1040 <tic@plt>
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11ea <benchmark7+0x9a>
lea    0xe1b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1070 <stdlib_base_prng_free@plt>
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<benchmark7>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    $0x1,%edi
call   1050 <mock_prng_allocate@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <tic@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0xf4240,%ebp
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1060 <stdlib_base_prng_state_size@plt>
test   %rax,%rax
je     11a0 <benchmark7+0x50>
add    $0xffffffff,%ebp
jne    1180 <benchmark7+0x30>
xor    %eax,%eax
call   1040 <tic@plt>
movsd  %xmm0,(%rsp)
jmp    11c3 <benchmark7+0x73>
lea    0xe59(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <tic@plt>
movsd  %xmm0,(%rsp)
mov    %r14,%rdi
call   1030 <puts@plt>
movsd  (%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
call   1070 <stdlib_base_prng_free@plt>
movsd  (%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.BasePRNGObject = type { i32 }
@.str = [19 x i8] c"unexpected result\0A\00"
define double @benchmark7() {
%1 = alloca double
%2 = alloca i64
%3 = alloca double
%4 = alloca i32
%5 = alloca %struct.BasePRNGObject*
%6 = call %struct.BasePRNGObject* @mock_prng_allocate(i32 1)
store %struct.BasePRNGObject* %6, %struct.BasePRNGObject** %5
%7 = call double (...) @tic()
store double %7, double* %3
store i32 0, i32* %4
br label %8
8: ; preds = %19, %0
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 1000000
br i1 %10, label %11, label %22
11: ; preds = %8
%12 = load %struct.BasePRNGObject*, %struct.BasePRNGObject** %5
%13 = call i64 @stdlib_base_prng_state_size(%struct.BasePRNGObject* %12)
store i64 %13, i64* %2
%14 = load i64, i64* %2
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %22
18: ; preds = %11
br label %19
19: ; preds = %18
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %8
22: ; preds = %16, %8
%23 = call double (...) @tic()
%24 = load double, double* %3
%25 = fsub double %23, %24
store double %25, double* %1
%26 = load i64, i64* %2
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %22
%29 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %30
30: ; preds = %28, %22
%31 = load %struct.BasePRNGObject*, %struct.BasePRNGObject** %5
%32 = call i32 @stdlib_base_prng_free(%struct.BasePRNGObject* %31)
%33 = load double, double* %1
ret double %33
}

LLVM IR (-O2):
%struct.BasePRNGObject = type { i32 }
@str.1 = [18 x i8] c"unexpected result\00"
define double @benchmark7() {
%1 = tail call %struct.BasePRNGObject* @mock_prng_allocate(i32 1)
%2 = tail call double (...) @tic()
br label %6
3: ; preds = %6
%4 = add nuw nsw i32 %7, 1
%5 = icmp eq i32 %4, 1000000
br i1 %5, label %10, label %6
6: ; preds = %0, %3
%7 = phi i32 [ 0, %0 ], [ %4, %3 ]
%8 = tail call i64 @stdlib_base_prng_state_size(%struct.BasePRNGObject* %1)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %3
10: ; preds = %3
%11 = tail call double (...) @tic()
br label %16
12: ; preds = %6
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.1, i64 0, i64 0))
%14 = tail call double (...) @tic()
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.1, i64 0, i64 0))
br label %16
16: ; preds = %10, %12
%17 = phi double [ %14, %12 ], [ %11, %10 ]
%18 = fsub double %17, %2
%19 = tail call i32 @stdlib_base_prng_free(%struct.BasePRNGObject* %1)
ret double %18
}