#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 atoi(char *);
int /*<<< orphan*/ exit(int);
scalar_t__ getpid();
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ random();
int /*<<< orphan*/ srandom(int);
scalar_t__ sscanf(char *, char *, int *);
scalar_t__ strcmp(char *, char *);
scalar_t__ strncmp(char *, char *, int);
int main(int ac, char *av[]) {
  int d = 10, tmp, i;
  int PNUM = 0;
  for (i = 1; i < ac; i++) {
    if (strcmp(av[i], "-r") == 0)
      srandom((int)getpid());
    else if (strncmp(av[i], "-s", 2) == 0)
      srandom(atoi(av[i] + 2));
    else if (strcmp(av[i], "-n") == 0)
      PNUM = 1;
    else if (sscanf(av[i], "%d", &tmp))
      d = tmp;
    else {
      printf("Usage: %s [-r] [-s<S>] [-n] [<D>]\n", av[0]);
      printf("  Output <D> random points ");
      printf("as <D> lines of coordinate pairs.\n");
      printf("  Default <D> is 10.\n");
      printf("  -r\t Randomize. Use getpid() as seed.\n");
      printf("  -s<S>\t Set random seed to <S>.\n");
      printf("  -n\t Write <D> first before the random points.\n");
      exit(-1);
    }
  }
  if (PNUM)
    printf("%d\n", d);
  for (i = 1; i <= d; i++)
    printf("%4d %4d\n", (int)random() % 10000, (int)random() % 10000);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1338 <main+0x1a8>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe26(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    11fc <main+0x6c>
mov    $0x0,%al
call   1050 <getpid@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
jmp    1325 <main+0x195>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdf4(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1244 <main+0xb4>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
add    $0x2,%rdi
call   10a0 <atoi@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
jmp    1320 <main+0x190>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdaf(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1272 <main+0xe2>
movl   $0x1,-0x20(%rbp)
jmp    131b <main+0x18b>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd84(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1090 <sscanf@plt>
cmp    $0x0,%rax
je     12a3 <main+0x113>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1316 <main+0x186>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd5b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd70(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd7e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd93(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
jmp    131b <main+0x18b>
jmp    1320 <main+0x190>
jmp    1325 <main+0x195>
jmp    132a <main+0x19a>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11bb <main+0x2b>
cmpl   $0x0,-0x20(%rbp)
je     1353 <main+0x1c3>
mov    -0x14(%rbp),%esi
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     13a6 <main+0x216>
mov    $0x0,%al
call   1080 <random@plt>
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    %edx,-0x24(%rbp)
mov    $0x0,%al
call   1080 <random@plt>
mov    -0x24(%rbp),%esi
mov    $0x2710,%ecx
cltd
idiv   %ecx
lea    0xd72(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    135a <main+0x1ca>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0xa,%ebx
cmp    $0x2,%edi
jl     1296 <main+0xf6>
mov    %rsi,%r14
mov    %edi,%ebp
mov    $0xa,%ebx
mov    $0x1,%r13d
lea    0xe30(%rip),%r15
lea    0xe2c(%rip),%r12
movl   $0x0,(%rsp)
jmp    11fb <main+0x5b>
xor    %eax,%eax
call   1060 <getpid@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
add    $0x1,%r13
cmp    %r13,%rbp
je     127c <main+0xdc>
mov    (%r14,%r13,8),%rdi
mov    %r15,%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     11e0 <main+0x40>
mov    (%r14,%r13,8),%rdi
mov    %r12,%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
mov    (%r14,%r13,8),%rdi
test   %rax,%rax
je     1260 <main+0xc0>
lea    0xdd9(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1270 <main+0xd0>
mov    (%r14,%r13,8),%rdi
lea    0xdc7(%rip),%rsi
lea    0x4(%rsp),%rdx
call   10a0 <sscanf@plt>
test   %rax,%rax
je     130e <main+0x16e>
mov    0x4(%rsp),%ebx
jmp    11ee <main+0x4e>
nopl   0x0(%rax,%rax,1)
add    $0x2,%rdi
call   10b0 <atoi@plt>
mov    %eax,%edi
jmp    11e9 <main+0x49>
movl   $0x1,(%rsp)
jmp    11ee <main+0x4e>
cmpl   $0x0,(%rsp)
je     1292 <main+0xf2>
lea    0xdc2(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1070 <printf@plt>
test   %ebx,%ebx
jle    12fd <main+0x15d>
lea    0xdb2(%rip),%r14
nopl   (%rax)
xor    %eax,%eax
call   1090 <random@plt>
movslq %eax,%rbp
imul   $0x68db8bad,%rbp,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%rax
add    %ecx,%eax
imul   $0x2710,%eax,%eax
sub    %eax,%ebp
xor    %eax,%eax
call   1090 <random@plt>
movslq %eax,%rdx
imul   $0x68db8bad,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%rax
add    %ecx,%eax
imul   $0x2710,%eax,%eax
sub    %eax,%edx
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0xffffffff,%ebx
jne    12a0 <main+0x100>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%r14),%rsi
lea    0xcf4(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd09(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd24(%rip),%rdi
call   1050 <puts@plt>
lea    0xd3a(%rip),%rdi
call   1050 <puts@plt>
lea    0xd43(%rip),%rdi
call   1050 <puts@plt>
lea    0xd5e(%rip),%rdi
call   1050 <puts@plt>
lea    0xd73(%rip),%rdi
call   1050 <puts@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-r\00"
@.str.1 = [3 x i8] c"-s\00"
@.str.2 = [3 x i8] c"-n\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [35 x i8] c"Usage: %s [-r] [-s<S>] [-n] [<D>]\0A\00"
@.str.5 = [28 x i8] c" Output <D> random points \00"
@.str.6 = [35 x i8] c"as <D> lines of coordinate pairs.\0A\00"
@.str.7 = [22 x i8] c" Default <D> is 10.\0A\00"
@.str.8 = [40 x i8] c" -r\09 Randomize. Use getpid() as seed.\0A\00"
@.str.9 = [34 x i8] c" -s<S>\09 Set random seed to <S>.\0A\00"
@.str.10 = [49 x i8] c" -n\09 Write <D> first before the random points.\0A\00"
@.str.11 = [4 x i8] c"%d\0A\00"
@.str.12 = [9 x i8] c"%4d %4d\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
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 10, i32* %6
store i32 0, i32* %9
store i32 1, i32* %8
br label %10
10: ; preds = %78, %2
%11 = load i32, i32* %8
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %81
14: ; preds = %10
%15 = load i8**, i8*** %5
%16 = load i32, i32* %8
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %14
%23 = call i64 (...) @getpid()
%24 = trunc i64 %23 to i32
%25 = call i32 @srandom(i32 %24)
br label %77
26: ; preds = %14
%27 = load i8**, i8*** %5
%28 = load i32, i32* %8
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8*, i8** %30
%32 = call i64 @strncmp(i8* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %43
34: ; preds = %26
%35 = load i8**, i8*** %5
%36 = load i32, i32* %8
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8*, i8** %35, i64 %37
%39 = load i8*, i8** %38
%40 = getelementptr inbounds i8, i8* %39, i64 2
%41 = call i32 @atoi(i8* %40)
%42 = call i32 @srandom(i32 %41)
br label %76
43: ; preds = %26
%44 = load i8**, i8*** %5
%45 = load i32, i32* %8
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8*, i8** %44, i64 %46
%48 = load i8*, i8** %47
%49 = call i64 @strcmp(i8* %48, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %52
51: ; preds = %43
store i32 1, i32* %9
br label %75
52: ; preds = %43
%53 = load i8**, i8*** %5
%54 = load i32, i32* %8
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8*, i8** %53, i64 %55
%57 = load i8*, i8** %56
%58 = call i64 @sscanf(i8* %57, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %7)
%59 = icmp ne i64 %58, 0
br i1 %59, label %60, label %62
60: ; preds = %52
%61 = load i32, i32* %7
store i32 %61, i32* %6
br label %74
62: ; preds = %52
%63 = load i8**, i8*** %5
%64 = getelementptr inbounds i8*, i8** %63, i64 0
%65 = load i8*, i8** %64
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i8* %65)
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0))
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0))
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.10, i64 0, i64 0))
%73 = call i32 @exit(i32 -1)
unreachable
74: ; preds = %60
br label %75
75: ; preds = %74, %51
br label %76
76: ; preds = %75, %34
br label %77
77: ; preds = %76, %22
br label %78
78: ; preds = %77
%79 = load i32, i32* %8
%80 = add nsw i32 %79, 1
store i32 %80, i32* %8
br label %10
81: ; preds = %10
%82 = load i32, i32* %9
%83 = icmp ne i32 %82, 0
br i1 %83, label %84, label %87
84: ; preds = %81
%85 = load i32, i32* %6
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i32 %85)
br label %87
87: ; preds = %84, %81
store i32 1, i32* %8
br label %88
88: ; preds = %100, %87
%89 = load i32, i32* %8
%90 = load i32, i32* %6
%91 = icmp sle i32 %89, %90
br i1 %91, label %92, label %103
92: ; preds = %88
%93 = call i64 (...) @random()
%94 = trunc i64 %93 to i32
%95 = srem i32 %94, 10000
%96 = call i64 (...) @random()
%97 = trunc i64 %96 to i32
%98 = srem i32 %97, 10000
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), i32 %95, i32 %98)
br label %100
100: ; preds = %92
%101 = load i32, i32* %8
%102 = add nsw i32 %101, 1
store i32 %102, i32* %8
br label %88
103: ; preds = %88
%104 = load i32, i32* %3
ret i32 %104
}

LLVM IR (-O2):
@.str = [3 x i8] c"-r\00"
@.str.1 = [3 x i8] c"-s\00"
@.str.2 = [3 x i8] c"-n\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [35 x i8] c"Usage: %s [-r] [-s<S>] [-n] [<D>]\0A\00"
@.str.5 = [28 x i8] c" Output <D> random points \00"
@.str.11 = [4 x i8] c"%d\0A\00"
@.str.12 = [9 x i8] c"%4d %4d\0A\00"
@str = [34 x i8] c"as <D> lines of coordinate pairs.\00"
@str.13 = [21 x i8] c" Default <D> is 10.\00"
@str.14 = [39 x i8] c" -r\09 Randomize. Use getpid() as seed.\00"
@str.15 = [33 x i8] c" -s<S>\09 Set random seed to <S>.\00"
@str.16 = [48 x i8] c" -n\09 Write <D> first before the random points.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %59
6: ; preds = %2
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %6, %48
%9 = phi i64 [ 1, %6 ], [ %51, %48 ]
%10 = phi i32 [ 0, %6 ], [ %50, %48 ]
%11 = phi i32 [ 10, %6 ], [ %49, %48 ]
%12 = getelementptr inbounds i8*, i8** %1, i64 %9
%13 = load i8*, i8** %12
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %8
%17 = call i64 (...) @getpid()
%18 = trunc i64 %17 to i32
%19 = call i32 @srandom(i32 %18)
br label %48
20: ; preds = %8
%21 = load i8*, i8** %12
%22 = call i64 @strncmp(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%23 = icmp eq i64 %22, 0
%24 = load i8*, i8** %12
br i1 %23, label %25, label %29
25: ; preds = %20
%26 = getelementptr inbounds i8, i8* %24, i64 2
%27 = call i32 @atoi(i8* %26)
%28 = call i32 @srandom(i32 %27)
br label %48
29: ; preds = %20
%30 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %48, label %32
32: ; preds = %29
%33 = load i8*, i8** %12
%34 = call i64 @sscanf(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%35 = icmp eq i64 %34, 0
br i1 %35, label %38, label %36
36: ; preds = %32
%37 = load i32, i32* %3
br label %48
38: ; preds = %32
%39 = load i8*, i8** %1
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i8* %39)
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.13, i64 0, i64 0))
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.14, i64 0, i64 0))
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.15, i64 0, i64 0))
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.16, i64 0, i64 0))
%47 = call i32 @exit(i32 -1)
unreachable
48: ; preds = %29, %16, %36, %25
%49 = phi i32 [ %11, %16 ], [ %11, %25 ], [ %37, %36 ], [ %11, %29 ]
%50 = phi i32 [ %10, %16 ], [ %10, %25 ], [ %10, %36 ], [ 1, %29 ]
%51 = add nuw nsw i64 %9, 1
%52 = icmp eq i64 %51, %7
br i1 %52, label %53, label %8
53: ; preds = %48
%54 = icmp eq i32 %50, 0
br i1 %54, label %57, label %55
55: ; preds = %53
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i32 %49)
br label %57
57: ; preds = %55, %53
%58 = icmp slt i32 %49, 1
br i1 %58, label %72, label %59
59: ; preds = %2, %57
%60 = phi i32 [ %49, %57 ], [ 10, %2 ]
br label %61
61: ; preds = %59, %61
%62 = phi i32 [ %70, %61 ], [ 1, %59 ]
%63 = call i64 (...) @random()
%64 = trunc i64 %63 to i32
%65 = srem i32 %64, 10000
%66 = call i64 (...) @random()
%67 = trunc i64 %66 to i32
%68 = srem i32 %67, 10000
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), i32 %65, i32 %68)
%70 = add nuw i32 %62, 1
%71 = icmp eq i32 %62, %60
br i1 %71, label %72, label %61
72: ; preds = %61, %57
ret i32 0
}