#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 */
float RAND_MAX;
unsigned long atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, unsigned long, unsigned long);
float rand();
int /*<<< orphan*/ seed_random();
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  unsigned long xmax, ymax;
  unsigned long x, y;
  if (argc < 3) {
    fprintf(stderr, "Usage: %s xmax ymax\n", argv[0]);
    return 2;
  }
  xmax = atoi(argv[1]);
  ymax = atoi(argv[2]);
  if (!seed_random()) {
    return 1;
  }
  x = 1 + (unsigned long)((float)xmax * (rand() / (RAND_MAX + 1.0f)));
  y = 1 + (unsigned long)((float)ymax * (rand() / (RAND_MAX + 1.0f)));
  printf("+%lu+%lu\n", x, y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1198 <main+0x48>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe81(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1340 <main+0x1f0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1040 <seed_random@plt>
cmp    $0x0,%eax
jne    11d6 <main+0x86>
movl   $0x1,-0x4(%rbp)
jmp    1340 <main+0x1f0>
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x38(%rbp)
test   %rax,%rax
movss  %xmm0,-0x34(%rbp)
js     1213 <main+0xc3>
movss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x54(%rbp)
xor    %eax,%eax
mov    %al,-0x55(%rbp)
call   1070 <rand@plt>
movaps %xmm0,%xmm1
movss  -0x54(%rbp),%xmm0
mov    0x2db2(%rip),%rax
mov    %rax,-0x50(%rbp)
movss  (%rax),%xmm2
movss  0xdba(%rip),%xmm3
movss  %xmm3,-0x48(%rbp)
addss  %xmm3,%xmm2
divss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttss2si %xmm1,%rax
mov    %rax,%rdx
sar    $0x3f,%rdx
movss  0xd96(%rip),%xmm1
movss  %xmm1,-0x44(%rbp)
subss  %xmm1,%xmm0
cvttss2si %xmm0,%rcx
and    %rdx,%rcx
or     %rcx,%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x40(%rbp)
test   %rax,%rax
movss  %xmm0,-0x3c(%rbp)
js     12c7 <main+0x177>
movss  -0x40(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
mov    -0x55(%rbp),%al
movss  -0x3c(%rbp),%xmm0
movss  %xmm0,-0x5c(%rbp)
call   1070 <rand@plt>
mov    -0x50(%rbp),%rax
movss  -0x48(%rbp),%xmm4
movss  -0x44(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x5c(%rbp),%xmm0
movss  (%rax),%xmm3
addss  %xmm4,%xmm3
divss  %xmm3,%xmm2
mulss  %xmm2,%xmm0
movaps %xmm0,%xmm2
cvttss2si %xmm2,%rax
mov    %rax,%rdx
sar    $0x3f,%rdx
subss  %xmm1,%xmm0
cvttss2si %xmm0,%rcx
and    %rdx,%rcx
or     %rcx,%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    0xce9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x2,%edi
jg     1182 <main+0x32>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe96(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x2,%r14d
jmp    129f <main+0x14f>
mov    0x8(%rbx),%rdi
call   1060 <atoi@plt>
mov    %rax,%rbp
mov    0x10(%rbx),%rdi
call   1060 <atoi@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <seed_random@plt>
test   %eax,%eax
je     11b1 <main+0x61>
test   %rbp,%rbp
js     11bc <main+0x6c>
cvtsi2ss %rbp,%xmm0
jmp    11d1 <main+0x81>
mov    $0x1,%r14d
jmp    129f <main+0x14f>
mov    %rbp,%rax
shr    %rax
and    $0x1,%ebp
or     %rax,%rbp
cvtsi2ss %rbp,%xmm0
addss  %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
xor    %r14d,%r14d
xor    %eax,%eax
call   1070 <rand@plt>
mov    0x2e00(%rip),%r15
movss  (%r15),%xmm1
addss  0xe0b(%rip),%xmm1
divss  %xmm1,%xmm0
mulss  0x4(%rsp),%xmm0
cvttss2si %xmm0,%rax
mov    %rax,%rcx
sar    $0x3f,%rcx
subss  0xdf1(%rip),%xmm0
cvttss2si %xmm0,%rbp
and    %rcx,%rbp
or     %rax,%rbp
add    $0x1,%rbp
test   %rbx,%rbx
js     1231 <main+0xe1>
xorps  %xmm0,%xmm0
cvtsi2ss %rbx,%xmm0
jmp    1249 <main+0xf9>
mov    %rbx,%rax
shr    %rax
and    $0x1,%ebx
or     %rax,%rbx
xorps  %xmm0,%xmm0
cvtsi2ss %rbx,%xmm0
addss  %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
movss  0xda2(%rip),%xmm1
addss  (%r15),%xmm1
divss  %xmm1,%xmm0
mulss  0x4(%rsp),%xmm0
cvttss2si %xmm0,%rax
mov    %rax,%rcx
subss  0xd87(%rip),%xmm0
cvttss2si %xmm0,%rdx
sar    $0x3f,%rcx
and    %rcx,%rdx
or     %rax,%rdx
add    $0x1,%rdx
lea    0xd86(%rip),%rdi
mov    %rbp,%rsi
call   1030 <printf@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"Usage: %s xmax ymax\0A\00"
@RAND_MAX = global float 0.000000e+00
@.str.1 = [10 x i8] c"+%lu+%lu\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 3
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 2, i32* %3
br label %52
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i64 @atoi(i8* %21)
store i64 %22, i64* %6
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i64 @atoi(i8* %25)
store i64 %26, i64* %7
%27 = call i32 (...) @seed_random()
%28 = icmp ne i32 %27, 0
br i1 %28, label %30, label %29
29: ; preds = %18
store i32 1, i32* %3
br label %52
30: ; preds = %18
%31 = load i64, i64* %6
%32 = uitofp i64 %31 to float
%33 = call float (...) @rand()
%34 = load float, float* @RAND_MAX
%35 = fadd float %34, 1.000000e+00
%36 = fdiv float %33, %35
%37 = fmul float %32, %36
%38 = fptoui float %37 to i64
%39 = add i64 1, %38
store i64 %39, i64* %8
%40 = load i64, i64* %7
%41 = uitofp i64 %40 to float
%42 = call float (...) @rand()
%43 = load float, float* @RAND_MAX
%44 = fadd float %43, 1.000000e+00
%45 = fdiv float %42, %44
%46 = fmul float %41, %45
%47 = fptoui float %46 to i64
%48 = add i64 1, %47
store i64 %48, i64* %9
%49 = load i64, i64* %8
%50 = load i64, i64* %9
%51 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64 %49, i64 %50)
store i32 0, i32* %3
br label %52
52: ; preds = %30, %29, %12
%53 = load i32, i32* %3
ret i32 %53
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"Usage: %s xmax ymax\0A\00"
@RAND_MAX = global float 0.000000e+00
@.str.1 = [10 x i8] c"+%lu+%lu\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %35
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @atoi(i8* %10)
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i64 @atoi(i8* %13)
%15 = tail call i32 (...) @seed_random()
%16 = icmp eq i32 %15, 0
br i1 %16, label %35, label %17
17: ; preds = %8
%18 = uitofp i64 %11 to float
%19 = tail call float (...) @rand()
%20 = load float, float* @RAND_MAX
%21 = fadd float %20, 1.000000e+00
%22 = fdiv float %19, %21
%23 = fmul float %22, %18
%24 = fptoui float %23 to i64
%25 = add i64 %24, 1
%26 = uitofp i64 %14 to float
%27 = tail call float (...) @rand()
%28 = load float, float* @RAND_MAX
%29 = fadd float %28, 1.000000e+00
%30 = fdiv float %27, %29
%31 = fmul float %30, %26
%32 = fptoui float %31 to i64
%33 = add i64 %32, 1
%34 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64 %25, i64 %33)
br label %35
35: ; preds = %8, %17, %4
%36 = phi i32 [ 2, %4 ], [ 0, %17 ], [ 1, %8 ]
ret i32 %36
}