#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 *, ...);
int /*<<< orphan*/ tokenize(char *, int, int, int *, int *, int *, int *, int *,
                            int *);
int main(int argc, char **argv) {
  char *text = " Ez egy mondat.  ";
  printf("'%s'\n", text);
  int maxtoks = 1000;
  int tok_starts[maxtoks];
  int tok_ends[maxtoks];
  int ntoks = 0;
  int maxwhs = 1000;
  int wh_starts[maxwhs];
  int wh_ends[maxwhs];
  int nwhs = 0;
  tokenize(text, maxtoks, maxwhs, tok_starts, tok_ends, &ntoks, wh_starts,
           wh_ends, &nwhs);
  printf("Tokens:\n");
  int i;
  for (i = 0; i < ntoks; i++)
    printf("(%d, %d)\n", tok_starts[i], tok_ends[i]);
  printf("Whitespaces:\n");
  for (i = 0; i < nwhs; i++)
    printf("(%d, %d)\n", wh_starts[i], wh_ends[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec0(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movl   $0x3e8,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x78(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%r8
sub    %rdx,%r8
mov    %r8,-0x70(%rbp)
mov    %r8,%rsp
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x3e8,-0x40(%rbp)
mov    -0x40(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%r11
sub    %rdx,%r11
mov    %r11,-0x68(%rbp)
mov    %r11,%rsp
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%r10
sub    %rdx,%r10
mov    %r10,-0x60(%rbp)
mov    %r10,%rsp
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%edx
lea    -0x3c(%rbp),%r9
lea    -0x54(%rbp),%rax
sub    $0x20,%rsp
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1040 <tokenize@plt>
add    $0x20,%rsp
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1279 <main+0x159>
mov    -0x70(%rbp),%rax
mov    -0x78(%rbp),%rcx
movslq -0x58(%rbp),%rdx
mov    (%rcx,%rdx,4),%esi
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    123b <main+0x11b>
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    12cc <main+0x1ac>
mov    -0x60(%rbp),%rax
mov    -0x68(%rbp),%rcx
movslq -0x58(%rbp),%rdx
mov    (%rcx,%rdx,4),%esi
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xd6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    128e <main+0x16e>
movl   $0x0,-0x4(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3e98,%rsp
lea    0xed1(%rip),%rdi
lea    0xeb8(%rip),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
sub    $0x8,%rsp
lea    0x10(%rsp),%rax
lea    0x18(%rsp),%r10
lea    0xfb8(%rsp),%r11
lea    0x2ef8(%rsp),%rcx
lea    0x1f58(%rsp),%r8
lea    0x14(%rsp),%r9
mov    %rbx,%rdi
mov    $0x3e8,%esi
mov    $0x3e8,%edx
push   %rax
push   %r10
push   %r11
call   1050 <tokenize@plt>
add    $0x20,%rsp
lea    0xe73(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    11f6 <main+0xc6>
lea    0xe56(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x2ef0(%rsp,%rbx,4),%esi
mov    0x1f50(%rsp,%rbx,4),%edx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     11d0 <main+0xa0>
lea    0xe2d(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,0x8(%rsp)
jle    1243 <main+0x113>
lea    0xe08(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0xfb0(%rsp,%rbx,4),%esi
mov    0x10(%rsp,%rbx,4),%edx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
cmp    %rax,%rbx
jl     1220 <main+0xf0>
xor    %eax,%eax
add    $0x3e98,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c" Ez egy mondat. \00"
@.str.1 = [6 x i8] c"'%s'\0A\00"
@.str.2 = [9 x i8] c"Tokens:\0A\00"
@.str.3 = [10 x i8] c"(%d, %d)\0A\00"
@.str.4 = [14 x i8] c"Whitespaces:\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
%11 = alloca i32
%12 = alloca i32
%13 = alloca i64
%14 = alloca i64
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %6
%17 = load i8*, i8** %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %17)
store i32 1000, i32* %7
%19 = load i32, i32* %7
%20 = zext i32 %19 to i64
%21 = call i8* @llvm.stacksave()
store i8* %21, i8** %8
%22 = alloca i32, i64 %20
store i64 %20, i64* %9
%23 = load i32, i32* %7
%24 = zext i32 %23 to i64
%25 = alloca i32, i64 %24
store i64 %24, i64* %10
store i32 0, i32* %11
store i32 1000, i32* %12
%26 = load i32, i32* %12
%27 = zext i32 %26 to i64
%28 = alloca i32, i64 %27
store i64 %27, i64* %13
%29 = load i32, i32* %12
%30 = zext i32 %29 to i64
%31 = alloca i32, i64 %30
store i64 %30, i64* %14
store i32 0, i32* %15
%32 = load i8*, i8** %6
%33 = load i32, i32* %7
%34 = load i32, i32* %12
%35 = call i32 @tokenize(i8* %32, i32 %33, i32 %34, i32* %22, i32* %25, i32* %11, i32* %28, i32* %31, i32* %15)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %16
br label %37
37: ; preds = %51, %2
%38 = load i32, i32* %16
%39 = load i32, i32* %11
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %54
41: ; preds = %37
%42 = load i32, i32* %16
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i32, i32* %22, i64 %43
%45 = load i32, i32* %44
%46 = load i32, i32* %16
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %25, i64 %47
%49 = load i32, i32* %48
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %45, i32 %49)
br label %51
51: ; preds = %41
%52 = load i32, i32* %16
%53 = add nsw i32 %52, 1
store i32 %53, i32* %16
br label %37
54: ; preds = %37
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %16
br label %56
56: ; preds = %70, %54
%57 = load i32, i32* %16
%58 = load i32, i32* %15
%59 = icmp slt i32 %57, %58
br i1 %59, label %60, label %73
60: ; preds = %56
%61 = load i32, i32* %16
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i32, i32* %28, i64 %62
%64 = load i32, i32* %63
%65 = load i32, i32* %16
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i32, i32* %31, i64 %66
%68 = load i32, i32* %67
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %64, i32 %68)
br label %70
70: ; preds = %60
%71 = load i32, i32* %16
%72 = add nsw i32 %71, 1
store i32 %72, i32* %16
br label %56
73: ; preds = %56
store i32 0, i32* %3
%74 = load i8*, i8** %8
%75 = load i32, i32* %3
ret i32 %75
}

LLVM IR (-O2):
@.str = [18 x i8] c" Ez egy mondat. \00"
@.str.1 = [6 x i8] c"'%s'\0A\00"
@.str.3 = [10 x i8] c"(%d, %d)\0A\00"
@str = [8 x i8] c"Tokens:\00"
@str.5 = [13 x i8] c"Whitespaces:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = alloca [1000 x i32]
%7 = alloca [1000 x i32]
%8 = getelementptr inbounds [1000 x i32], [1000 x i32]* %7, i64 0, i64 0
%9 = getelementptr inbounds [1000 x i32], [1000 x i32]* %6, i64 0, i64 0
%10 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%11 = alloca [1000 x i32]
%12 = alloca [1000 x i32]
%13 = getelementptr inbounds [1000 x i32], [1000 x i32]* %12, i64 0, i64 0
%14 = getelementptr inbounds [1000 x i32], [1000 x i32]* %11, i64 0, i64 0
%15 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%16 = call i32 @tokenize(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 1000, i32 1000, i32* %9, i32* %8, i32* %3, i32* %14, i32* %13, i32* %4)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%18 = load i32, i32* %3
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %31
20: ; preds = %2, %20
%21 = phi i64 [ %27, %20 ], [ 0, %2 ]
%22 = getelementptr inbounds [1000 x i32], [1000 x i32]* %6, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = getelementptr inbounds [1000 x i32], [1000 x i32]* %7, i64 0, i64 %21
%25 = load i32, i32* %24
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %23, i32 %25)
%27 = add nuw nsw i64 %21, 1
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = icmp slt i64 %27, %29
br i1 %30, label %20, label %31
31: ; preds = %20, %2
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.5, i64 0, i64 0))
%33 = load i32, i32* %4
%34 = icmp sgt i32 %33, 0
br i1 %34, label %35, label %46
35: ; preds = %31, %35
%36 = phi i64 [ %42, %35 ], [ 0, %31 ]
%37 = getelementptr inbounds [1000 x i32], [1000 x i32]* %11, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = getelementptr inbounds [1000 x i32], [1000 x i32]* %12, i64 0, i64 %36
%40 = load i32, i32* %39
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %38, i32 %40)
%42 = add nuw nsw i64 %36, 1
%43 = load i32, i32* %4
%44 = sext i32 %43 to i64
%45 = icmp slt i64 %42, %44
br i1 %45, label %35, label %46
46: ; preds = %35, %31
ret i32 0
}