long init_rand_port(long seed) {
  extern long rand_num;
  int i;
  if (seed < 1 || seed > (2147483647L - 1)) {
    seed = get_init_rand_port();
  }
  rand_num = seed;
  for (i = 0; i < 16; i++) {
    rand_num = genr_rand_port(rand_num);
  }
  return seed;
}


x86 assembly (clang, -O0):
<init_rand_port>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x1,-0x8(%rbp)
jl     1145 <init_rand_port+0x25>
cmpq   $0x7ffffffe,-0x8(%rbp)
7f
jle    1152 <init_rand_port+0x32>
mov    $0x0,%al
call   1030 <get_init_rand_port@plt>
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    0x2e8b(%rip),%rax
mov    %rcx,(%rax)
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    119d <init_rand_port+0x7d>
mov    0x2e70(%rip),%rax
mov    (%rax),%rdi
mov    $0x0,%al
call   1040 <genr_rand_port@plt>
movslq %eax,%rcx
mov    0x2e5c(%rip),%rax
mov    %rcx,(%rax)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1167 <init_rand_port+0x47>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_rand_port>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    -0x7fffffff(%rdi),%rax
cmp    $0xffffffff80000001,%rax
ja     1140 <init_rand_port+0x20>
xor    %eax,%eax
call   1030 <get_init_rand_port@plt>
movslq %eax,%r14
mov    0x2ea1(%rip),%rbx
mov    %r14,(%rbx)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <genr_rand_port@plt>
movslq %eax,%rdi
mov    %rdi,(%rbx)
xor    %eax,%eax
call   1040 <genr_rand_port@plt>
movslq %eax,%rdi
mov    %rdi,(%rbx)
xor    %eax,%eax
call   1040 <genr_rand_port@plt>
movslq %eax,%rdi
mov    %rdi,(%rbx)
xor    %eax,%eax
call   1040 <genr_rand_port@plt>
movslq %eax,%rdi
mov    %rdi,(%rbx)
xor    %eax,%eax
call   1040 <genr_rand_port@plt>
movslq %eax,%rdi
mov    %rdi,(%rbx)
xor    %eax,%eax
call   1040 <genr_rand_port@plt>
movslq %eax,%rdi
mov    %rdi,(%rbx)
xor    %eax,%eax
call   1040 <genr_rand_port@plt>
movslq %eax,%rdi
mov    %rdi,(%rbx)
xor    %eax,%eax
call   1040 <genr_rand_port@plt>
movslq %eax,%rdi
mov    %rdi,(%rbx)
xor    %eax,%eax
call   1040 <genr_rand_port@plt>
movslq %eax,%rdi
mov    %rdi,(%rbx)
xor    %eax,%eax
call   1040 <genr_rand_port@plt>
movslq %eax,%rdi
mov    %rdi,(%rbx)
xor    %eax,%eax
call   1040 <genr_rand_port@plt>
movslq %eax,%rdi
mov    %rdi,(%rbx)
xor    %eax,%eax
call   1040 <genr_rand_port@plt>
movslq %eax,%rdi
mov    %rdi,(%rbx)
xor    %eax,%eax
call   1040 <genr_rand_port@plt>
movslq %eax,%rdi
mov    %rdi,(%rbx)
xor    %eax,%eax
call   1040 <genr_rand_port@plt>
movslq %eax,%rdi
mov    %rdi,(%rbx)
xor    %eax,%eax
call   1040 <genr_rand_port@plt>
movslq %eax,%rdi
mov    %rdi,(%rbx)
xor    %eax,%eax
call   1040 <genr_rand_port@plt>
cltq
mov    %rax,(%rbx)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@rand_num = external global i64
define i64 @init_rand_port(i64 %0) {
%2 = alloca i64
%3 = alloca i32
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = icmp slt i64 %4, 1
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i64, i64* %2
%8 = icmp sgt i64 %7, 2147483646
br i1 %8, label %9, label %12
9: ; preds = %6, %1
%10 = call i32 (...) @get_init_rand_port()
%11 = sext i32 %10 to i64
store i64 %11, i64* %2
br label %12
12: ; preds = %9, %6
%13 = load i64, i64* %2
store i64 %13, i64* @rand_num
store i32 0, i32* %3
br label %14
14: ; preds = %21, %12
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 16
br i1 %16, label %17, label %24
17: ; preds = %14
%18 = load i64, i64* @rand_num
%19 = call i32 (i64, ...) bitcast (i32 (...)* @genr_rand_port to i32 (i64, ...)*)(i64 %18)
%20 = sext i32 %19 to i64
store i64 %20, i64* @rand_num
br label %21
21: ; preds = %17
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %14
24: ; preds = %14
%25 = load i64, i64* %2
ret i64 %25
}

