#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*/ printf(char *, unsigned long, unsigned long);
int /*<<< orphan*/ rnd();
unsigned long rnd_state();
int /*<<< orphan*/ rnd_state_set(unsigned long);
void rnd_state_set_v2(unsigned long seed0_v2) {
  int i;
  unsigned long seed0;
  rnd_state_set(seed0_v2);
  for (i = 0; i < 10; i += 1) {
    (void)rnd();
  }
  seed0 = rnd_state();
  printf("rnd_state_set_v2(): seed0_v2 = %lu, converted to state_v3 = %lu.\n",
         seed0_v2, seed0);
  rnd_state_set(seed0);
}


x86 assembly (clang, -O0):
<rnd_state_set_v2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <rnd_state_set@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    117b <rnd_state_set_v2+0x3b>
mov    $0x0,%al
call   1050 <rnd@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115c <rnd_state_set_v2+0x1c>
mov    $0x0,%al
call   1060 <rnd_state@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe6b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <rnd_state_set@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rnd_state_set_v2>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <rnd_state_set@plt>
xor    %eax,%eax
call   1050 <rnd@plt>
xor    %eax,%eax
call   1050 <rnd@plt>
xor    %eax,%eax
call   1050 <rnd@plt>
xor    %eax,%eax
call   1050 <rnd@plt>
xor    %eax,%eax
call   1050 <rnd@plt>
xor    %eax,%eax
call   1050 <rnd@plt>
xor    %eax,%eax
call   1050 <rnd@plt>
xor    %eax,%eax
call   1050 <rnd@plt>
xor    %eax,%eax
call   1050 <rnd@plt>
xor    %eax,%eax
call   1050 <rnd@plt>
xor    %eax,%eax
call   1060 <rnd_state@plt>
mov    %rax,%rbx
lea    0xe5d(%rip),%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   1040 <printf@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <rnd_state_set@plt>

LLVM IR (-O0):
@.str = [66 x i8] c"rnd_state_set_v2(): seed0_v2 = %lu, converted to state_v3 = %lu.\0A\00"
define void @rnd_state_set_v2(i64 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca i64
store i64 %0, i64* %2
%5 = load i64, i64* %2
%6 = call i32 @rnd_state_set(i64 %5)
store i32 0, i32* %3
br label %7
7: ; preds = %12, %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = call i32 (...) @rnd()
br label %12
12: ; preds = %10
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %7
15: ; preds = %7
%16 = call i64 (...) @rnd_state()
store i64 %16, i64* %4
%17 = load i64, i64* %2
%18 = load i64, i64* %4
%19 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i64 %17, i64 %18)
%20 = load i64, i64* %4
%21 = call i32 @rnd_state_set(i64 %20)
ret void
}

LLVM IR (-O2):
@.str = [66 x i8] c"rnd_state_set_v2(): seed0_v2 = %lu, converted to state_v3 = %lu.\0A\00"
define void @rnd_state_set_v2(i64 %0) {
%2 = tail call i32 @rnd_state_set(i64 %0)
%3 = tail call i32 (...) @rnd()
%4 = tail call i32 (...) @rnd()
%5 = tail call i32 (...) @rnd()
%6 = tail call i32 (...) @rnd()
%7 = tail call i32 (...) @rnd()
%8 = tail call i32 (...) @rnd()
%9 = tail call i32 (...) @rnd()
%10 = tail call i32 (...) @rnd()
%11 = tail call i32 (...) @rnd()
%12 = tail call i32 (...) @rnd()
%13 = tail call i64 (...) @rnd_state()
%14 = tail call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i64 %0, i64 %13)
%15 = tail call i32 @rnd_state_set(i64 %13)
ret void
}