#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 /*<<< orphan*/ do_test(unsigned long, unsigned long);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
scalar_t__ xstrtoul(char *, unsigned long *);
int main(int ac, char **av) {
  unsigned long nr_procs, nr_bytes;
  if (ac != 3)
    goto usage;
  if (xstrtoul(av[1], &nr_procs))
    goto usage;
  if (xstrtoul(av[2], &nr_bytes))
    goto usage;
  setbuf(stdout, NULL);
  setbuf(stderr, NULL);
  return !!do_test(nr_procs, nr_bytes);
usage:
  fprintf(stderr, "usage: %s nr_procs nr_bytes\n", av[0]);
  return 1;
}


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)
cmpl   $0x3,-0x8(%rbp)
je     1165 <main+0x25>
jmp    11ed <main+0xad>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <xstrtoul@plt>
cmp    $0x0,%rax
je     1185 <main+0x45>
jmp    11ed <main+0xad>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <xstrtoul@plt>
cmp    $0x0,%rax
je     11a5 <main+0x65>
jmp    11ed <main+0xad>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <setbuf@plt>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <setbuf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <do_test@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1210 <main+0xd0>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdfc(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    1171 <main+0x31>
mov    0x8(%rbx),%rdi
lea    0x8(%rsp),%rsi
call   1060 <xstrtoul@plt>
test   %rax,%rax
jne    1171 <main+0x31>
mov    0x10(%rbx),%rdi
mov    %rsp,%rsi
call   1060 <xstrtoul@plt>
test   %rax,%rax
je     1194 <main+0x54>
mov    0x2e68(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe7c(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1030 <setbuf@plt>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1030 <setbuf@plt>
mov    0x8(%rsp),%rdi
mov    (%rsp),%rsi
call   1050 <do_test@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
jmp    118e <main+0x4e>

LLVM IR (-O0):
@stdout = global i32 0
@stderr = global i32 0
@.str = [29 x i8] c"usage: %s nr_procs nr_bytes\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 3
br i1 %9, label %10, label %11
10: ; preds = %2
br label %37
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @xstrtoul(i8* %14, i64* %6)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %11
br label %37
18: ; preds = %11
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i64 @xstrtoul(i8* %21, i64* %7)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %18
br label %37
25: ; preds = %18
%26 = load i32, i32* @stdout
%27 = call i32 @setbuf(i32 %26, i32* null)
%28 = load i32, i32* @stderr
%29 = call i32 @setbuf(i32 %28, i32* null)
%30 = load i64, i64* %6
%31 = load i64, i64* %7
%32 = call i32 @do_test(i64 %30, i64 %31)
%33 = icmp ne i32 %32, 0
%34 = xor i1 %33, true
%35 = xor i1 %34, true
%36 = zext i1 %35 to i32
store i32 %36, i32* %3
br label %43
37: ; preds = %24, %17, %10
%38 = load i32, i32* @stderr
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 0
%41 = load i8*, i8** %40
%42 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %41)
store i32 1, i32* %3
br label %43
43: ; preds = %37, %25
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@stdout = global i32 0
@stderr = global i32 0
@.str = [29 x i8] c"usage: %s nr_procs nr_bytes\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i64
%4 = alloca i64
%5 = bitcast i64* %3 to i8*
%6 = bitcast i64* %4 to i8*
%7 = icmp eq i32 %0, 3
br i1 %7, label %8, label %28
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = call i64 @xstrtoul(i8* %10, i64* %3)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %28
13: ; preds = %8
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = call i64 @xstrtoul(i8* %15, i64* %4)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %28
18: ; preds = %13
%19 = load i32, i32* @stdout
%20 = call i32 @setbuf(i32 %19, i32* null)
%21 = load i32, i32* @stderr
%22 = call i32 @setbuf(i32 %21, i32* null)
%23 = load i64, i64* %3
%24 = load i64, i64* %4
%25 = call i32 @do_test(i64 %23, i64 %24)
%26 = icmp ne i32 %25, 0
%27 = zext i1 %26 to i32
br label %32
28: ; preds = %13, %8, %2
%29 = load i32, i32* @stderr
%30 = load i8*, i8** %1
%31 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %30)
br label %32
32: ; preds = %28, %18
%33 = phi i32 [ 1, %28 ], [ %27, %18 ]
ret i32 %33
}