LLVM IR (-O2):
@rand_num = external global i64
define i64 @init_rand_port(i64 %0) {
%2 = add i64 %0, -2147483647
%3 = icmp ult i64 %2, -2147483646
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 (...) @get_init_rand_port()
%6 = sext i32 %5 to i64
br label %7
7: ; preds = %1, %4
%8 = phi i64 [ %6, %4 ], [ %0, %1 ]
store i64 %8, i64* @rand_num
%9 = tail call i32 (i64, ...) bitcast (i32 (...)* @genr_rand_port to i32 (i64, ...)*)(i64 %8)
%10 = sext i32 %9 to i64
store i64 %10, i64* @rand_num
%11 = tail call i32 (i64, ...) bitcast (i32 (...)* @genr_rand_port to i32 (i64, ...)*)(i64 %10)
%12 = sext i32 %11 to i64
store i64 %12, i64* @rand_num
%13 = tail call i32 (i64, ...) bitcast (i32 (...)* @genr_rand_port to i32 (i64, ...)*)(i64 %12)
%14 = sext i32 %13 to i64
store i64 %14, i64* @rand_num
%15 = tail call i32 (i64, ...) bitcast (i32 (...)* @genr_rand_port to i32 (i64, ...)*)(i64 %14)
%16 = sext i32 %15 to i64
store i64 %16, i64* @rand_num
%17 = tail call i32 (i64, ...) bitcast (i32 (...)* @genr_rand_port to i32 (i64, ...)*)(i64 %16)
%18 = sext i32 %17 to i64
store i64 %18, i64* @rand_num
%19 = tail call i32 (i64, ...) bitcast (i32 (...)* @genr_rand_port to i32 (i64, ...)*)(i64 %18)
%20 = sext i32 %19 to i64
store i64 %20, i64* @rand_num
%21 = tail call i32 (i64, ...) bitcast (i32 (...)* @genr_rand_port to i32 (i64, ...)*)(i64 %20)
%22 = sext i32 %21 to i64
store i64 %22, i64* @rand_num
%23 = tail call i32 (i64, ...) bitcast (i32 (...)* @genr_rand_port to i32 (i64, ...)*)(i64 %22)
%24 = sext i32 %23 to i64
store i64 %24, i64* @rand_num
%25 = tail call i32 (i64, ...) bitcast (i32 (...)* @genr_rand_port to i32 (i64, ...)*)(i64 %24)
%26 = sext i32 %25 to i64
store i64 %26, i64* @rand_num
%27 = tail call i32 (i64, ...) bitcast (i32 (...)* @genr_rand_port to i32 (i64, ...)*)(i64 %26)
%28 = sext i32 %27 to i64
store i64 %28, i64* @rand_num
%29 = tail call i32 (i64, ...) bitcast (i32 (...)* @genr_rand_port to i32 (i64, ...)*)(i64 %28)
%30 = sext i32 %29 to i64
store i64 %30, i64* @rand_num
%31 = tail call i32 (i64, ...) bitcast (i32 (...)* @genr_rand_port to i32 (i64, ...)*)(i64 %30)
%32 = sext i32 %31 to i64
store i64 %32, i64* @rand_num
%33 = tail call i32 (i64, ...) bitcast (i32 (...)* @genr_rand_port to i32 (i64, ...)*)(i64 %32)
%34 = sext i32 %33 to i64
store i64 %34, i64* @rand_num
%35 = tail call i32 (i64, ...) bitcast (i32 (...)* @genr_rand_port to i32 (i64, ...)*)(i64 %34)
%36 = sext i32 %35 to i64
store i64 %36, i64* @rand_num
%37 = tail call i32 (i64, ...) bitcast (i32 (...)* @genr_rand_port to i32 (i64, ...)*)(i64 %36)
%38 = sext i32 %37 to i64
store i64 %38, i64* @rand_num
%39 = tail call i32 (i64, ...) bitcast (i32 (...)* @genr_rand_port to i32 (i64, ...)*)(i64 %38)
%40 = sext i32 %39 to i64
store i64 %40, i64* @rand_num
ret i64 %8
}