#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 */
scalar_t__ isalpha(char);
char *strdup(char *);
scalar_t__ strlen(char *);
void split(char **woerter, char *thestring) {
  char buff[100];
  int charorig, chartarget = 0, wort = 0;
  for (charorig = 0; charorig < strlen(thestring); charorig++) {
    if (isalpha(thestring[charorig])) {
      buff[chartarget] = thestring[charorig];
      chartarget++;
    } else {
      buff[chartarget] = '\0';
      woerter[wort] = strdup(buff);
      if (strlen(buff) > 0)
        wort++;
      chartarget = 0;
    }
  }
  woerter[wort + 1] = NULL;
}


x86 assembly (clang, -O0):
<split>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x88(%rbp)
movl   $0x0,-0x8c(%rbp)
movl   $0x0,-0x84(%rbp)
movslq -0x84(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x98(%rbp),%rax
cmp    %rcx,%rax
jge    1242 <split+0x112>
mov    -0x10(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%rax
je     11d6 <split+0xa6>
mov    -0x10(%rbp),%rax
movslq -0x84(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x88(%rbp),%rax
mov    %cl,-0x80(%rbp,%rax,1)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    1229 <split+0xf9>
movslq -0x88(%rbp),%rax
movb   $0x0,-0x80(%rbp,%rax,1)
lea    -0x80(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
lea    -0x80(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jle    121f <split+0xef>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
movl   $0x0,-0x88(%rbp)
jmp    122e <split+0xfe>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1161 <split+0x31>
mov    -0x8(%rbp),%rax
mov    -0x8c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movq   $0x0,(%rax,%rcx,8)
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<split>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%r13
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
test   %rax,%rax
jle    11bd <split+0x8d>
xor    %ebx,%ebx
mov    %rsp,%r15
xor    %r12d,%r12d
xor    %ebp,%ebp
jmp    119c <split+0x6c>
nopl   (%rax)
movslq %ebp,%rax
movb   $0x0,(%rsp,%rax,1)
mov    %r15,%rdi
call   1050 <strdup@plt>
movslq %r12d,%r12
mov    %rax,(%r14,%r12,8)
mov    %r15,%rdi
call   1030 <strlen@plt>
xor    %ecx,%ecx
test   %rax,%rax
setg   %cl
add    %ecx,%r12d
xor    %ebp,%ebp
add    $0x1,%rbx
mov    %r13,%rdi
call   1030 <strlen@plt>
cmp    %rbx,%rax
jle    11c0 <split+0x90>
movsbl 0x0(%r13,%rbx,1),%edi
call   1040 <isalpha@plt>
test   %rax,%rax
je     1160 <split+0x30>
movzbl 0x0(%r13,%rbx,1),%eax
movslq %ebp,%rbp
mov    %al,(%rsp,%rbp,1)
add    $0x1,%ebp
jmp    118b <split+0x5b>
xor    %r12d,%r12d
movslq %r12d,%rax
movq   $0x0,0x8(%r14,%rax,8)
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @split(i8** nocapture writeonly %0, i8* nocapture %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %36
7: ; preds = %2, %30
%8 = phi i64 [ %33, %30 ], [ 0, %2 ]
%9 = phi i32 [ %32, %30 ], [ 0, %2 ]
%10 = phi i32 [ %31, %30 ], [ 0, %2 ]
%11 = getelementptr inbounds i8, i8* %1, i64 %8
%12 = load i8, i8* %11
%13 = tail call i64 @isalpha(i8 signext %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %20, label %15
15: ; preds = %7
%16 = load i8, i8* %11
%17 = sext i32 %10 to i64
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %17
store i8 %16, i8* %18
%19 = add nsw i32 %10, 1
br label %30
20: ; preds = %7
%21 = sext i32 %10 to i64
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %21
store i8 0, i8* %22
%23 = call i8* @strdup(i8* %4)
%24 = sext i32 %9 to i64
%25 = getelementptr inbounds i8*, i8** %0, i64 %24
store i8* %23, i8** %25
%26 = call i64 @strlen(i8* %4)
%27 = icmp sgt i64 %26, 0
%28 = zext i1 %27 to i32
%29 = add nsw i32 %9, %28
br label %30
30: ; preds = %15, %20
%31 = phi i32 [ %19, %15 ], [ 0, %20 ]
%32 = phi i32 [ %9, %15 ], [ %29, %20 ]
%33 = add nuw nsw i64 %8, 1
%34 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%35 = icmp sgt i64 %34, %33
br i1 %35, label %7, label %36
36: ; preds = %30, %2
%37 = phi i32 [ 0, %2 ], [ %32, %30 ]
%38 = add nsw i32 %37, 1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %0, i64 %39
store i8* null, i8** %40
ret void
}