#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*/ net_console_execute(char *);
int strlen(char *);
void exec_stufftext(char *stuff_cmd) {
  char *cur_char = stuff_cmd;
  int cmd_begin_ptr = 0;
  while (cur_char - stuff_cmd < strlen(stuff_cmd)) {
    for (; *cur_char && (*cur_char != '\n' && *cur_char != ';'); cur_char++)
      ;
    *(cur_char) = '\0';
    net_console_execute(stuff_cmd + cmd_begin_ptr);
    cmd_begin_ptr = (cur_char - stuff_cmd) + 1;
    cur_char++;
  }
}


x86 assembly (clang, -O0):
<exec_stufftext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
cmp    %rcx,%rax
jge    120a <exec_stufftext+0xea>
jmp    116a <exec_stufftext+0x4a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x21(%rbp)
je     11aa <exec_stufftext+0x8a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x22(%rbp)
je     11a4 <exec_stufftext+0x84>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3b,%eax
setne  %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    11ba <exec_stufftext+0x9a>
jmp    11d0 <exec_stufftext+0xb0>
jmp    11bf <exec_stufftext+0x9f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    116a <exec_stufftext+0x4a>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
call   1030 <net_console_execute@plt>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    113b <exec_stufftext+0x1b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exec_stufftext>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r15
call   1040 <strlen@plt>
test   %eax,%eax
jle    119a <exec_stufftext+0x7a>
mov    $0x1,%r14d
sub    %r15,%r14
xor    %eax,%eax
movabs $0x800000000000401,%r12
mov    %r15,%rbx
nopl   (%rax)
lea    (%r14,%rbx,1),%r13
jmp    1164 <exec_stufftext+0x44>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r13
add    $0x1,%rbx
movzbl -0x1(%rbx),%ecx
cmp    $0x3b,%rcx
ja     1160 <exec_stufftext+0x40>
bt     %rcx,%r12
jae    1160 <exec_stufftext+0x40>
movb   $0x0,-0x1(%rbx)
movslq %eax,%rdi
add    %r15,%rdi
call   1030 <net_console_execute@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
movslq %eax,%rcx
mov    %r13,%rax
cmp    %rcx,%r13
jl     1150 <exec_stufftext+0x30>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @exec_stufftext(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %3
store i32 0, i32* %4
br label %6
6: ; preds = %40, %1
%7 = load i8*, i8** %3
%8 = load i8*, i8** %2
%9 = ptrtoint i8* %7 to i64
%10 = ptrtoint i8* %8 to i64
%11 = sub i64 %9, %10
%12 = load i8*, i8** %2
%13 = call i32 @strlen(i8* %12)
%14 = sext i32 %13 to i64
%15 = icmp slt i64 %11, %14
br i1 %15, label %16, label %56
16: ; preds = %6
br label %17
17: ; preds = %37, %16
%18 = load i8*, i8** %3
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %34
22: ; preds = %17
%23 = load i8*, i8** %3
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp ne i32 %25, 10
br i1 %26, label %27, label %32
27: ; preds = %22
%28 = load i8*, i8** %3
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp ne i32 %30, 59
br label %32
32: ; preds = %27, %22
%33 = phi i1 [ false, %22 ], [ %31, %27 ]
br label %34
34: ; preds = %32, %17
%35 = phi i1 [ false, %17 ], [ %33, %32 ]
br i1 %35, label %36, label %40
36: ; preds = %34
br label %37
37: ; preds = %36
%38 = load i8*, i8** %3
%39 = getelementptr inbounds i8, i8* %38, i32 1
store i8* %39, i8** %3
br label %17
40: ; preds = %34
%41 = load i8*, i8** %3
store i8 0, i8* %41
%42 = load i8*, i8** %2
%43 = load i32, i32* %4
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
%46 = call i32 @net_console_execute(i8* %45)
%47 = load i8*, i8** %3
%48 = load i8*, i8** %2
%49 = ptrtoint i8* %47 to i64
%50 = ptrtoint i8* %48 to i64
%51 = sub i64 %49, %50
%52 = add nsw i64 %51, 1
%53 = trunc i64 %52 to i32
store i32 %53, i32* %4
%54 = load i8*, i8** %3
%55 = getelementptr inbounds i8, i8* %54, i32 1
store i8* %55, i8** %3
br label %6
56: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @exec_stufftext(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = tail call i32 @strlen(i8* %0)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %28
5: ; preds = %1
%6 = sub i64 1, %2
br label %7
7: ; preds = %5, %15
%8 = phi i64 [ 0, %5 ], [ %21, %15 ]
%9 = phi i8* [ %0, %5 ], [ %22, %15 ]
br label %10
10: ; preds = %7, %13
%11 = phi i8* [ %14, %13 ], [ %9, %7 ]
%12 = load i8, i8* %11
switch i8 %12, label %13 [
i8 0, label %15
i8 10, label %15
i8 59, label %15
]
13: ; preds = %10
%14 = getelementptr inbounds i8, i8* %11, i64 1
br label %10
15: ; preds = %10, %10, %10
store i8 0, i8* %11
%16 = shl i64 %8, 32
%17 = ashr exact i64 %16, 32
%18 = getelementptr inbounds i8, i8* %0, i64 %17
%19 = tail call i32 @net_console_execute(i8* %18)
%20 = ptrtoint i8* %11 to i64
%21 = add i64 %6, %20
%22 = getelementptr inbounds i8, i8* %11, i64 1
%23 = ptrtoint i8* %22 to i64
%24 = sub i64 %23, %2
%25 = tail call i32 @strlen(i8* %0)
%26 = sext i32 %25 to i64
%27 = icmp slt i64 %24, %26
br i1 %27, label %7, label %28
28: ; preds = %15, %1
ret void
}