#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*/ _response(char const *);
int strlen(char const *);
int do_mode(const char *arg) {
  const char succ[] = "200 MODE S OK.\r\n";
  const char fail[] = "504 Command not implemented for that parameter.\r\n";
  if ((strlen(arg) == 1) && ((*arg == 's') || (*arg == 'S'))) {
    _response(succ);
    return 0;
  } else {
    _response(fail);
    return 1;
  }
}


x86 assembly (clang, -O0):
<do_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    0xebd(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xeb8(%rip),%al
mov    %al,-0x20(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xeba(%rip),%rsi
mov    $0x32,%edx
call   1050 <memcpy@plt>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x1,%eax
jne    11b7 <do_mode+0x87>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x73,%eax
je     11a2 <do_mode+0x72>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x53,%eax
jne    11b7 <do_mode+0x87>
lea    -0x30(%rbp),%rdi
call   1040 <_response@plt>
movl   $0x0,-0x4(%rbp)
jmp    11c7 <do_mode+0x97>
lea    -0x70(%rbp),%rdi
call   1040 <_response@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_mode>:
push   %rbx
sub    $0x60,%rsp
mov    %rdi,%rbx
movaps 0xed1(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
movaps 0xf01(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movw   $0xa,0x50(%rsp)
call   1030 <strlen@plt>
cmp    $0x1,%eax
jne    117c <do_mode+0x5c>
mov    (%rbx),%al
or     $0x20,%al
cmp    $0x73,%al
jne    117c <do_mode+0x5c>
mov    %rsp,%rdi
xor    %ebx,%ebx
jmp    1186 <do_mode+0x66>
mov    $0x1,%ebx
lea    0x20(%rsp),%rdi
call   1040 <_response@plt>
mov    %ebx,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.do_mode.succ = [17 x i8] c"200 MODE S OK.\0D\0A\00"
@__const.do_mode.fail = [50 x i8] c"504 Command not implemented for that parameter.\0D\0A\00"
define i32 @do_mode(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [17 x i8]
%5 = alloca [50 x i8]
store i8* %0, i8** %3
%6 = bitcast [17 x i8]* %4 to i8*
%7 = bitcast [50 x i8]* %5 to i8*
%8 = load i8*, i8** %3
%9 = call i32 @strlen(i8* %8)
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %24
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 115
br i1 %15, label %21, label %16
16: ; preds = %11
%17 = load i8*, i8** %3
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 83
br i1 %20, label %21, label %24
21: ; preds = %16, %11
%22 = getelementptr inbounds [17 x i8], [17 x i8]* %4, i64 0, i64 0
%23 = call i32 @_response(i8* %22)
store i32 0, i32* %2
br label %27
24: ; preds = %16, %1
%25 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%26 = call i32 @_response(i8* %25)
store i32 1, i32* %2
br label %27
27: ; preds = %24, %21
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
@__const.do_mode.succ = [17 x i8] c"200 MODE S OK.\0D\0A\00"
@__const.do_mode.fail = [50 x i8] c"504 Command not implemented for that parameter.\0D\0A\00"
define i32 @do_mode(i8* %0) {
%2 = alloca [17 x i8]
%3 = alloca [50 x i8]
%4 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%6 = tail call i32 @strlen(i8* %0)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i8, i8* %0
switch i8 %9, label %10 [
i8 115, label %11
i8 83, label %11
]
10: ; preds = %8, %1
br label %11
11: ; preds = %8, %8, %10
%12 = phi i8* [ %5, %10 ], [ %4, %8 ], [ %4, %8 ]
%13 = phi i32 [ 1, %10 ], [ 0, %8 ], [ 0, %8 ]
%14 = call i32 @_response(i8* %12)
ret i32 %13
}