#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 atoi(char *);
int data(char *, char *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ init_memshare(char *, int /*<<< orphan*/,
                                 int /*<<< orphan*/);
char *malloc(int);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ print_usage();
int /*<<< orphan*/ printf(char *, char *);
int signal1(char *, int);
int signal2(char *, int, int);
int signal3(char *, int, int, int);
int /*<<< orphan*/ strcmp(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main(int argc, char *argv[]) {
  int value1, value2, value3, mode = 0, retvalue, data_size;
  char dest_proc[20], *datastr;
  memset(dest_proc, '\0', 20);
  if (argc < 4) {
    print_usage();
    exit(2);
  }
  if (!strcmp(argv[1], "-s1")) {
    if (argc != 4) {
      print_usage();
      exit(2);
    }
    mode = 1;
    value1 = atoi(argv[3]);
    strncpy(dest_proc, argv[2], (20 - 1));
  } else if (!strcmp(argv[1], "-s2")) {
    if (argc != 5) {
      print_usage();
      exit(2);
    }
    mode = 2;
    value1 = atoi(argv[3]);
    value2 = atoi(argv[4]);
    strncpy(dest_proc, argv[2], (20 - 1));
  } else if (!strcmp(argv[1], "-s3")) {
    if (argc != 6) {
      print_usage();
      exit(2);
    }
    mode = 3;
    value1 = atoi(argv[3]);
    value2 = atoi(argv[4]);
    value3 = atoi(argv[5]);
    strncpy(dest_proc, argv[2], (20 - 1));
  } else if (!strcmp(argv[1], "-d")) {
    if (argc != 4) {
      print_usage();
      exit(2);
    }
    mode = 4;
    data_size = strlen(argv[3]);
    strncpy(dest_proc, argv[2], (20 - 1));
    datastr = malloc(data_size);
    strncpy(datastr, argv[3], data_size);
  }
  if (mode == 0) {
    print_usage();
    exit(3);
  }
  init_memshare("memsend", 0, 0);
  switch (mode) {
  case 1:
    retvalue = signal1(dest_proc, value1);
    break;
  case 2:
    retvalue = signal2(dest_proc, value1, value2);
    break;
  case 3:
    retvalue = signal3(dest_proc, value1, value2, value3);
    break;
  case 4:
    retvalue = data(dest_proc, datastr, data_size);
    free(datastr);
    break;
  default:
    break;
  }
  if (retvalue == 0)
    exit(0);
  if (retvalue == 1) {
    printf("The destination process %s is not present!\n", dest_proc);
    exit(1);
  }
  exit(2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1070 <memset@plt>
cmpl   $0x4,-0x8(%rbp)
jge    1238 <main+0x48>
mov    $0x0,%al
call   1110 <print_usage@plt>
mov    $0x2,%edi
call   1100 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdc9(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    12a2 <main+0xb2>
cmpl   $0x4,-0x8(%rbp)
je     1270 <main+0x80>
mov    $0x0,%al
call   1110 <print_usage@plt>
mov    $0x2,%edi
call   1100 <exit@plt>
movl   $0x1,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x14(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    $0x13,%edx
call   1040 <strncpy@plt>
jmp    143a <main+0x24a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd63(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    131c <main+0x12c>
cmpl   $0x5,-0x8(%rbp)
je     12da <main+0xea>
mov    $0x0,%al
call   1110 <print_usage@plt>
mov    $0x2,%edi
call   1100 <exit@plt>
movl   $0x2,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x18(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    $0x13,%edx
call   1040 <strncpy@plt>
jmp    1435 <main+0x245>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xced(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    13a6 <main+0x1b6>
cmpl   $0x6,-0x8(%rbp)
je     1354 <main+0x164>
mov    $0x0,%al
call   1110 <print_usage@plt>
mov    $0x2,%edi
call   1100 <exit@plt>
movl   $0x3,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x1c(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    $0x13,%edx
call   1040 <strncpy@plt>
jmp    1430 <main+0x240>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xc67(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    142b <main+0x23b>
cmpl   $0x4,-0x8(%rbp)
je     13de <main+0x1ee>
mov    $0x0,%al
call   1110 <print_usage@plt>
mov    $0x2,%edi
call   1100 <exit@plt>
movl   $0x4,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x28(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    $0x13,%edx
call   1040 <strncpy@plt>
mov    -0x28(%rbp),%edi
call   10b0 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
mov    -0x28(%rbp),%edx
call   1040 <strncpy@plt>
jmp    1430 <main+0x240>
jmp    1435 <main+0x245>
jmp    143a <main+0x24a>
cmpl   $0x0,-0x20(%rbp)
jne    1455 <main+0x265>
mov    $0x0,%al
call   1110 <print_usage@plt>
mov    $0x3,%edi
call   1100 <exit@plt>
lea    0xbc3(%rip),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   10c0 <init_memshare@plt>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x50(%rbp)
sub    $0x3,%eax
ja     14f4 <main+0x304>
mov    -0x50(%rbp),%rax
lea    0xb7b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10e0 <signal1@plt>
mov    %eax,-0x24(%rbp)
jmp    14f9 <main+0x309>
lea    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1080 <signal2@plt>
mov    %eax,-0x24(%rbp)
jmp    14f9 <main+0x309>
lea    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   10f0 <signal3@plt>
mov    %eax,-0x24(%rbp)
jmp    14f9 <main+0x309>
lea    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x28(%rbp),%edx
call   10a0 <data@plt>
mov    %eax,-0x24(%rbp)
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
jmp    14f9 <main+0x309>
jmp    14f9 <main+0x309>
cmpl   $0x0,-0x24(%rbp)
jne    150a <main+0x31a>
xor    %edi,%edi
call   1100 <exit@plt>
cmpl   $0x1,-0x24(%rbp)
jne    152e <main+0x33e>
lea    -0x40(%rbp),%rsi
lea    0xb08(%rip),%rdi
call   1060 <printf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    $0x2,%edi
call   1100 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1070 <memset@plt>
cmp    $0x3,%ebp
jg     1224 <main+0x34>
xor    %eax,%eax
call   1110 <print_usage@plt>
mov    $0x2,%edi
call   1100 <exit@plt>
mov    0x8(%r14),%rbx
lea    0xdd1(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %eax,%eax
jne    127e <main+0x8e>
cmp    $0x4,%ebp
jne    1213 <main+0x23>
mov    0x18(%r14),%rdi
call   10d0 <atoi@plt>
mov    %eax,%ebx
mov    0x10(%r14),%rsi
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    $0x13,%edx
call   1040 <strncpy@plt>
lea    0xda9(%rip),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10c0 <init_memshare@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
call   10e0 <signal1@plt>
jmp    1353 <main+0x163>
lea    0xd7f(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %eax,%eax
jne    12e2 <main+0xf2>
cmp    $0x5,%ebp
jne    1213 <main+0x23>
mov    0x18(%r14),%rdi
call   10d0 <atoi@plt>
mov    %eax,%ebx
mov    0x20(%r14),%rdi
call   10d0 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%r14),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x13,%edx
call   1040 <strncpy@plt>
lea    0xd44(%rip),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10c0 <init_memshare@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1080 <signal2@plt>
jmp    1353 <main+0x163>
lea    0xd1f(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %eax,%eax
jne    1373 <main+0x183>
cmp    $0x6,%ebp
jne    1213 <main+0x23>
mov    0x18(%r14),%rdi
call   10d0 <atoi@plt>
mov    %eax,%r15d
mov    0x20(%r14),%rdi
call   10d0 <atoi@plt>
mov    %eax,%ebp
mov    0x28(%r14),%rdi
call   10d0 <atoi@plt>
mov    %eax,%ebx
mov    0x10(%r14),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x13,%edx
call   1040 <strncpy@plt>
lea    0xcd4(%rip),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10c0 <init_memshare@plt>
mov    %r14,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
call   10f0 <signal3@plt>
mov    %eax,%ebx
cmp    $0x1,%ebx
je     13fa <main+0x20a>
test   %ebx,%ebx
jne    1369 <main+0x179>
xor    %edi,%edi
call   1100 <exit@plt>
mov    $0x2,%edi
call   1100 <exit@plt>
lea    0xc92(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %eax,%eax
jne    1413 <main+0x223>
cmp    $0x4,%ebp
jne    1213 <main+0x23>
mov    0x18(%r14),%rdi
call   1050 <strlen@plt>
mov    %eax,%ebx
mov    0x10(%r14),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x13,%edx
call   1040 <strncpy@plt>
mov    %ebx,%edi
call   10b0 <malloc@plt>
mov    %rax,%rbp
mov    0x18(%r14),%rsi
mov    %rax,%rdi
mov    %ebx,%edx
call   1040 <strncpy@plt>
lea    0xc3e(%rip),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10c0 <init_memshare@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %ebx,%edx
call   10a0 <data@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1030 <free@plt>
cmp    $0x1,%ebx
jne    135e <main+0x16e>
lea    0xc16(%rip),%rdi
mov    %rsp,%rsi
call   1060 <printf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
xor    %eax,%eax
call   1110 <print_usage@plt>
mov    $0x3,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"-s1\00"
@.str.1 = [4 x i8] c"-s2\00"
@.str.2 = [4 x i8] c"-s3\00"
@.str.3 = [3 x i8] c"-d\00"
@.str.4 = [8 x i8] c"memsend\00"
@.str.5 = [44 x i8] c"The destination process %s is not present!\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
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [20 x i8]
%13 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%15 = call i32 @memset(i8* %14, i8 signext 0, i32 20)
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 4
br i1 %17, label %18, label %21
18: ; preds = %2
%19 = call i32 (...) @print_usage()
%20 = call i32 @exit(i32 2)
unreachable
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @strcmp(i8* %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%26 = icmp ne i32 %25, 0
br i1 %26, label %43, label %27
27: ; preds = %21
%28 = load i32, i32* %4
%29 = icmp ne i32 %28, 4
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = call i32 (...) @print_usage()
%32 = call i32 @exit(i32 2)
unreachable
33: ; preds = %27
store i32 1, i32* %9
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 3
%36 = load i8*, i8** %35
%37 = call i32 @atoi(i8* %36)
store i32 %37, i32* %6
%38 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 2
%41 = load i8*, i8** %40
%42 = call i32 @strncpy(i8* %38, i8* %41, i32 19)
br label %132
43: ; preds = %21
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 1
%46 = load i8*, i8** %45
%47 = call i32 @strcmp(i8* %46, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%48 = icmp ne i32 %47, 0
br i1 %48, label %69, label %49
49: ; preds = %43
%50 = load i32, i32* %4
%51 = icmp ne i32 %50, 5
br i1 %51, label %52, label %55
52: ; preds = %49
%53 = call i32 (...) @print_usage()
%54 = call i32 @exit(i32 2)
unreachable
55: ; preds = %49
store i32 2, i32* %9
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 3
%58 = load i8*, i8** %57
%59 = call i32 @atoi(i8* %58)
store i32 %59, i32* %6
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 4
%62 = load i8*, i8** %61
%63 = call i32 @atoi(i8* %62)
store i32 %63, i32* %7
%64 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%65 = load i8**, i8*** %5
%66 = getelementptr inbounds i8*, i8** %65, i64 2
%67 = load i8*, i8** %66
%68 = call i32 @strncpy(i8* %64, i8* %67, i32 19)
br label %131
69: ; preds = %43
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 1
%72 = load i8*, i8** %71
%73 = call i32 @strcmp(i8* %72, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%74 = icmp ne i32 %73, 0
br i1 %74, label %99, label %75
75: ; preds = %69
%76 = load i32, i32* %4
%77 = icmp ne i32 %76, 6
br i1 %77, label %78, label %81
78: ; preds = %75
%79 = call i32 (...) @print_usage()
%80 = call i32 @exit(i32 2)
unreachable
81: ; preds = %75
store i32 3, i32* %9
%82 = load i8**, i8*** %5
%83 = getelementptr inbounds i8*, i8** %82, i64 3
%84 = load i8*, i8** %83
%85 = call i32 @atoi(i8* %84)
store i32 %85, i32* %6
%86 = load i8**, i8*** %5
%87 = getelementptr inbounds i8*, i8** %86, i64 4
%88 = load i8*, i8** %87
%89 = call i32 @atoi(i8* %88)
store i32 %89, i32* %7
%90 = load i8**, i8*** %5
%91 = getelementptr inbounds i8*, i8** %90, i64 5
%92 = load i8*, i8** %91
%93 = call i32 @atoi(i8* %92)
store i32 %93, i32* %8
%94 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%95 = load i8**, i8*** %5
%96 = getelementptr inbounds i8*, i8** %95, i64 2
%97 = load i8*, i8** %96
%98 = call i32 @strncpy(i8* %94, i8* %97, i32 19)
br label %130
99: ; preds = %69
%100 = load i8**, i8*** %5
%101 = getelementptr inbounds i8*, i8** %100, i64 1
%102 = load i8*, i8** %101
%103 = call i32 @strcmp(i8* %102, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%104 = icmp ne i32 %103, 0
br i1 %104, label %129, label %105
105: ; preds = %99
%106 = load i32, i32* %4
%107 = icmp ne i32 %106, 4
br i1 %107, label %108, label %111
108: ; preds = %105
%109 = call i32 (...) @print_usage()
%110 = call i32 @exit(i32 2)
unreachable
111: ; preds = %105
store i32 4, i32* %9
%112 = load i8**, i8*** %5
%113 = getelementptr inbounds i8*, i8** %112, i64 3
%114 = load i8*, i8** %113
%115 = call i32 @strlen(i8* %114)
store i32 %115, i32* %11
%116 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%117 = load i8**, i8*** %5
%118 = getelementptr inbounds i8*, i8** %117, i64 2
%119 = load i8*, i8** %118
%120 = call i32 @strncpy(i8* %116, i8* %119, i32 19)
%121 = load i32, i32* %11
%122 = call i8* @malloc(i32 %121)
store i8* %122, i8** %13
%123 = load i8*, i8** %13
%124 = load i8**, i8*** %5
%125 = getelementptr inbounds i8*, i8** %124, i64 3
%126 = load i8*, i8** %125
%127 = load i32, i32* %11
%128 = call i32 @strncpy(i8* %123, i8* %126, i32 %127)
br label %129
129: ; preds = %111, %99
br label %130
130: ; preds = %129, %81
br label %131
131: ; preds = %130, %55
br label %132
132: ; preds = %131, %33
%133 = load i32, i32* %9
%134 = icmp eq i32 %133, 0
br i1 %134, label %135, label %138
135: ; preds = %132
%136 = call i32 (...) @print_usage()
%137 = call i32 @exit(i32 3)
unreachable
138: ; preds = %132
%139 = call i32 @init_memshare(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 0)
%140 = load i32, i32* %9
switch i32 %140, label %163 [
i32 1, label %141
i32 2, label %145
i32 3, label %150
i32 4, label %156
]
141: ; preds = %138
%142 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%143 = load i32, i32* %6
%144 = call i32 @signal1(i8* %142, i32 %143)
store i32 %144, i32* %10
br label %164
145: ; preds = %138
%146 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%147 = load i32, i32* %6
%148 = load i32, i32* %7
%149 = call i32 @signal2(i8* %146, i32 %147, i32 %148)
store i32 %149, i32* %10
br label %164
150: ; preds = %138
%151 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%152 = load i32, i32* %6
%153 = load i32, i32* %7
%154 = load i32, i32* %8
%155 = call i32 @signal3(i8* %151, i32 %152, i32 %153, i32 %154)
store i32 %155, i32* %10
br label %164
156: ; preds = %138
%157 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%158 = load i8*, i8** %13
%159 = load i32, i32* %11
%160 = call i32 @data(i8* %157, i8* %158, i32 %159)
store i32 %160, i32* %10
%161 = load i8*, i8** %13
%162 = call i32 @free(i8* %161)
br label %164
163: ; preds = %138
br label %164
164: ; preds = %163, %156, %150, %145, %141
%165 = load i32, i32* %10
%166 = icmp eq i32 %165, 0
br i1 %166, label %167, label %169
167: ; preds = %164
%168 = call i32 @exit(i32 0)
unreachable
169: ; preds = %164
%170 = load i32, i32* %10
%171 = icmp eq i32 %170, 1
br i1 %171, label %172, label %176
172: ; preds = %169
%173 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%174 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i8* %173)
%175 = call i32 @exit(i32 1)
unreachable
176: ; preds = %169
%177 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@.str = [4 x i8] c"-s1\00"
@.str.1 = [4 x i8] c"-s2\00"
@.str.2 = [4 x i8] c"-s3\00"
@.str.3 = [3 x i8] c"-d\00"
@.str.4 = [8 x i8] c"memsend\00"
@.str.5 = [44 x i8] c"The destination process %s is not present!\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i8 signext 0, i32 20)
%6 = icmp slt i32 %0, 4
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = call i32 (...) @print_usage()
%9 = call i32 @exit(i32 2)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @strcmp(i8* dereferenceable(1) %12, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %10
%16 = icmp eq i32 %0, 4
br i1 %16, label %47, label %17
17: ; preds = %15
%18 = call i32 (...) @print_usage()
%19 = call i32 @exit(i32 2)
unreachable
20: ; preds = %10
%21 = call i32 @strcmp(i8* dereferenceable(1) %12, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = icmp eq i32 %0, 5
br i1 %24, label %56, label %25
25: ; preds = %23
%26 = call i32 (...) @print_usage()
%27 = call i32 @exit(i32 2)
unreachable
28: ; preds = %20
%29 = call i32 @strcmp(i8* dereferenceable(1) %12, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = icmp eq i32 %0, 6
br i1 %32, label %68, label %33
33: ; preds = %31
%34 = call i32 (...) @print_usage()
%35 = call i32 @exit(i32 2)
unreachable
36: ; preds = %28
%37 = call i32 @strcmp(i8* dereferenceable(1) %12, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %44
39: ; preds = %36
%40 = icmp eq i32 %0, 4
br i1 %40, label %83, label %41
41: ; preds = %39
%42 = call i32 (...) @print_usage()
%43 = call i32 @exit(i32 2)
unreachable
44: ; preds = %36
%45 = call i32 (...) @print_usage()
%46 = call i32 @exit(i32 3)
unreachable
47: ; preds = %15
%48 = getelementptr inbounds i8*, i8** %1, i64 3
%49 = load i8*, i8** %48
%50 = call i32 @atoi(i8* %49)
%51 = getelementptr inbounds i8*, i8** %1, i64 2
%52 = load i8*, i8** %51
%53 = call i32 @strncpy(i8* %4, i8* %52, i32 19)
%54 = call i32 @init_memshare(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 0)
%55 = call i32 @signal1(i8* %4, i32 %50)
br label %96
56: ; preds = %23
%57 = getelementptr inbounds i8*, i8** %1, i64 3
%58 = load i8*, i8** %57
%59 = call i32 @atoi(i8* %58)
%60 = getelementptr inbounds i8*, i8** %1, i64 4
%61 = load i8*, i8** %60
%62 = call i32 @atoi(i8* %61)
%63 = getelementptr inbounds i8*, i8** %1, i64 2
%64 = load i8*, i8** %63
%65 = call i32 @strncpy(i8* %4, i8* %64, i32 19)
%66 = call i32 @init_memshare(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 0)
%67 = call i32 @signal2(i8* %4, i32 %59, i32 %62)
br label %96
68: ; preds = %31
%69 = getelementptr inbounds i8*, i8** %1, i64 3
%70 = load i8*, i8** %69
%71 = call i32 @atoi(i8* %70)
%72 = getelementptr inbounds i8*, i8** %1, i64 4
%73 = load i8*, i8** %72
%74 = call i32 @atoi(i8* %73)
%75 = getelementptr inbounds i8*, i8** %1, i64 5
%76 = load i8*, i8** %75
%77 = call i32 @atoi(i8* %76)
%78 = getelementptr inbounds i8*, i8** %1, i64 2
%79 = load i8*, i8** %78
%80 = call i32 @strncpy(i8* %4, i8* %79, i32 19)
%81 = call i32 @init_memshare(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 0)
%82 = call i32 @signal3(i8* %4, i32 %71, i32 %74, i32 %77)
br label %96
83: ; preds = %39
%84 = getelementptr inbounds i8*, i8** %1, i64 3
%85 = load i8*, i8** %84
%86 = call i32 @strlen(i8* %85)
%87 = getelementptr inbounds i8*, i8** %1, i64 2
%88 = load i8*, i8** %87
%89 = call i32 @strncpy(i8* %4, i8* %88, i32 19)
%90 = call i8* @malloc(i32 %86)
%91 = load i8*, i8** %84
%92 = call i32 @strncpy(i8* %90, i8* %91, i32 %86)
%93 = call i32 @init_memshare(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 0)
%94 = call i32 @data(i8* %4, i8* %90, i32 %86)
%95 = call i32 @free(i8* %90)
br label %96
96: ; preds = %83, %68, %56, %47
%97 = phi i32 [ %94, %83 ], [ %82, %68 ], [ %67, %56 ], [ %55, %47 ]
switch i32 %97, label %103 [
i32 0, label %98
i32 1, label %100
]
98: ; preds = %96
%99 = call i32 @exit(i32 0)
unreachable
100: ; preds = %96
%101 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%102 = call i32 @exit(i32 1)
unreachable
103: ; preds = %96
%104 = call i32 @exit(i32 2)
unreachable
}