#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 getopt(int, char **, char *);
int multicast_receiver(int, char **);
int multicast_sender(int, char **);
int /*<<< orphan*/ usage(char *);
int main(int argc, char **argv) {
  int c;
  if (argc < 2) {
    usage(argv[0]);
    return -1;
  }
  while ((c = getopt(argc, argv, "csh?")) != -1) {
    switch (c) {
    case 'c':
      return multicast_receiver(argc, argv);
    case 's':
      return multicast_sender(argc, argv);
    default:
      usage(argv[0]);
      return 1;
    }
  }
  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)
cmpl   $0x2,-0x8(%rbp)
jge    1178 <main+0x38>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1208 <main+0xc8>
jmp    117d <main+0x3d>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe75(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     1201 <main+0xc1>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x63,%eax
je     11c1 <main+0x81>
jmp    11b0 <main+0x70>
mov    -0x18(%rbp),%eax
sub    $0x73,%eax
je     11d5 <main+0x95>
jmp    11e9 <main+0xa9>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <multicast_receiver@plt>
mov    %eax,-0x4(%rbp)
jmp    1208 <main+0xc8>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <multicast_sender@plt>
mov    %eax,-0x4(%rbp)
jmp    1208 <main+0xc8>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    1208 <main+0xc8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     115a <main+0x1a>
mov    (%rbx),%rdi
call   1050 <usage@plt>
mov    $0xffffffff,%eax
jmp    11ab <main+0x6b>
mov    %edi,%ebp
lea    0xe9d(%rip),%rdx
mov    %rbx,%rsi
call   1060 <getopt@plt>
cmp    $0xffffffff,%eax
je     118a <main+0x4a>
cmp    $0x73,%eax
je     118e <main+0x4e>
cmp    $0x63,%eax
jne    119e <main+0x5e>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <multicast_receiver@plt>
xor    %eax,%eax
jmp    11ab <main+0x6b>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <multicast_sender@plt>
mov    (%rbx),%rdi
call   1050 <usage@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"csh?\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @usage(i8* %12)
store i32 -1, i32* %3
br label %36
14: ; preds = %2
br label %15
15: ; preds = %14
%16 = load i32, i32* %4
%17 = load i8**, i8*** %5
%18 = call i32 @getopt(i32 %16, i8** %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %18, i32* %6
%19 = icmp ne i32 %18, -1
br i1 %19, label %20, label %35
20: ; preds = %15
%21 = load i32, i32* %6
switch i32 %21, label %30 [
i32 99, label %22
i32 115, label %26
]
22: ; preds = %20
%23 = load i32, i32* %4
%24 = load i8**, i8*** %5
%25 = call i32 @multicast_receiver(i32 %23, i8** %24)
store i32 %25, i32* %3
br label %36
26: ; preds = %20
%27 = load i32, i32* %4
%28 = load i8**, i8*** %5
%29 = call i32 @multicast_sender(i32 %27, i8** %28)
store i32 %29, i32* %3
br label %36
30: ; preds = %20
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 0
%33 = load i8*, i8** %32
%34 = call i32 @usage(i8* %33)
store i32 1, i32* %3
br label %36
35: ; preds = %15
store i32 0, i32* %3
br label %36
36: ; preds = %35, %30, %26, %22, %9
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@.str = [5 x i8] c"csh?\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @usage(i8* %5)
br label %16
7: ; preds = %2
%8 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
switch i32 %8, label %13 [
i32 -1, label %16
i32 99, label %9
i32 115, label %11
]
9: ; preds = %7
%10 = tail call i32 @multicast_receiver(i32 %0, i8** %1)
br label %16
11: ; preds = %7
%12 = tail call i32 @multicast_sender(i32 %0, i8** %1)
br label %16
13: ; preds = %7
%14 = load i8*, i8** %1
%15 = tail call i32 @usage(i8* %14)
br label %16
16: ; preds = %7, %13, %11, %9, %4
%17 = phi i32 [ -1, %4 ], [ 1, %13 ], [ %12, %11 ], [ %10, %9 ], [ 0, %7 ]
ret i32 %17
}