#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int next_param(char *buf, unsigned int start) {
  while (buf[start]) {
    if (buf[start] != ' ' && buf[start] != '\t') {
      return start;
    }
    start++;
  }
  printf("Can't parse %s", buf);
  assert(0);
  return -1;
}


x86 assembly (clang, -O0):
<next_param>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
cmpb   $0x0,(%rax,%rcx,1)
je     1181 <next_param+0x61>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
je     1173 <next_param+0x53>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x9,%eax
je     1173 <next_param+0x53>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    119f <next_param+0x7f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112f <next_param+0xf>
mov    -0x10(%rbp),%rsi
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <assert@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_param>:
push   %rax
mov    %esi,%eax
mov    %rdi,%rsi
jmp    1133 <next_param+0x13>
nopl   0x0(%rax,%rax,1)
add    $0x1,%eax
mov    %eax,%ecx
movzbl (%rsi,%rcx,1),%ecx
cmp    $0x9,%cl
je     1130 <next_param+0x10>
cmp    $0x20,%cl
je     1130 <next_param+0x10>
test   %cl,%cl
jne    115f <next_param+0x3f>
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <assert@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Can't parse %s\00"
define i32 @next_param(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
br label %6
6: ; preds = %31, %2
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 0
br i1 %12, label %13, label %34
13: ; preds = %6
%14 = load i8*, i8** %4
%15 = load i32, i32* %5
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 32
br i1 %20, label %21, label %31
21: ; preds = %13
%22 = load i8*, i8** %4
%23 = load i32, i32* %5
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 9
br i1 %28, label %29, label %31
29: ; preds = %21
%30 = load i32, i32* %5
store i32 %30, i32* %3
br label %38
31: ; preds = %21, %13
%32 = load i32, i32* %5
%33 = add i32 %32, 1
store i32 %33, i32* %5
br label %6
34: ; preds = %6
%35 = load i8*, i8** %4
%36 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %35)
%37 = call i32 @assert(i32 0)
store i32 -1, i32* %3
br label %38
38: ; preds = %34, %29
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
@.str = [15 x i8] c"Can't parse %s\00"
define i32 @next_param(i8* %0, i32 %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i32 [ %1, %2 ], [ %9, %8 ]
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
switch i8 %7, label %13 [
i8 0, label %10
i8 32, label %8
i8 9, label %8
]
8: ; preds = %3, %3
%9 = add i32 %4, 1
br label %3
10: ; preds = %3
%11 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0)
%12 = tail call i32 @assert(i32 0)
br label %13
13: ; preds = %3, %10
%14 = phi i32 [ -1, %10 ], [ %4, %3 ]
ret i32 %14
}