#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 */
typedef int uint32_t;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ printf(char *, int);
int xorshift();
int main(int argc, char **argv) {
  uint32_t a;
  int i;
  uint32_t n = (argc == 2) ? atoi(argv[1]) : 1;
  for (i = 0; i < n; i++) {
    a = xorshift();
    printf("%u\n", a);
  }
  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   $0x2,-0x8(%rbp)
jne    1165 <main+0x35>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x20(%rbp)
jmp    1172 <main+0x42>
mov    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1172 <main+0x42>
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11b2 <main+0x82>
mov    $0x0,%al
call   1050 <xorshift@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    117f <main+0x4f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
cmp    $0x2,%edi
jne    114d <main+0x1d>
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    1176 <main+0x46>
lea    0xeac(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <xorshift@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
add    $0xffffffff,%ebx
jne    1160 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%u\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 2
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @atoi(i8* %14)
br label %17
16: ; preds = %2
br label %17
17: ; preds = %16, %11
%18 = phi i32 [ %15, %11 ], [ 1, %16 ]
store i32 %18, i32* %8
store i32 0, i32* %7
br label %19
19: ; preds = %27, %17
%20 = load i32, i32* %7
%21 = load i32, i32* %8
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %30
23: ; preds = %19
%24 = call i32 (...) @xorshift()
store i32 %24, i32* %6
%25 = load i32, i32* %6
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %23
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 1
store i32 %29, i32* %7
br label %19
30: ; preds = %19
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%u\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %2, %4
%10 = phi i32 [ %7, %4 ], [ 1, %2 ]
br label %11
11: ; preds = %9, %11
%12 = phi i32 [ %15, %11 ], [ 0, %9 ]
%13 = tail call i32 (...) @xorshift()
%14 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = add nuw nsw i32 %12, 1
%16 = icmp eq i32 %15, %10
br i1 %16, label %17, label %11
17: ; preds = %11, %4
ret i32 0
}