#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*/ strcpy(char *, char *);
char *strtok(char *, char *);
int get_col_num(char in_line[]) {
  char line[102400];
  strcpy(line, in_line);
  long int count = 0;
  char *part;
  part = strtok(line, "\t");
  while (part != NULL) {
    count++;
    part = strtok(NULL, "\t");
  }
  return count;
}


x86 assembly (clang, -O0):
<get_col_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x19020,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x19010(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
movq   $0x0,-0x19018(%rbp)
lea    -0x19010(%rbp),%rdi
lea    0xea8(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x19020(%rbp)
cmpq   $0x0,-0x19020(%rbp)
je     11a0 <get_col_num+0x80>
mov    -0x19018(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x19018(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe71(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x19020(%rbp)
jmp    1164 <get_col_num+0x44>
mov    -0x19018(%rbp),%rax
add    $0x19020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_col_num>:
push   %r14
push   %rbx
sub    $0x19008,%rsp
mov    %rdi,%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xec1(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strtok@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     1172 <get_col_num+0x52>
lea    0xeab(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
xor    %edi,%edi
mov    %r14,%rsi
call   1040 <strtok@plt>
add    $0x1,%ebx
test   %rax,%rax
jne    1160 <get_col_num+0x40>
mov    %ebx,%eax
add    $0x19008,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\09\00"
define i32 @get_col_num(i8* %0) {
%2 = alloca i8*
%3 = alloca [102400 x i8]
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %2
%6 = getelementptr inbounds [102400 x i8], [102400 x i8]* %3, i64 0, i64 0
%7 = load i8*, i8** %2
%8 = call i32 @strcpy(i8* %6, i8* %7)
store i64 0, i64* %4
%9 = getelementptr inbounds [102400 x i8], [102400 x i8]* %3, i64 0, i64 0
%10 = call i8* @strtok(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %10, i8** %5
br label %11
11: ; preds = %14, %1
%12 = load i8*, i8** %5
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i64, i64* %4
%16 = add nsw i64 %15, 1
store i64 %16, i64* %4
%17 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %17, i8** %5
br label %11
18: ; preds = %11
%19 = load i64, i64* %4
%20 = trunc i64 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
@.str = [2 x i8] c"\09\00"
define i32 @get_col_num(i8* %0) {
%2 = alloca [102400 x i8]
%3 = getelementptr inbounds [102400 x i8], [102400 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* %0)
%5 = call i8* @strtok(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i8* %5, null
br i1 %6, label %14, label %7
7: ; preds = %1, %7
%8 = phi i64 [ %9, %7 ], [ 0, %1 ]
%9 = add nuw nsw i64 %8, 1
%10 = 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 %12, label %7
12: ; preds = %7
%13 = trunc i64 %9 to i32
br label %14
14: ; preds = %12, %1
%15 = phi i32 [ 0, %1 ], [ %13, %12 ]
ret i32 %15
}