#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 getpid();
int /*<<< orphan*/ printf(char *, ...);
int random();
int /*<<< orphan*/ srandom(int);
int time(int /*<<< orphan*/);
int main(int argc, char **argv) {
  int NUM;
  int i, x, y, z;
  srandom(getpid() * time(0));
  if (argc != 2) {
  usage:
    printf("gen_test_points <num>\n");
    return 1;
  }
  NUM = atoi(argv[1]);
  printf("/* this file autogenerated by gen_test_points.c */\n");
  printf("#define NUM_COORDS %d\n", NUM);
  printf("Point test_points[%d] = {\n", NUM);
  for (i = 0; i < NUM; i++) {
    x = random() % 100;
    y = random() % 100;
    z = random() % 100;
    printf("    { %d.%d, %d.%d, %d.%d }%s\n", x / 10, x % 10, y / 10, y % 10,
           z / 10, z % 10, (i != (NUM - 1)) ? "," : "");
  }
  printf("};\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x48,%rsp
movl   $0x0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,-0x30(%rbp)
xor    %edi,%edi
call   1060 <time@plt>
mov    -0x30(%rbp),%edi
imul   %eax,%edi
call   1030 <srandom@plt>
cmpl   $0x2,-0x10(%rbp)
je     11bc <main+0x5c>
jmp    11a2 <main+0x42>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0xc(%rbp)
jmp    12f3 <main+0x193>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x1c(%rbp)
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12de <main+0x17e>
mov    $0x0,%al
call   1070 <random@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x24(%rbp)
mov    $0x0,%al
call   1070 <random@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x28(%rbp)
mov    $0x0,%al
call   1070 <random@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x2c(%rbp)
mov    -0x24(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x24(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x34(%rbp)
mov    -0x28(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
mov    $0xa,%edi
cltd
idiv   %edi
mov    %edx,%r8d
mov    -0x2c(%rbp),%eax
mov    $0xa,%edi
cltd
idiv   %edi
mov    %eax,%r9d
mov    -0x2c(%rbp),%eax
mov    $0xa,%edi
cltd
idiv   %edi
mov    %edx,%r10d
mov    -0x34(%rbp),%edx
mov    -0x20(%rbp),%r11d
mov    -0x1c(%rbp),%ebx
sub    $0x1,%ebx
lea    0xd9f(%rip),%rax
lea    0xdea(%rip),%rdi
cmp    %ebx,%r11d
cmovne %rdi,%rax
lea    0xdbd(%rip),%rdi
mov    %r10d,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1203 <main+0xa3>
lea    0xdb9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x48,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%r15d
xor    %r13d,%r13d
xor    %eax,%eax
call   1050 <getpid@plt>
mov    %eax,%ebp
xor    %edi,%edi
call   1070 <time@plt>
imul   %eax,%ebp
mov    %ebp,%edi
call   1030 <srandom@plt>
cmp    $0x2,%r15d
jne    1326 <main+0x1b6>
mov    0x8(%r14),%rdi
call   1090 <atoi@plt>
mov    %eax,%r15d
lea    0xe98(%rip),%rdi
call   1040 <puts@plt>
lea    0xe39(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe3f(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe9d(%rip),%rdi
test   %r15d,%r15d
jle    1333 <main+0x1c3>
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1080 <random@plt>
movslq %eax,%r12
imul   $0x51eb851f,%r12,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%r12d
xor    %eax,%eax
call   1080 <random@plt>
movslq %eax,%r14
imul   $0x51eb851f,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%r14d
xor    %eax,%eax
call   1080 <random@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
movsbl %r12b,%ecx
imul   $0x67,%ecx,%ecx
movzwl %cx,%ecx
mov    %ecx,%edx
shr    $0xf,%edx
shr    $0x8,%ecx
sar    $0x2,%cl
add    %dl,%cl
movsbl %cl,%esi
movzbl %sil,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%r12b
movsbl %r12b,%edx
movsbl %r14b,%ecx
imul   $0x67,%ecx,%ecx
movzwl %cx,%ecx
mov    %ecx,%edi
shr    $0xf,%edi
shr    $0x8,%ecx
sar    $0x2,%cl
add    %dil,%cl
movsbl %cl,%ecx
movzbl %cl,%edi
add    %edi,%edi
lea    (%rdi,%rdi,4),%edi
sub    %dil,%r14b
movsbl %r14b,%r8d
movsbl %al,%edi
imul   $0x67,%edi,%edi
movzwl %di,%edi
mov    %edi,%ebx
shr    $0xf,%ebx
shr    $0x8,%edi
sar    $0x2,%dil
add    %bl,%dil
movsbl %dil,%r9d
movzbl %r9b,%edi
add    %edi,%edi
lea    (%rdi,%rdi,4),%edi
sub    %dil,%al
movsbl %al,%ebx
cmp    $0x1,%r15d
lea    0xd5d(%rip),%rbp
lea    0xd1b(%rip),%rax
cmove  %rax,%rbp
lea    0xd2c(%rip),%rdi
xor    %eax,%eax
push   %rbp
push   %rbx
call   1060 <printf@plt>
add    $0x10,%rsp
add    $0xffffffff,%r15d
jne    1200 <main+0x90>
lea    0xd62(%rip),%rdi
jmp    1333 <main+0x1c3>
mov    $0x1,%r13d
lea    0xd56(%rip),%rdi
call   1040 <puts@plt>
mov    %r13d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"gen_test_points <num>\0A\00"
@.str.1 = [52 x i8] c"/* this file autogenerated by gen_test_points.c */\0A\00"
@.str.2 = [23 x i8] c"#define NUM_COORDS %d\0A\00"
@.str.3 = [27 x i8] c"Point test_points[%d] = {\0A\00"
@.str.4 = [31 x i8] c" { %d.%d, %d.%d, %d.%d }%s\0A\00"
@.str.5 = [2 x i8] c",\00"
@.str.6 = [1 x i8] zeroinitializer
@.str.7 = [4 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
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 (...) @getpid()
%12 = call i32 @time(i32 0)
%13 = mul nsw i32 %11, %12
%14 = call i32 @srandom(i32 %13)
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 2
br i1 %16, label %17, label %20
17: ; preds = %2
br label %18
18: ; preds = %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %65
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @atoi(i8* %23)
store i32 %24, i32* %6
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%26 = load i32, i32* %6
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %6
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %28)
store i32 0, i32* %7
br label %30
30: ; preds = %60, %20
%31 = load i32, i32* %7
%32 = load i32, i32* %6
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %63
34: ; preds = %30
%35 = call i32 (...) @random()
%36 = srem i32 %35, 100
store i32 %36, i32* %8
%37 = call i32 (...) @random()
%38 = srem i32 %37, 100
store i32 %38, i32* %9
%39 = call i32 (...) @random()
%40 = srem i32 %39, 100
store i32 %40, i32* %10
%41 = load i32, i32* %8
%42 = sdiv i32 %41, 10
%43 = load i32, i32* %8
%44 = srem i32 %43, 10
%45 = load i32, i32* %9
%46 = sdiv i32 %45, 10
%47 = load i32, i32* %9
%48 = srem i32 %47, 10
%49 = load i32, i32* %10
%50 = sdiv i32 %49, 10
%51 = load i32, i32* %10
%52 = srem i32 %51, 10
%53 = load i32, i32* %7
%54 = load i32, i32* %6
%55 = sub nsw i32 %54, 1
%56 = icmp ne i32 %53, %55
%57 = zext i1 %56 to i64
%58 = select i1 %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0)
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %42, i32 %44, i32 %46, i32 %48, i32 %50, i32 %52, i8* %58)
br label %60
60: ; preds = %34
%61 = load i32, i32* %7
%62 = add nsw i32 %61, 1
store i32 %62, i32* %7
br label %30
63: ; preds = %30
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %3
br label %65
65: ; preds = %63, %18
%66 = load i32, i32* %3
ret i32 %66
}

LLVM IR (-O2):
@.str.2 = [23 x i8] c"#define NUM_COORDS %d\0A\00"
@.str.3 = [27 x i8] c"Point test_points[%d] = {\0A\00"
@.str.4 = [31 x i8] c" { %d.%d, %d.%d, %d.%d }%s\0A\00"
@.str.5 = [2 x i8] c",\00"
@.str.6 = [1 x i8] zeroinitializer
@str = [51 x i8] c"/* this file autogenerated by gen_test_points.c */\00"
@str.8 = [3 x i8] c"};\00"
@str.9 = [22 x i8] c"gen_test_points <num>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @getpid()
%4 = tail call i32 @time(i32 0)
%5 = mul nsw i32 %4, %3
%6 = tail call i32 @srandom(i32 %5)
%7 = icmp eq i32 %0, 2
br i1 %7, label %8, label %46
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%15 = icmp sgt i32 %11, 0
br i1 %15, label %16, label %46
16: ; preds = %8
%17 = add nsw i32 %11, -1
br label %18
18: ; preds = %16, %18
%19 = phi i32 [ 0, %16 ], [ %44, %18 ]
%20 = tail call i32 (...) @random()
%21 = srem i32 %20, 100
%22 = tail call i32 (...) @random()
%23 = srem i32 %22, 100
%24 = tail call i32 (...) @random()
%25 = srem i32 %24, 100
%26 = trunc i32 %21 to i8
%27 = sdiv i8 %26, 10
%28 = sext i8 %27 to i32
%29 = srem i8 %26, 10
%30 = sext i8 %29 to i32
%31 = trunc i32 %23 to i8
%32 = sdiv i8 %31, 10
%33 = sext i8 %32 to i32
%34 = srem i8 %31, 10
%35 = sext i8 %34 to i32
%36 = trunc i32 %25 to i8
%37 = sdiv i8 %36, 10
%38 = sext i8 %37 to i32
%39 = srem i8 %36, 10
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %19, %17
%42 = select i1 %41, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0)
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %28, i32 %30, i32 %33, i32 %35, i32 %38, i32 %40, i8* %42)
%44 = add nuw nsw i32 %19, 1
%45 = icmp eq i32 %44, %11
br i1 %45, label %46, label %18
46: ; preds = %18, %8, %2
%47 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @str.9, i64 0, i64 0), %2 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0), %8 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0), %18 ]
%48 = phi i32 [ 1, %2 ], [ 0, %8 ], [ 0, %18 ]
%49 = tail call i32 @puts(i8* dereferenceable(1) %47)
ret i32 %48
}