#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 */
char *malloc(int);
char *getIdentifierFromLine(char *line) {
  char *ident = malloc(sizeof(char) * 30);
  int i = 0;
  while (line[i] != ';' && line[i] != '\0') {
    ident[i] = line[i];
    i++;
  }
  return ident;
}


x86 assembly (clang, -O0):
<getIdentifierFromLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1e,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x3b,%ecx
mov    %al,-0x15(%rbp)
je     1160 <getIdentifierFromLine+0x50>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1170 <getIdentifierFromLine+0x60>
jmp    1194 <getIdentifierFromLine+0x84>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1131 <getIdentifierFromLine+0x21>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getIdentifierFromLine>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1e,%edi
call   1030 <malloc@plt>
xor    %ecx,%ecx
movzbl (%rbx,%rcx,1),%edx
test   %dl,%dl
je     1136 <getIdentifierFromLine+0x26>
cmp    $0x3b,%dl
je     1136 <getIdentifierFromLine+0x26>
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
jmp    1120 <getIdentifierFromLine+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define noalias i8* @getIdentifierFromLine(i8* nocapture %0) {
%2 = tail call dereferenceable_or_null(30) i8* @malloc(i32 30)
br label %3
3: ; preds = %7, %1
%4 = phi i64 [ %9, %7 ], [ 0, %1 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
switch i8 %6, label %7 [
i8 59, label %10
i8 0, label %10
]
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %2, i64 %4
store i8 %6, i8* %8
%9 = add nuw i64 %4, 1
br label %3
10: ; preds = %3, %3
ret i8* %2
}