#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*/ connectToServer();
int /*<<< orphan*/ gpsProcess();
int /*<<< orphan*/ inetConnect();
int /*<<< orphan*/ log_write(char *, char *, int /*<<< orphan*/ *);
void execProc(int procID) {
  switch (procID) {
  case 0:
    gpsProcess();
    break;
  case 1:
    inetConnect();
    break;
  case 2:
    connectToServer();
    break;
  default:
    log_write("Main parent", "Trying to execute an unkown process.", NULL);
  }
  return;
}


x86 assembly (clang, -O0):
<execProc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
test   %eax,%eax
je     1180 <execProc+0x40>
jmp    115e <execProc+0x1e>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
je     118c <execProc+0x4c>
jmp    116f <execProc+0x2f>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     1198 <execProc+0x58>
jmp    11a4 <execProc+0x64>
mov    $0x0,%al
call   1030 <gpsProcess@plt>
jmp    11bb <execProc+0x7b>
mov    $0x0,%al
call   1050 <inetConnect@plt>
jmp    11bb <execProc+0x7b>
mov    $0x0,%al
call   1040 <connectToServer@plt>
jmp    11bb <execProc+0x7b>
lea    0xe55(%rip),%rdi
lea    0xe5a(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1060 <log_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execProc>:
cmp    $0x2,%edi
je     1155 <execProc+0x15>
cmp    $0x1,%edi
je     115c <execProc+0x1c>
test   %edi,%edi
jne    1163 <execProc+0x23>
xor    %eax,%eax
jmp    1030 <gpsProcess@plt>
xor    %eax,%eax
jmp    1040 <connectToServer@plt>
xor    %eax,%eax
jmp    1050 <inetConnect@plt>
lea    0xe96(%rip),%rdi
lea    0xe9b(%rip),%rsi
xor    %edx,%edx
jmp    1060 <log_write@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"Main parent\00"
@.str.1 = [37 x i8] c"Trying to execute an unkown process.\00"
define void @execProc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %10 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
]
4: ; preds = %1
%5 = call i32 (...) @gpsProcess()
br label %12
6: ; preds = %1
%7 = call i32 (...) @inetConnect()
br label %12
8: ; preds = %1
%9 = call i32 (...) @connectToServer()
br label %12
10: ; preds = %1
%11 = call i32 @log_write(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32* null)
br label %12
12: ; preds = %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"Main parent\00"
@.str.1 = [37 x i8] c"Trying to execute an unkown process.\00"
define void @execProc(i32 %0) {
switch i32 %0, label %8 [
i32 0, label %2
i32 1, label %4
i32 2, label %6
]
2: ; preds = %1
%3 = tail call i32 (...) @gpsProcess()
br label %10
4: ; preds = %1
%5 = tail call i32 (...) @inetConnect()
br label %10
6: ; preds = %1
%7 = tail call i32 (...) @connectToServer()
br label %10
8: ; preds = %1
%9 = tail call i32 @log_write(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32* null)
br label %10
10: ; preds = %8, %6, %4, %2
ret void
}