#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 */
typedef int uint32_t;

/* Variables and functions */
int countCandidates(char *cadena, uint32_t *numberOfCandidates,
                    uint32_t *querySize) {
  int localNumCandidates = 0, i = 0, flagQueryMesured = 0;
  while (cadena[i] != '\n') {
    if (cadena[i] == '\t') {
      if (flagQueryMesured == 0) {
        (*querySize) = i;
        flagQueryMesured = 1;
      }
      localNumCandidates++;
    }
    i++;
  }
  (*numberOfCandidates) = localNumCandidates;
  return (0);
}


x86 assembly (clang, -O0):
<countCandidates>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
je     1180 <countCandidates+0x80>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x9,%eax
jne    1172 <countCandidates+0x72>
cmpl   $0x0,-0x24(%rbp)
jne    1169 <countCandidates+0x69>
mov    -0x20(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1125 <countCandidates+0x25>
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<countCandidates>:
xor    %eax,%eax
xor    %r8d,%r8d
xor    %r9d,%r9d
jmp    1119 <countCandidates+0x19>
nopw   0x0(%rax,%rax,1)
cmp    $0xa,%cl
je     1135 <countCandidates+0x35>
add    $0x1,%rax
movzbl (%rdi,%rax,1),%ecx
cmp    $0x9,%cl
jne    1110 <countCandidates+0x10>
test   %r9d,%r9d
jne    1129 <countCandidates+0x29>
mov    %eax,(%rdx)
add    $0x1,%r8d
mov    $0x1,%r9d
jmp    1115 <countCandidates+0x15>
mov    %r8d,(%rsi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @countCandidates(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
br label %10
10: ; preds = %35, %3
%11 = load i8*, i8** %4
%12 = load i32, i32* %8
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 10
br i1 %17, label %18, label %38
18: ; preds = %10
%19 = load i8*, i8** %4
%20 = load i32, i32* %8
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 9
br i1 %25, label %26, label %35
26: ; preds = %18
%27 = load i32, i32* %9
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i32, i32* %8
%31 = load i32*, i32** %6
store i32 %30, i32* %31
store i32 1, i32* %9
br label %32
32: ; preds = %29, %26
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
br label %35
35: ; preds = %32, %18
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 1
store i32 %37, i32* %8
br label %10
38: ; preds = %10
%39 = load i32, i32* %7
%40 = load i32*, i32** %5
store i32 %39, i32* %40
ret i32 0
}

LLVM IR (-O2):
define i32 @countCandidates(i8* nocapture %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
br label %4
4: ; preds = %16, %3
%5 = phi i64 [ %19, %16 ], [ 0, %3 ]
%6 = phi i32 [ %17, %16 ], [ 0, %3 ]
%7 = phi i32 [ %18, %16 ], [ 0, %3 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %5
%9 = load i8, i8* %8
switch i8 %9, label %16 [
i8 10, label %20
i8 9, label %10
]
10: ; preds = %4
%11 = icmp eq i32 %7, 0
br i1 %11, label %12, label %14
12: ; preds = %10
%13 = trunc i64 %5 to i32
store i32 %13, i32* %2
br label %14
14: ; preds = %12, %10
%15 = add nsw i32 %6, 1
br label %16
16: ; preds = %4, %14
%17 = phi i32 [ %15, %14 ], [ %6, %4 ]
%18 = phi i32 [ 1, %14 ], [ %7, %4 ]
%19 = add nuw i64 %5, 1
br label %4
20: ; preds = %4
store i32 %6, i32* %1
ret i32 0
}