#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 */
scalar_t__ atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ print_usage(char *);
int real_main(unsigned int, unsigned int, unsigned int);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  unsigned int num_clients;
  unsigned int num_printers;
  unsigned int buffer_size;
  if (argc != 4) {
    print_usage(argv[0]);
    return -1;
  }
  num_clients = (unsigned int)atoi(argv[1]);
  if (num_clients == 0) {
    fprintf(stderr, "Invalid num_clients '%s'\n", argv[1]);
    print_usage(argv[0]);
    return -1;
  }
  num_printers = (unsigned int)atoi(argv[2]);
  if (num_printers == 0) {
    fprintf(stderr, "Invalid num_printers '%s'\n", argv[2]);
    print_usage(argv[0]);
    return -1;
  }
  buffer_size = (unsigned int)atoi(argv[3]);
  if (buffer_size == 0) {
    fprintf(stderr, "Invalid buffer size '%s'\n", argv[3]);
    print_usage(argv[0]);
    return -1;
  }
  return real_main(num_clients, num_printers, buffer_size);
}


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   $0x4,-0x8(%rbp)
je     1178 <main+0x38>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <print_usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1276 <main+0x136>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11c7 <main+0x87>
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe56(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <print_usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1276 <main+0x136>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1216 <main+0xd6>
mov    0x2df8(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xe21(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <print_usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1276 <main+0x136>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1265 <main+0x125>
mov    0x2da9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
lea    0xded(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <print_usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1276 <main+0x136>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1030 <real_main@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x4,%edi
jne    11e3 <main+0xa3>
mov    0x8(%rbx),%r15
mov    %r15,%rdi
call   1050 <atoi@plt>
mov    %rax,%r14
test   %r14d,%r14d
je     11a4 <main+0x64>
mov    0x10(%rbx),%r12
mov    %r12,%rdi
call   1050 <atoi@plt>
mov    %rax,%r15
test   %r15d,%r15d
je     11b9 <main+0x79>
mov    0x18(%rbx),%r12
mov    %r12,%rdi
call   1050 <atoi@plt>
test   %eax,%eax
je     11cb <main+0x8b>
mov    %r14d,%edi
mov    %r15d,%esi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <real_main@plt>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
lea    0xe4c(%rip),%rsi
mov    %r15,%rdx
jmp    11de <main+0x9e>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
lea    0xe51(%rip),%rsi
jmp    11db <main+0x9b>
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
lea    0xe5a(%rip),%rsi
mov    %r12,%rdx
call   1040 <fprintf@plt>
mov    (%rbx),%rdi
call   1060 <print_usage@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"Invalid num_clients '%s'\0A\00"
@.str.1 = [27 x i8] c"Invalid num_printers '%s'\0A\00"
@.str.2 = [26 x i8] c"Invalid buffer size '%s'\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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 4
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @print_usage(i8* %14)
store i32 -1, i32* %3
br label %75
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i64 @atoi(i8* %19)
%21 = trunc i64 %20 to i32
store i32 %21, i32* %6
%22 = load i32, i32* %6
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %34
24: ; preds = %16
%25 = load i32, i32* @stderr
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %28)
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 0
%32 = load i8*, i8** %31
%33 = call i32 @print_usage(i8* %32)
store i32 -1, i32* %3
br label %75
34: ; preds = %16
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 2
%37 = load i8*, i8** %36
%38 = call i64 @atoi(i8* %37)
%39 = trunc i64 %38 to i32
store i32 %39, i32* %7
%40 = load i32, i32* %7
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %52
42: ; preds = %34
%43 = load i32, i32* @stderr
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 2
%46 = load i8*, i8** %45
%47 = call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %46)
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 0
%50 = load i8*, i8** %49
%51 = call i32 @print_usage(i8* %50)
store i32 -1, i32* %3
br label %75
52: ; preds = %34
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 3
%55 = load i8*, i8** %54
%56 = call i64 @atoi(i8* %55)
%57 = trunc i64 %56 to i32
store i32 %57, i32* %8
%58 = load i32, i32* %8
%59 = icmp eq i32 %58, 0
br i1 %59, label %60, label %70
60: ; preds = %52
%61 = load i32, i32* @stderr
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 3
%64 = load i8*, i8** %63
%65 = call i32 @fprintf(i32 %61, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %64)
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i64 0
%68 = load i8*, i8** %67
%69 = call i32 @print_usage(i8* %68)
store i32 -1, i32* %3
br label %75
70: ; preds = %52
%71 = load i32, i32* %6
%72 = load i32, i32* %7
%73 = load i32, i32* %8
%74 = call i32 @real_main(i32 %71, i32 %72, i32 %73)
store i32 %74, i32* %3
br label %75
75: ; preds = %70, %60, %42, %24, %11
%76 = load i32, i32* %3
ret i32 %76
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"Invalid num_clients '%s'\0A\00"
@.str.1 = [27 x i8] c"Invalid num_printers '%s'\0A\00"
@.str.2 = [26 x i8] c"Invalid buffer size '%s'\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @print_usage(i8* %5)
br label %42
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i64 @atoi(i8* %9)
%11 = trunc i64 %10 to i32
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %7
%14 = load i32, i32* @stderr
%15 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %9)
%16 = load i8*, i8** %1
%17 = tail call i32 @print_usage(i8* %16)
br label %42
18: ; preds = %7
%19 = getelementptr inbounds i8*, i8** %1, i64 2
%20 = load i8*, i8** %19
%21 = tail call i64 @atoi(i8* %20)
%22 = trunc i64 %21 to i32
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %18
%25 = load i32, i32* @stderr
%26 = tail call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%27 = load i8*, i8** %1
%28 = tail call i32 @print_usage(i8* %27)
br label %42
29: ; preds = %18
%30 = getelementptr inbounds i8*, i8** %1, i64 3
%31 = load i8*, i8** %30
%32 = tail call i64 @atoi(i8* %31)
%33 = trunc i64 %32 to i32
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %40
35: ; preds = %29
%36 = load i32, i32* @stderr
%37 = tail call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %31)
%38 = load i8*, i8** %1
%39 = tail call i32 @print_usage(i8* %38)
br label %42
40: ; preds = %29
%41 = tail call i32 @real_main(i32 %11, i32 %22, i32 %33)
br label %42
42: ; preds = %40, %35, %24, %13, %4
%43 = phi i32 [ -1, %4 ], [ -1, %13 ], [ -1, %24 ], [ -1, %35 ], [ %41, %40 ]
ret i32 %43
}