#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 atoi(char *);
int strlen(char *);
int getLocation(char *String) {
  int i = 0, j = 0, tab = 0, Location = 0;
  char temp_loc[128];
  for (i = 0; i < strlen(String); i++) {
    if (String[i] == '\t')
      tab++;
    if (tab == 3 && String[i] != '\t')
      temp_loc[j++] = String[i];
    if (tab == 4) {
      temp_loc[j] = '\0';
      Location = atoi(temp_loc);
      break;
    }
  }
  return Location;
}


x86 assembly (clang, -O0):
<getLocation>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0xa4(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0xa4(%rbp),%eax
cmp    %ecx,%eax
jge    120d <getLocation+0xed>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x9,%eax
jne    1192 <getLocation+0x72>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jne    11d0 <getLocation+0xb0>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x9,%eax
je     11d0 <getLocation+0xb0>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x10(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x10(%rbp)
cltq
mov    %cl,-0xa0(%rbp,%rax,1)
cmpl   $0x4,-0x14(%rbp)
jne    11fa <getLocation+0xda>
movslq -0x10(%rbp),%rax
movb   $0x0,-0xa0(%rbp,%rax,1)
lea    -0xa0(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    120d <getLocation+0xed>
jmp    11ff <getLocation+0xdf>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1152 <getLocation+0x32>
mov    -0x18(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getLocation>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %eax,%eax
jle    118e <getLocation+0x6e>
xor    %ebx,%ebx
xor    %ebp,%ebp
xor    %r15d,%r15d
jmp    1168 <getLocation+0x48>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0x4,%ebp
je     1192 <getLocation+0x72>
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    118e <getLocation+0x6e>
mov    %ebp,%ecx
movzbl (%r14,%rbx,1),%eax
xor    %ebp,%ebp
cmp    $0x9,%al
sete   %bpl
add    %ecx,%ebp
cmp    $0x3,%ebp
jne    1150 <getLocation+0x30>
cmp    $0x9,%al
je     1155 <getLocation+0x35>
movslq %r15d,%rcx
add    $0x1,%r15d
mov    %al,(%rsp,%rcx,1)
jmp    1155 <getLocation+0x35>
xor    %eax,%eax
jmp    11a1 <getLocation+0x81>
movslq %r15d,%rax
movb   $0x0,(%rsp,%rax,1)
mov    %rsp,%rdi
call   1040 <atoi@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @getLocation(i8* %0) {
%2 = alloca [128 x i8]
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %30
6: ; preds = %1, %24
%7 = phi i64 [ %26, %24 ], [ 0, %1 ]
%8 = phi i32 [ %14, %24 ], [ 0, %1 ]
%9 = phi i32 [ %25, %24 ], [ 0, %1 ]
%10 = getelementptr inbounds i8, i8* %0, i64 %7
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 9
%13 = zext i1 %12 to i32
%14 = add nuw nsw i32 %8, %13
switch i32 %14, label %24 [
i32 3, label %15
i32 4, label %20
]
15: ; preds = %6
br i1 %12, label %24, label %16
16: ; preds = %15
%17 = add nsw i32 %9, 1
%18 = sext i32 %9 to i64
%19 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 %18
store i8 %11, i8* %19
br label %24
20: ; preds = %6
%21 = sext i32 %9 to i64
%22 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 %21
store i8 0, i8* %22
%23 = call i32 @atoi(i8* %3)
br label %30
24: ; preds = %6, %15, %16
%25 = phi i32 [ %9, %15 ], [ %17, %16 ], [ %9, %6 ]
%26 = add nuw nsw i64 %7, 1
%27 = tail call i32 @strlen(i8* %0)
%28 = sext i32 %27 to i64
%29 = icmp slt i64 %26, %28
br i1 %29, label %6, label %30
30: ; preds = %24, %1, %20
%31 = phi i32 [ %23, %20 ], [ 0, %1 ], [ 0, %24 ]
ret i32 %31
}