#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 ReadInputMode(char *);
int ReadLampHours(char *);
int ReadPowerStatus(char *);
int ReadTempSensors(char *);
int /*<<< orphan*/ strcmp(char const *, char *);
int ExecStatusRead(char ret[], const char *arg) {
  if (!strcmp(arg, "power"))
    return (ReadPowerStatus(ret));
  if (!strcmp(arg, "input"))
    return (ReadInputMode(ret));
  if (!strcmp(arg, "lamp"))
    return (ReadLampHours(ret));
  if (!strcmp(arg, "temp"))
    return (ReadTempSensors(ret));
  return (2);
}


x86 assembly (clang, -O0):
<ExecStatusRead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    118a <ExecStatusRead+0x3a>
mov    -0x10(%rbp),%rdi
call   1060 <ReadPowerStatus@plt>
mov    %eax,-0x4(%rbp)
jmp    120f <ExecStatusRead+0xbf>
mov    -0x18(%rbp),%rdi
lea    0xe71(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11b4 <ExecStatusRead+0x64>
mov    -0x10(%rbp),%rdi
call   1050 <ReadInputMode@plt>
mov    %eax,-0x4(%rbp)
jmp    120f <ExecStatusRead+0xbf>
mov    -0x18(%rbp),%rdi
lea    0xe4d(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11de <ExecStatusRead+0x8e>
mov    -0x10(%rbp),%rdi
call   1030 <ReadLampHours@plt>
mov    %eax,-0x4(%rbp)
jmp    120f <ExecStatusRead+0xbf>
mov    -0x18(%rbp),%rdi
lea    0xe28(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1208 <ExecStatusRead+0xb8>
mov    -0x10(%rbp),%rdi
call   1070 <ReadTempSensors@plt>
mov    %eax,-0x4(%rbp)
jmp    120f <ExecStatusRead+0xbf>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ExecStatusRead>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xe9f(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11b3 <ExecStatusRead+0x63>
lea    0xe92(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11c2 <ExecStatusRead+0x72>
lea    0xe85(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11d1 <ExecStatusRead+0x81>
lea    0xe77(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11e0 <ExecStatusRead+0x90>
mov    $0x2,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <ReadPowerStatus@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <ReadInputMode@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <ReadLampHours@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1070 <ReadTempSensors@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"power\00"
@.str.1 = [6 x i8] c"input\00"
@.str.2 = [5 x i8] c"lamp\00"
@.str.3 = [5 x i8] c"temp\00"
define i32 @ExecStatusRead(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = call i32 @strcmp(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = call i32 @ReadPowerStatus(i8* %10)
store i32 %11, i32* %3
br label %34
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = call i32 @strcmp(i8* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %12
%17 = load i8*, i8** %4
%18 = call i32 @ReadInputMode(i8* %17)
store i32 %18, i32* %3
br label %34
19: ; preds = %12
%20 = load i8*, i8** %5
%21 = call i32 @strcmp(i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp ne i32 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %19
%24 = load i8*, i8** %4
%25 = call i32 @ReadLampHours(i8* %24)
store i32 %25, i32* %3
br label %34
26: ; preds = %19
%27 = load i8*, i8** %5
%28 = call i32 @strcmp(i8* %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%29 = icmp ne i32 %28, 0
br i1 %29, label %33, label %30
30: ; preds = %26
%31 = load i8*, i8** %4
%32 = call i32 @ReadTempSensors(i8* %31)
store i32 %32, i32* %3
br label %34
33: ; preds = %26
store i32 2, i32* %3
br label %34
34: ; preds = %33, %30, %23, %16, %9
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
@.str = [6 x i8] c"power\00"
@.str.1 = [6 x i8] c"input\00"
@.str.2 = [5 x i8] c"lamp\00"
@.str.3 = [5 x i8] c"temp\00"
define i32 @ExecStatusRead(i8* %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @ReadPowerStatus(i8* %0)
br label %22
7: ; preds = %2
%8 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @ReadInputMode(i8* %0)
br label %22
12: ; preds = %7
%13 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = tail call i32 @ReadLampHours(i8* %0)
br label %22
17: ; preds = %12
%18 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = tail call i32 @ReadTempSensors(i8* %0)
br label %22
22: ; preds = %17, %20, %15, %10, %5
%23 = phi i32 [ %21, %20 ], [ %16, %15 ], [ %11, %10 ], [ %6, %5 ], [ 2, %17 ]
ret i32 %23
}