#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*/ printf(char *, char *);
char *strtok(char *, char *);
void dis_issbuf(char *buf) {
  char *s = buf;
  int i = 0;
  s = strtok(s, ":");
  while (s != NULL) {
    switch (i) {
    case 0:
      printf("multi level security type: %s\n", s);
      break;
    case 1:
      printf("                    value: %s\n", s);
      break;
    case 2:
      printf("                 category: %s\n", s);
      break;
    case 3:
      printf("multi level integrity type: %s\n", s);
      break;
    default:
      break;
    }
    s = strtok(NULL, ":");
    i++;
  }
}


x86 assembly (clang, -O0):
<dis_issbuf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeca(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11fa <dis_issbuf+0xda>
mov    -0x14(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0x3,%rax
ja     11d3 <dis_issbuf+0xb3>
mov    -0x20(%rbp),%rax
lea    0xe8a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rsi
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
jmp    11d8 <dis_issbuf+0xb8>
mov    -0x10(%rbp),%rsi
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
jmp    11d8 <dis_issbuf+0xb8>
mov    -0x10(%rbp),%rsi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
jmp    11d8 <dis_issbuf+0xb8>
mov    -0x10(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
jmp    11d8 <dis_issbuf+0xb8>
jmp    11d8 <dis_issbuf+0xb8>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe2d(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114f <dis_issbuf+0x2f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dis_issbuf>:
push   %rbx
lea    0xed8(%rip),%rsi
call   1040 <strtok@plt>
test   %rax,%rax
je     11df <dis_issbuf+0xbf>
lea    0xec5(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
lea    0xeb4(%rip),%rsi
xor    %edi,%edi
call   1040 <strtok@plt>
test   %rax,%rax
je     11df <dis_issbuf+0xbf>
lea    0xebe(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
lea    0xe8e(%rip),%rsi
xor    %edi,%edi
call   1040 <strtok@plt>
test   %rax,%rax
je     11df <dis_issbuf+0xbf>
lea    0xebb(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
lea    0xe6c(%rip),%rsi
xor    %edi,%edi
call   1040 <strtok@plt>
test   %rax,%rax
je     11df <dis_issbuf+0xbf>
lea    0xeb8(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
lea    0xe4a(%rip),%rsi
xor    %edi,%edi
call   1040 <strtok@plt>
test   %rax,%rax
je     11df <dis_issbuf+0xbf>
lea    0xe37(%rip),%rbx
nopl   0x0(%rax)
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <strtok@plt>
test   %rax,%rax
jne    11d0 <dis_issbuf+0xb0>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c":\00"
@.str.1 = [31 x i8] c"multi level security type: %s\0A\00"
@.str.2 = [31 x i8] c" value: %s\0A\00"
@.str.3 = [31 x i8] c" category: %s\0A\00"
@.str.4 = [32 x i8] c"multi level integrity type: %s\0A\00"
define void @dis_issbuf(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
%6 = load i8*, i8** %3
%7 = call i8* @strtok(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %3
br label %8
8: ; preds = %26, %1
%9 = load i8*, i8** %3
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %30
11: ; preds = %8
%12 = load i32, i32* %4
switch i32 %12, label %25 [
i32 0, label %13
i32 1, label %16
i32 2, label %19
i32 3, label %22
]
13: ; preds = %11
%14 = load i8*, i8** %3
%15 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %14)
br label %26
16: ; preds = %11
%17 = load i8*, i8** %3
%18 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %17)
br label %26
19: ; preds = %11
%20 = load i8*, i8** %3
%21 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %20)
br label %26
22: ; preds = %11
%23 = load i8*, i8** %3
%24 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %23)
br label %26
25: ; preds = %11
br label %26
26: ; preds = %25, %22, %19, %16, %13
%27 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %27, i8** %3
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %8
30: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c":\00"
@.str.1 = [31 x i8] c"multi level security type: %s\0A\00"
@.str.2 = [31 x i8] c" value: %s\0A\00"
@.str.3 = [31 x i8] c" category: %s\0A\00"
@.str.4 = [32 x i8] c"multi level integrity type: %s\0A\00"
define void @dis_issbuf(i8* %0) {
%2 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %23, label %4
4: ; preds = %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i8* %6, null
br i1 %7, label %23, label %8
8: ; preds = %4
%9 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%10 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i8* %10, null
br i1 %11, label %23, label %12
12: ; preds = %8
%13 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %10)
%14 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i8* %14, null
br i1 %15, label %23, label %16
16: ; preds = %12
%17 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %14)
%18 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i8* %18, null
br i1 %19, label %23, label %20
20: ; preds = %16, %20
%21 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %20
23: ; preds = %4, %8, %12, %16, %20, %1
ret void
}