#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 */
void *strtoul(char *, int /*<<< orphan*/ *, int);
scalar_t__ test_multi(size_t, int);
scalar_t__ test_regular(size_t, int);
int main(int argc, char *argv[]) {
  size_t size = (1UL << 23) - 200;
  int seed = 1;
  if (argc > 1) {
    size = strtoul(argv[1], NULL, 10);
    if (argc > 2)
      seed = strtoul(argv[2], NULL, 10);
  }
  if (test_regular(size, seed))
    return 1;
  if (test_multi(size, 0))
    return 2;
  if (test_multi(size, 17))
    return 3;
  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)
movq   $0x7fff38,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11a1 <main+0x71>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1050 <strtoul@plt>
mov    %rax,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    119c <main+0x6c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1050 <strtoul@plt>
mov    %eax,-0x1c(%rbp)
jmp    11a1 <main+0x71>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1040 <test_regular@plt>
cmp    $0x0,%rax
je     11c3 <main+0x93>
movl   $0x1,-0x4(%rbp)
jmp    120f <main+0xdf>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1030 <test_multi@plt>
cmp    $0x0,%rax
je     11e4 <main+0xb4>
movl   $0x2,-0x4(%rbp)
jmp    120f <main+0xdf>
mov    -0x18(%rbp),%rdi
mov    $0x11,%esi
call   1030 <test_multi@plt>
cmp    $0x0,%rax
je     1208 <main+0xd8>
movl   $0x3,-0x4(%rbp)
jmp    120f <main+0xdf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    $0x1,%r14d
mov    $0x7fff38,%ebx
mov    $0x1,%esi
cmp    $0x2,%edi
jl     1181 <main+0x51>
mov    %edi,%ebp
mov    0x8(%r15),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtoul@plt>
mov    %rax,%rbx
mov    $0x1,%esi
cmp    $0x2,%ebp
je     1181 <main+0x51>
mov    0x10(%r15),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtoul@plt>
mov    %rax,%rsi
mov    %rbx,%rdi
call   1040 <test_regular@plt>
test   %rax,%rax
jne    11bc <main+0x8c>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <test_multi@plt>
mov    $0x2,%r14d
test   %rax,%rax
jne    11bc <main+0x8c>
mov    %rbx,%rdi
mov    $0x11,%esi
call   1030 <test_multi@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    (%rcx,%rcx,2),%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 8388408, i64* %6
store i32 1, i32* %7
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %25
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i8* @strtoul(i8* %13, i32* null, i32 10)
%15 = ptrtoint i8* %14 to i64
store i64 %15, i64* %6
%16 = load i32, i32* %4
%17 = icmp sgt i32 %16, 2
br i1 %17, label %18, label %24
18: ; preds = %10
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i8* @strtoul(i8* %21, i32* null, i32 10)
%23 = ptrtoint i8* %22 to i32
store i32 %23, i32* %7
br label %24
24: ; preds = %18, %10
br label %25
25: ; preds = %24, %2
%26 = load i64, i64* %6
%27 = load i32, i32* %7
%28 = call i64 @test_regular(i64 %26, i32 %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %25
store i32 1, i32* %3
br label %42
31: ; preds = %25
%32 = load i64, i64* %6
%33 = call i64 @test_multi(i64 %32, i32 0)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %31
store i32 2, i32* %3
br label %42
36: ; preds = %31
%37 = load i64, i64* %6
%38 = call i64 @test_multi(i64 %37, i32 17)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %41
40: ; preds = %36
store i32 3, i32* %3
br label %42
41: ; preds = %36
store i32 0, i32* %3
br label %42
42: ; preds = %41, %40, %35, %30
%43 = load i32, i32* %3
ret i32 %43
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %16
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i8* @strtoul(i8* nocapture %6, i32* null, i32 10)
%8 = ptrtoint i8* %7 to i64
%9 = icmp eq i32 %0, 2
br i1 %9, label %16, label %10
10: ; preds = %4
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i8* @strtoul(i8* nocapture %12, i32* null, i32 10)
%14 = ptrtoint i8* %13 to i64
%15 = trunc i64 %14 to i32
br label %16
16: ; preds = %4, %10, %2
%17 = phi i64 [ %8, %10 ], [ %8, %4 ], [ 8388408, %2 ]
%18 = phi i32 [ %15, %10 ], [ 1, %4 ], [ 1, %2 ]
%19 = tail call i64 @test_regular(i64 %17, i32 %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %28
21: ; preds = %16
%22 = tail call i64 @test_multi(i64 %17, i32 0)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %21
%25 = tail call i64 @test_multi(i64 %17, i32 17)
%26 = icmp eq i64 %25, 0
%27 = select i1 %26, i32 0, i32 3
br label %28
28: ; preds = %24, %21, %16
%29 = phi i32 [ 1, %16 ], [ 2, %21 ], [ %27, %24 ]
ret i32 %29
}