#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*/ createExtension(char *, char *);
int /*<<< orphan*/ isspace(char);
int strlen(char *);
void parseExtensions(char *contentType, char *extensions) {
  int t = strlen(extensions);
  int i = 0;
  char *ptr = extensions;
  for (i = 0; i < t; i++) {
    int k = 0;
    for (k = 0; !isspace(ptr[0]) && k < t; k++) {
      ptr++;
    }
    extensions[k] = '\0';
    if (k >= t) {
      break;
    }
    ptr++;
    createExtension(contentType, extensions);
    extensions = ptr;
  }
}


x86 assembly (clang, -O0):
<parseExtensions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    121a <parseExtensions+0xea>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x25(%rbp)
jne    11a4 <parseExtensions+0x74>
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
setl   %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    11b4 <parseExtensions+0x84>
jmp    11ce <parseExtensions+0x9e>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    117c <parseExtensions+0x4c>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     11eb <parseExtensions+0xbb>
jmp    121a <parseExtensions+0xea>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <createExtension@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1162 <parseExtensions+0x32>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseExtensions>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    11c3 <parseExtensions+0x93>
mov    %eax,%r13d
xor    %r12d,%r12d
jmp    1182 <parseExtensions+0x52>
cs nopw 0x0(%rax,%rax,1)
nop
movb   $0x0,(%r15)
mov    %r15,%rbx
add    $0x1,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <createExtension@plt>
add    $0x1,%r12d
mov    %rbx,%r15
cmp    %r13d,%r12d
je     11c3 <parseExtensions+0x93>
movsbl (%r15),%edi
call   1040 <isspace@plt>
test   %eax,%eax
jne    1160 <parseExtensions+0x30>
mov    $0x1,%eax
mov    %r15,%rbx
nopw   0x0(%rax,%rax,1)
mov    %eax,%ebp
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1040 <isspace@plt>
test   %eax,%eax
jne    11bb <parseExtensions+0x8b>
lea    0x1(%rbp),%eax
cmp    %r13d,%ebp
jl     11a0 <parseExtensions+0x70>
movb   $0x0,(%rbx)
cmp    %r13d,%ebp
jl     1167 <parseExtensions+0x37>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @parseExtensions(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %31
5: ; preds = %2, %25
%6 = phi i32 [ %29, %25 ], [ 0, %2 ]
%7 = phi i8* [ %27, %25 ], [ %1, %2 ]
%8 = load i8, i8* %7
%9 = tail call i32 @isspace(i8 signext %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %5
store i8 0, i8* %7
br label %25
12: ; preds = %5, %12
%13 = phi i32 [ %16, %12 ], [ 0, %5 ]
%14 = phi i8* [ %15, %12 ], [ %7, %5 ]
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = add nuw nsw i32 %13, 1
%17 = load i8, i8* %15
%18 = tail call i32 @isspace(i8 signext %17)
%19 = icmp eq i32 %18, 0
%20 = icmp slt i32 %16, %3
%21 = select i1 %19, i1 %20, i1 false
br i1 %21, label %12, label %22
22: ; preds = %12
%23 = zext i32 %16 to i64
%24 = getelementptr inbounds i8, i8* %7, i64 %23
store i8 0, i8* %24
br i1 %20, label %25, label %31
25: ; preds = %11, %22
%26 = phi i8* [ %7, %11 ], [ %15, %22 ]
%27 = getelementptr inbounds i8, i8* %26, i64 1
%28 = tail call i32 @createExtension(i8* %0, i8* %7)
%29 = add nuw nsw i32 %6, 1
%30 = icmp eq i32 %29, %3
br i1 %30, label %31, label %5
31: ; preds = %25, %22, %2
ret void
}