#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 double_rand();
int /*<<< orphan*/ exit(int);
double floor(int);
int /*<<< orphan*/ init_rand(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int main(int argc, char *argv[]) {
  int nsites, d, i;
  if (!argv[1] || !argv[2])
    exit(3);
  sscanf(argv[1], "%d", &nsites);
  sscanf(argv[2], "%d", &d);
  init_rand(0);
  while (nsites > 0) {
    for (i = 0; i < d; i++)
      printf("%6.0f ", floor(1e5 * double_rand()));
    printf("\n");
    nsites--;
  }
}


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)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     1194 <main+0x34>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x10(%rax)
jne    119e <main+0x3e>
mov    $0x3,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe5b(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1050 <sscanf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe43(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <sscanf@plt>
xor    %edi,%edi
call   1060 <init_rand@plt>
cmpl   $0x0,-0x14(%rbp)
jle    124a <main+0xea>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    122e <main+0xce>
mov    $0x0,%al
call   1040 <double_rand@plt>
cvtsi2sd %eax,%xmm1
movsd  0xdfb(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1080 <floor@plt>
lea    0xdf2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11e6 <main+0x86>
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    11d5 <main+0x75>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    0x8(%rsi),%rdi
test   %rdi,%rdi
je     1232 <main+0xc2>
mov    %rsi,%rbx
cmpq   $0x0,0x10(%rsi)
je     1232 <main+0xc2>
lea    0xe66(%rip),%r14
lea    0x8(%rsp),%rdx
mov    %r14,%rsi
call   1060 <sscanf@plt>
mov    0x10(%rbx),%rdi
lea    0xc(%rsp),%rdx
mov    %r14,%rsi
call   1060 <sscanf@plt>
xor    %edi,%edi
call   1070 <init_rand@plt>
cmpl   $0x0,0x8(%rsp)
jle    1227 <main+0xb7>
lea    0xe36(%rip),%rbx
jmp    11ea <main+0x7a>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x8(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0x8(%rsp)
cmp    $0x1,%eax
jle    1227 <main+0xb7>
cmpl   $0x0,0xc(%rsp)
jle    11d0 <main+0x60>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1050 <double_rand@plt>
imul   $0x186a0,%eax,%edi
call   1090 <floor@plt>
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jl     1200 <main+0x90>
jmp    11d0 <main+0x60>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    $0x3,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"%6.0f \00"
@.str.2 = [2 x i8] c"\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 i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 2
%16 = load i8*, i8** %15
%17 = icmp ne i8* %16, null
br i1 %17, label %20, label %18
18: ; preds = %13, %2
%19 = call i32 @exit(i32 3)
unreachable
20: ; preds = %13
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @sscanf(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = call i32 @sscanf(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%29 = call i32 @init_rand(i32 0)
br label %30
30: ; preds = %48, %20
%31 = load i32, i32* %6
%32 = icmp sgt i32 %31, 0
br i1 %32, label %33, label %52
33: ; preds = %30
store i32 0, i32* %8
br label %34
34: ; preds = %45, %33
%35 = load i32, i32* %8
%36 = load i32, i32* %7
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %48
38: ; preds = %34
%39 = call i32 (...) @double_rand()
%40 = sitofp i32 %39 to double
%41 = fmul double 1.000000e+05, %40
%42 = fptosi double %41 to i32
%43 = call double @floor(i32 %42)
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %43)
br label %45
45: ; preds = %38
%46 = load i32, i32* %8
%47 = add nsw i32 %46, 1
store i32 %47, i32* %8
br label %34
48: ; preds = %34
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%50 = load i32, i32* %6
%51 = add nsw i32 %50, -1
store i32 %51, i32* %6
br label %30
52: ; preds = %30
%53 = load i32, i32* %3
ret i32 %53
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"%6.0f \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = icmp eq i8* %8, null
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %16
14: ; preds = %10, %2
%15 = tail call i32 @exit(i32 3)
unreachable
16: ; preds = %10
%17 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%18 = load i8*, i8** %11
%19 = call i32 @sscanf(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%20 = call i32 @init_rand(i32 0)
%21 = load i32, i32* %3
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %40
23: ; preds = %16, %35
%24 = load i32, i32* %4
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %35
26: ; preds = %23, %26
%27 = phi i32 [ %32, %26 ], [ 0, %23 ]
%28 = call i32 (...) @double_rand()
%29 = mul i32 %28, 100000
%30 = call double @floor(i32 %29)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %30)
%32 = add nuw nsw i32 %27, 1
%33 = load i32, i32* %4
%34 = icmp slt i32 %32, %33
br i1 %34, label %26, label %35
35: ; preds = %26, %23
%36 = call i32 @putchar(i32 10)
%37 = load i32, i32* %3
%38 = add nsw i32 %37, -1
store i32 %38, i32* %3
%39 = icmp sgt i32 %37, 1
br i1 %39, label %23, label %40
40: ; preds = %35, %16
ret i32 0
}