#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*/ cmd_clean(char *);
int /*<<< orphan*/ cmd_oscillate(char *, char const *);
int /*<<< orphan*/ cmd_set_pin(char *, char const *);
int /*<<< orphan*/ cmd_show_pin(char *, char const *);
int /*<<< orphan*/ print(char *);
scalar_t__ strchr(char const *, char);
scalar_t__ strcmp(char const *, char *);
int /*<<< orphan*/ usage(int);
int do_command(char *buf, const char **args, int argc) {
  const char *command = args[0];
  if (*command == 'P') {
    if (strchr(command, '<'))
      cmd_set_pin(buf, command);
    else if (strchr(command, '='))
      cmd_set_pin(buf, command);
    else if (strchr(command, '?'))
      cmd_set_pin(buf, command);
    else if (strchr(command, '*'))
      cmd_oscillate(buf, command);
    else
      cmd_show_pin(buf, command);
  } else if (strcmp(command, "print") == 0)
    print(buf);
  else if (strcmp(command, "clean") == 0)
    cmd_clean(buf);
  else
    usage(1);
  return 1;
}


x86 assembly (clang, -O0):
<do_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x50,%eax
jne    1277 <do_command+0xf7>
mov    -0x20(%rbp),%rdi
mov    $0x3c,%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
je     11d8 <do_command+0x58>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1090 <cmd_set_pin@plt>
jmp    1272 <do_command+0xf2>
mov    -0x20(%rbp),%rdi
mov    $0x3d,%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
je     1202 <do_command+0x82>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1090 <cmd_set_pin@plt>
jmp    126d <do_command+0xed>
mov    -0x20(%rbp),%rdi
mov    $0x3f,%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
je     122c <do_command+0xac>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1090 <cmd_set_pin@plt>
jmp    1268 <do_command+0xe8>
mov    -0x20(%rbp),%rdi
mov    $0x2a,%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
je     1256 <do_command+0xd6>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10a0 <cmd_oscillate@plt>
jmp    1263 <do_command+0xe3>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <cmd_show_pin@plt>
jmp    1268 <do_command+0xe8>
jmp    126d <do_command+0xed>
jmp    1272 <do_command+0xf2>
jmp    12db <do_command+0x15b>
mov    -0x20(%rbp),%rdi
lea    0xd7e(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    129f <do_command+0x11f>
mov    -0x8(%rbp),%rdi
call   1050 <print@plt>
jmp    12d6 <do_command+0x156>
mov    -0x20(%rbp),%rdi
lea    0xd5c(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12c7 <do_command+0x147>
mov    -0x8(%rbp),%rdi
call   1070 <cmd_clean@plt>
jmp    12d1 <do_command+0x151>
mov    $0x1,%edi
call   1080 <usage@plt>
jmp    12d6 <do_command+0x156>
jmp    12db <do_command+0x15b>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_command>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rsi),%rbx
cmpb   $0x50,(%rbx)
jne    11d2 <do_command+0x52>
mov    %rbx,%rdi
mov    $0x3c,%esi
call   1040 <strchr@plt>
test   %rax,%rax
jne    11c5 <do_command+0x45>
mov    %rbx,%rdi
mov    $0x3d,%esi
call   1040 <strchr@plt>
test   %rax,%rax
jne    11c5 <do_command+0x45>
mov    %rbx,%rdi
mov    $0x3f,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1225 <do_command+0xa5>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1090 <cmd_set_pin@plt>
jmp    1218 <do_command+0x98>
lea    0xe27(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1206 <do_command+0x86>
lea    0xe19(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1210 <do_command+0x90>
mov    $0x1,%edi
call   1080 <usage@plt>
jmp    1218 <do_command+0x98>
mov    %r14,%rdi
call   1050 <print@plt>
jmp    1218 <do_command+0x98>
mov    %r14,%rdi
call   1070 <cmd_clean@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rbx,%rdi
mov    $0x2a,%esi
call   1040 <strchr@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
test   %rax,%rax
je     1244 <do_command+0xc4>
call   10a0 <cmd_oscillate@plt>
jmp    1218 <do_command+0x98>
call   1030 <cmd_show_pin@plt>
jmp    1218 <do_command+0x98>

LLVM IR (-O0):
@.str = [6 x i8] c"print\00"
@.str.1 = [6 x i8] c"clean\00"
define i32 @do_command(i8* %0, i8** %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 0
%10 = load i8*, i8** %9
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 80
br i1 %14, label %15, label %55
15: ; preds = %3
%16 = load i8*, i8** %7
%17 = call i64 @strchr(i8* %16, i8 signext 60)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = load i8*, i8** %4
%21 = load i8*, i8** %7
%22 = call i32 @cmd_set_pin(i8* %20, i8* %21)
br label %54
23: ; preds = %15
%24 = load i8*, i8** %7
%25 = call i64 @strchr(i8* %24, i8 signext 61)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %23
%28 = load i8*, i8** %4
%29 = load i8*, i8** %7
%30 = call i32 @cmd_set_pin(i8* %28, i8* %29)
br label %53
31: ; preds = %23
%32 = load i8*, i8** %7
%33 = call i64 @strchr(i8* %32, i8 signext 63)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %31
%36 = load i8*, i8** %4
%37 = load i8*, i8** %7
%38 = call i32 @cmd_set_pin(i8* %36, i8* %37)
br label %52
39: ; preds = %31
%40 = load i8*, i8** %7
%41 = call i64 @strchr(i8* %40, i8 signext 42)
%42 = icmp ne i64 %41, 0
br i1 %42, label %43, label %47
43: ; preds = %39
%44 = load i8*, i8** %4
%45 = load i8*, i8** %7
%46 = call i32 @cmd_oscillate(i8* %44, i8* %45)
br label %51
47: ; preds = %39
%48 = load i8*, i8** %4
%49 = load i8*, i8** %7
%50 = call i32 @cmd_show_pin(i8* %48, i8* %49)
br label %51
51: ; preds = %47, %43
br label %52
52: ; preds = %51, %35
br label %53
53: ; preds = %52, %27
br label %54
54: ; preds = %53, %19
br label %73
55: ; preds = %3
%56 = load i8*, i8** %7
%57 = call i64 @strcmp(i8* %56, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %55
%60 = load i8*, i8** %4
%61 = call i32 @print(i8* %60)
br label %72
62: ; preds = %55
%63 = load i8*, i8** %7
%64 = call i64 @strcmp(i8* %63, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %62
%67 = load i8*, i8** %4
%68 = call i32 @cmd_clean(i8* %67)
br label %71
69: ; preds = %62
%70 = call i32 @usage(i32 1)
br label %71
71: ; preds = %69, %66
br label %72
72: ; preds = %71, %59
br label %73
73: ; preds = %72, %54
ret i32 1
}

LLVM IR (-O2):
@.str = [6 x i8] c"print\00"
@.str.1 = [6 x i8] c"clean\00"
define i32 @do_command(i8* %0, i8** nocapture %1, i32 %2) {
%4 = load i8*, i8** %1
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 80
br i1 %6, label %7, label %29
7: ; preds = %3
%8 = tail call i64 @strchr(i8* %4, i8 signext 60)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 @cmd_set_pin(i8* %0, i8* %4)
br label %41
12: ; preds = %7
%13 = tail call i64 @strchr(i8* %4, i8 signext 61)
%14 = icmp eq i64 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = tail call i32 @cmd_set_pin(i8* %0, i8* %4)
br label %41
17: ; preds = %12
%18 = tail call i64 @strchr(i8* %4, i8 signext 63)
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = tail call i32 @cmd_set_pin(i8* %0, i8* %4)
br label %41
22: ; preds = %17
%23 = tail call i64 @strchr(i8* %4, i8 signext 42)
%24 = icmp eq i64 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = tail call i32 @cmd_oscillate(i8* %0, i8* %4)
br label %41
27: ; preds = %22
%28 = tail call i32 @cmd_show_pin(i8* %0, i8* %4)
br label %41
29: ; preds = %3
%30 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = tail call i32 @print(i8* %0)
br label %41
34: ; preds = %29
%35 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = tail call i32 @cmd_clean(i8* %0)
br label %41
39: ; preds = %34
%40 = tail call i32 @usage(i32 1)
br label %41
41: ; preds = %32, %39, %37, %10, %20, %27, %25, %15
ret i32 1
}