#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 */
struct timeval {
  unsigned int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ bilaterally_symmetricalize(char *, double);
int /*<<< orphan*/ call_module(char *);
int /*<<< orphan*/ finalize();
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ opencscad_init();
int randn(int);
int /*<<< orphan*/ ship_module(char *);
int /*<<< orphan*/ srand(unsigned int);
int sscanf(char *, char *, unsigned int *);
int main(int argc, char *argv[]) {
  unsigned int seed;
  struct timeval tv;
  char *modulename = "myship";
  gettimeofday(&tv, NULL);
  if (argc > 1) {
    if (sscanf(argv[1], "%u", &seed) != 1)
      seed = tv.tv_usec;
  } else
    seed = tv.tv_usec;
  srand(seed);
  opencscad_init();
  ship_module(modulename);
  if (randn(100) < 20)
    bilaterally_symmetricalize(modulename, 10000.0);
  else
    call_module(modulename);
  finalize();
  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)
lea    0xe5b(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <gettimeofday@plt>
cmpl   $0x1,-0x8(%rbp)
jle    11f4 <main+0x64>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe38(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   10a0 <sscanf@plt>
cmp    $0x1,%eax
je     11ef <main+0x5f>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11fa <main+0x6a>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1070 <srand@plt>
mov    $0x0,%al
call   1080 <opencscad_init@plt>
mov    -0x20(%rbp),%rdi
call   1030 <ship_module@plt>
mov    $0x64,%edi
call   10b0 <randn@plt>
cmp    $0x14,%eax
jge    123b <main+0xab>
mov    -0x20(%rbp),%rdi
movsd  0xdcf(%rip),%xmm0
call   1090 <bilaterally_symmetricalize@plt>
jmp    1244 <main+0xb4>
mov    -0x20(%rbp),%rdi
call   1040 <call_module@plt>
mov    $0x0,%al
call   1050 <finalize@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0x10(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
cmp    $0x2,%ebp
jl     11cc <main+0x3c>
mov    0x8(%rbx),%rdi
lea    0xe58(%rip),%rsi
lea    0xc(%rsp),%rdx
call   10a0 <sscanf@plt>
cmp    $0x1,%eax
jne    11cc <main+0x3c>
mov    0xc(%rsp),%edi
jmp    11d4 <main+0x44>
mov    0x10(%rsp),%edi
mov    %edi,0xc(%rsp)
call   1070 <srand@plt>
xor    %eax,%eax
call   1080 <opencscad_init@plt>
lea    0xe21(%rip),%rdi
call   1030 <ship_module@plt>
mov    $0x64,%edi
call   10b0 <randn@plt>
lea    0xe0b(%rip),%rdi
cmp    $0x13,%eax
jg     1211 <main+0x81>
movsd  0xdf6(%rip),%xmm0
call   1090 <bilaterally_symmetricalize@plt>
jmp    1216 <main+0x86>
call   1040 <call_module@plt>
xor    %eax,%eax
call   1050 <finalize@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
@.str = [7 x i8] c"myship\00"
@.str.1 = [3 x i8] c"%u\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.timeval
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %8
%9 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %22
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @sscanf(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%17 = icmp ne i32 %16, 1
br i1 %17, label %18, label %21
18: ; preds = %12
%19 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
%20 = load i32, i32* %19
store i32 %20, i32* %6
br label %21
21: ; preds = %18, %12
br label %25
22: ; preds = %2
%23 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
%24 = load i32, i32* %23
store i32 %24, i32* %6
br label %25
25: ; preds = %22, %21
%26 = load i32, i32* %6
%27 = call i32 @srand(i32 %26)
%28 = call i32 (...) @opencscad_init()
%29 = load i8*, i8** %8
%30 = call i32 @ship_module(i8* %29)
%31 = call i32 @randn(i32 100)
%32 = icmp slt i32 %31, 20
br i1 %32, label %33, label %36
33: ; preds = %25
%34 = load i8*, i8** %8
%35 = call i32 @bilaterally_symmetricalize(i8* %34, double 1.000000e+04)
br label %39
36: ; preds = %25
%37 = load i8*, i8** %8
%38 = call i32 @call_module(i8* %37)
br label %39
39: ; preds = %36, %33
%40 = call i32 (...) @finalize()
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
@.str = [7 x i8] c"myship\00"
@.str.1 = [3 x i8] c"%u\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca %struct.timeval
%5 = bitcast i32* %3 to i8*
%6 = bitcast %struct.timeval* %4 to i8*
%7 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%8 = icmp sgt i32 %0, 1
br i1 %8, label %9, label %19
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = load i32, i32* %3
br label %22
16: ; preds = %9
%17 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%18 = load i32, i32* %17
store i32 %18, i32* %3
br label %22
19: ; preds = %2
%20 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%21 = load i32, i32* %20
store i32 %21, i32* %3
br label %22
22: ; preds = %14, %16, %19
%23 = phi i32 [ %15, %14 ], [ %18, %16 ], [ %21, %19 ]
%24 = call i32 @srand(i32 %23)
%25 = call i32 (...) @opencscad_init()
%26 = call i32 @ship_module(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%27 = call i32 @randn(i32 100)
%28 = icmp slt i32 %27, 20
br i1 %28, label %29, label %31
29: ; preds = %22
%30 = call i32 @bilaterally_symmetricalize(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double 1.000000e+04)
br label %33
31: ; preds = %22
%32 = call i32 @call_module(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %33
33: ; preds = %31, %29
%34 = call i32 (...) @finalize()
ret i32 0
}