#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 */
scalar_t__ atol(char *);
int /*<<< orphan*/ fwrite(unsigned long *, int, int, int /*<<< orphan*/);
unsigned long getmt();
int /*<<< orphan*/ seedmt(unsigned long);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  int i, n;
  unsigned long k;
  if (argc > 1) {
    seedmt((unsigned long)atol(argv[1]));
  } else {
    seedmt(12345UL);
  }
  while (1) {
    k = getmt();
    fwrite(&k, 1, 4, stdout);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    117a <main+0x3a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atol@plt>
mov    %rax,%rdi
call   1030 <seedmt@plt>
jmp    1184 <main+0x44>
mov    $0x3039,%edi
call   1030 <seedmt@plt>
jmp    1189 <main+0x49>
mov    $0x0,%al
call   1050 <getmt@plt>
mov    %rax,-0x20(%rbp)
mov    0x2e45(%rip),%rax
mov    (%rax),%ecx
lea    -0x20(%rbp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1060 <fwrite@plt>
jmp    1189 <main+0x49>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%eax
mov    $0x3039,%edi
cmp    $0x2,%eax
jl     115c <main+0x1c>
mov    0x8(%rsi),%rdi
call   1040 <atol@plt>
mov    %rax,%rdi
call   1030 <seedmt@plt>
mov    0x2e78(%rip),%r14
mov    %rsp,%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getmt@plt>
mov    %rax,(%rsp)
mov    (%r14),%ecx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1060 <fwrite@plt>
jmp    1170 <main+0x30>

LLVM IR (-O0):
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @atol(i8* %14)
%16 = call i32 @seedmt(i64 %15)
br label %19
17: ; preds = %2
%18 = call i32 @seedmt(i64 12345)
br label %19
19: ; preds = %17, %11
br label %20
20: ; preds = %19, %20
%21 = call i64 (...) @getmt()
store i64 %21, i64* %8
%22 = load i32, i32* @stdout
%23 = call i32 @fwrite(i64* %8, i32 1, i32 4, i32 %22)
br label %20
}

LLVM IR (-O2):
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @atol(i8* %8)
br label %10
10: ; preds = %2, %6
%11 = phi i64 [ %9, %6 ], [ 12345, %2 ]
%12 = tail call i32 @seedmt(i64 %11)
br label %13
13: ; preds = %13, %10
%14 = call i64 (...) @getmt()
store i64 %14, i64* %3
%15 = load i32, i32* @stdout
%16 = call i32 @fwrite(i64* %3, i32 1, i32 4, i32 %15)
br label %13
}