#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*/ osRunTask(char *);
long osSambaAdmin(int iAction) {
  if (iAction == 0) {
    if (osRunTask("/etc/init.d/samba stop") != (0))
      return (-1);
  } else if (iAction == 1) {
    if (osRunTask("/etc/init.d/samba start") != (0))
      return (-1);
  } else if (iAction == 2) {
    if (osRunTask("/etc/init.d/samba stop; /etc/init.d/samba start") != (0))
      return (-1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<osSambaAdmin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    114c <osSambaAdmin+0x3c>
lea    0xed4(%rip),%rdi
call   1030 <osRunTask@plt>
cmp    $0x0,%eax
je     1147 <osSambaAdmin+0x37>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    11c0 <osSambaAdmin+0xb0>
jmp    11b8 <osSambaAdmin+0xa8>
cmpl   $0x1,-0xc(%rbp)
jne    117d <osSambaAdmin+0x6d>
lea    0xed2(%rip),%rdi
call   1030 <osRunTask@plt>
cmp    $0x0,%eax
je     1178 <osSambaAdmin+0x68>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    11c0 <osSambaAdmin+0xb0>
jmp    11b3 <osSambaAdmin+0xa3>
cmpl   $0x2,-0xc(%rbp)
jne    11ae <osSambaAdmin+0x9e>
lea    0xe89(%rip),%rdi
call   1030 <osRunTask@plt>
cmp    $0x0,%eax
je     11a9 <osSambaAdmin+0x99>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    11c0 <osSambaAdmin+0xb0>
jmp    11ae <osSambaAdmin+0x9e>
jmp    11b3 <osSambaAdmin+0xa3>
jmp    11b8 <osSambaAdmin+0xa8>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<osSambaAdmin>:
push   %rax
cmp    $0x2,%edi
je     1128 <osSambaAdmin+0x18>
cmp    $0x1,%edi
je     1131 <osSambaAdmin+0x21>
test   %edi,%edi
jne    114c <osSambaAdmin+0x3c>
lea    0xeda(%rip),%rdi
jmp    1138 <osSambaAdmin+0x28>
lea    0xee8(%rip),%rdi
jmp    1138 <osSambaAdmin+0x28>
lea    0xef7(%rip),%rdi
call   1030 <osRunTask@plt>
mov    %eax,%ecx
mov    $0xffffffffffffffff,%rax
test   %ecx,%ecx
je     114c <osSambaAdmin+0x3c>
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"/etc/init.d/samba stop\00"
@.str.1 = [24 x i8] c"/etc/init.d/samba start\00"
@.str.2 = [48 x i8] c"/etc/init.d/samba stop; /etc/init.d/samba start\00"
define i64 @osSambaAdmin(i32 %0) {
%2 = alloca i64
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = call i32 @osRunTask(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %6
store i64 -1, i64* %2
br label %30
10: ; preds = %6
br label %29
11: ; preds = %1
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = call i32 @osRunTask(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %14
store i64 -1, i64* %2
br label %30
18: ; preds = %14
br label %28
19: ; preds = %11
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %27
22: ; preds = %19
%23 = call i32 @osRunTask(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %22
store i64 -1, i64* %2
br label %30
26: ; preds = %22
br label %27
27: ; preds = %26, %19
br label %28
28: ; preds = %27, %18
br label %29
29: ; preds = %28, %10
store i64 0, i64* %2
br label %30
30: ; preds = %29, %25, %17, %9
%31 = load i64, i64* %2
ret i64 %31
}

LLVM IR (-O2):
@.str = [23 x i8] c"/etc/init.d/samba stop\00"
@.str.1 = [24 x i8] c"/etc/init.d/samba start\00"
@.str.2 = [48 x i8] c"/etc/init.d/samba stop; /etc/init.d/samba start\00"
define i64 @osSambaAdmin(i32 %0) {
switch i32 %0, label %11 [
i32 0, label %2
i32 1, label %5
i32 2, label %8
]
2: ; preds = %1
%3 = tail call i32 @osRunTask(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %11, label %12
5: ; preds = %1
%6 = tail call i32 @osRunTask(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %12
8: ; preds = %1
%9 = tail call i32 @osRunTask(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1, %5, %8, %2
br label %12
12: ; preds = %8, %5, %2, %11
%13 = phi i64 [ 0, %11 ], [ -1, %2 ], [ -1, %5 ], [ -1, %8 ]
ret i64 %13
}