#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 */
typedef int /*<<< orphan*/ uint32_t;
struct r4k_dis_t {
  int dummy;
};

/* Variables and functions */
int r4k_disassemble(struct r4k_dis_t *, int /*<<< orphan*/, int /*<<< orphan*/,
                    char *);
char *strdup(char *);
int r4k_disassemble_split(struct r4k_dis_t *state, uint32_t instruction,
                          uint32_t location, char **opcode, char **operands) {
  int v, i;
  char buff[128], *dupd;
  v = r4k_disassemble(state, instruction, location, buff);
  dupd = strdup(buff);
  *opcode = &dupd[0];
  for (i = 0; buff[i] && buff[i] != ' ' && buff[i] != '\t'; i++)
    ;
  dupd[i] = '\0';
  for (; buff[i] && (buff[i] == ' ' || buff[i] == '\t'); i++)
    ;
  *operands = &dupd[i];
  return v;
}


x86 assembly (clang, -O0):
<r4k_disassemble_split>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    -0xb0(%rbp),%rcx
call   1030 <r4k_disassemble@plt>
mov    %eax,-0x24(%rbp)
lea    -0xb0(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0xb8(%rbp)
mov    -0xb8(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x28(%rbp)
movslq -0x28(%rbp),%rax
movsbl -0xb0(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xb9(%rbp)
je     11d0 <r4k_disassemble_split+0xb0>
movslq -0x28(%rbp),%rax
movsbl -0xb0(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0xb9(%rbp)
je     11d0 <r4k_disassemble_split+0xb0>
movslq -0x28(%rbp),%rax
movsbl -0xb0(%rbp,%rax,1),%eax
ff
cmp    $0x9,%eax
setne  %al
mov    %al,-0xb9(%rbp)
mov    -0xb9(%rbp),%al
test   $0x1,%al
jne    11e3 <r4k_disassemble_split+0xc3>
jmp    11f6 <r4k_disassemble_split+0xd6>
jmp    11e8 <r4k_disassemble_split+0xc8>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    117e <r4k_disassemble_split+0x5e>
mov    -0xb8(%rbp),%rax
movslq -0x28(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movslq -0x28(%rbp),%rax
movsbl -0xb0(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xba(%rbp)
je     1263 <r4k_disassemble_split+0x143>
movslq -0x28(%rbp),%rax
movsbl -0xb0(%rbp,%rax,1),%ecx
ff
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0xbb(%rbp)
je     1257 <r4k_disassemble_split+0x137>
movslq -0x28(%rbp),%rax
movsbl -0xb0(%rbp,%rax,1),%eax
ff
cmp    $0x9,%eax
sete   %al
mov    %al,-0xbb(%rbp)
mov    -0xbb(%rbp),%al
mov    %al,-0xba(%rbp)
mov    -0xba(%rbp),%al
test   $0x1,%al
jne    1276 <r4k_disassemble_split+0x156>
jmp    1289 <r4k_disassemble_split+0x169>
jmp    127b <r4k_disassemble_split+0x15b>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1205 <r4k_disassemble_split+0xe5>
mov    -0xb8(%rbp),%rcx
movslq -0x28(%rbp),%rax
add    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x24(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<r4k_disassemble_split>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %r8,%r14
mov    %rcx,%rbx
mov    %rsp,%rbp
mov    %rbp,%rcx
call   1030 <r4k_disassemble@plt>
mov    %eax,%r15d
mov    %rbp,%rdi
call   1040 <strdup@plt>
mov    %rax,(%rbx)
xor    %ecx,%ecx
movabs $0x100000201,%rdx
jmp    1164 <r4k_disassemble_split+0x44>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rcx
movzbl (%rsp,%rcx,1),%esi
cmp    $0x20,%rsi
ja     1160 <r4k_disassemble_split+0x40>
bt     %rsi,%rdx
jae    1160 <r4k_disassemble_split+0x40>
mov    %ecx,%ecx
movb   $0x0,(%rax,%rcx,1)
jmp    1184 <r4k_disassemble_split+0x64>
nopl   0x0(%rax)
add    $0x1,%rcx
movzbl (%rsp,%rcx,1),%edx
cmp    $0x20,%dl
je     1180 <r4k_disassemble_split+0x60>
cmp    $0x9,%dl
je     1180 <r4k_disassemble_split+0x60>
mov    %ecx,%ecx
add    %rcx,%rax
mov    %rax,(%r14)
mov    %r15d,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.r4k_dis_t = type { i32 }
define i32 @r4k_disassemble_split(%struct.r4k_dis_t* %0, i32 %1, i32 %2, i8** %3, i8** %4) {
%6 = alloca %struct.r4k_dis_t*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8**
%10 = alloca i8**
%11 = alloca i32
%12 = alloca i32
%13 = alloca [128 x i8]
%14 = alloca i8*
store %struct.r4k_dis_t* %0, %struct.r4k_dis_t** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8** %3, i8*** %9
store i8** %4, i8*** %10
%15 = load %struct.r4k_dis_t*, %struct.r4k_dis_t** %6
%16 = load i32, i32* %7
%17 = load i32, i32* %8
%18 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%19 = call i32 @r4k_disassemble(%struct.r4k_dis_t* %15, i32 %16, i32 %17, i8* %18)
store i32 %19, i32* %11
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%21 = call i8* @strdup(i8* %20)
store i8* %21, i8** %14
%22 = load i8*, i8** %14
%23 = getelementptr inbounds i8, i8* %22, i64 0
%24 = load i8**, i8*** %9
store i8* %23, i8** %24
store i32 0, i32* %12
br label %25
25: ; preds = %49, %5
%26 = load i32, i32* %12
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %46
32: ; preds = %25
%33 = load i32, i32* %12
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp ne i32 %37, 32
br i1 %38, label %39, label %46
39: ; preds = %32
%40 = load i32, i32* %12
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp ne i32 %44, 9
br label %46
46: ; preds = %39, %32, %25
%47 = phi i1 [ false, %32 ], [ false, %25 ], [ %45, %39 ]
br i1 %47, label %48, label %52
48: ; preds = %46
br label %49
49: ; preds = %48
%50 = load i32, i32* %12
%51 = add nsw i32 %50, 1
store i32 %51, i32* %12
br label %25
52: ; preds = %46
%53 = load i8*, i8** %14
%54 = load i32, i32* %12
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8, i8* %53, i64 %55
store i8 0, i8* %56
br label %57
57: ; preds = %83, %52
%58 = load i32, i32* %12
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 %59
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %80
64: ; preds = %57
%65 = load i32, i32* %12
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 %66
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = icmp eq i32 %69, 32
br i1 %70, label %78, label %71
71: ; preds = %64
%72 = load i32, i32* %12
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 %73
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = icmp eq i32 %76, 9
br label %78
78: ; preds = %71, %64
%79 = phi i1 [ true, %64 ], [ %77, %71 ]
br label %80
80: ; preds = %78, %57
%81 = phi i1 [ false, %57 ], [ %79, %78 ]
br i1 %81, label %82, label %86
82: ; preds = %80
br label %83
83: ; preds = %82
%84 = load i32, i32* %12
%85 = add nsw i32 %84, 1
store i32 %85, i32* %12
br label %57
86: ; preds = %80
%87 = load i8*, i8** %14
%88 = load i32, i32* %12
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds i8, i8* %87, i64 %89
%91 = load i8**, i8*** %10
store i8* %90, i8** %91
%92 = load i32, i32* %11
ret i32 %92
}

LLVM IR (-O2):
%struct.r4k_dis_t = type { i32 }
define i32 @r4k_disassemble_split(%struct.r4k_dis_t* %0, i32 %1, i32 %2, i8** nocapture writeonly %3, i8** nocapture writeonly %4) {
%6 = alloca [128 x i8]
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%8 = call i32 @r4k_disassemble(%struct.r4k_dis_t* %0, i32 %1, i32 %2, i8* %7)
%9 = call i8* @strdup(i8* %7)
store i8* %9, i8** %3
br label %10
10: ; preds = %14, %5
%11 = phi i64 [ %15, %14 ], [ 0, %5 ]
%12 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 %11
%13 = load i8, i8* %12
switch i8 %13, label %14 [
i8 0, label %16
i8 32, label %16
i8 9, label %16
]
14: ; preds = %10
%15 = add nuw i64 %11, 1
br label %10
16: ; preds = %10, %10, %10
%17 = and i64 %11, 4294967295
%18 = getelementptr inbounds i8, i8* %9, i64 %17
store i8 0, i8* %18
br label %19
19: ; preds = %23, %16
%20 = phi i64 [ %24, %23 ], [ %17, %16 ]
%21 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 %20
%22 = load i8, i8* %21
switch i8 %22, label %25 [
i8 9, label %23
i8 32, label %23
]
23: ; preds = %19, %19
%24 = add nuw i64 %20, 1
br label %19
25: ; preds = %19
%26 = and i64 %20, 4294967295
%27 = getelementptr inbounds i8, i8* %9, i64 %26
store i8* %27, i8** %4
ret i32 %8
}