#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 MakeArgs(char *, char **, int, int);
int /*<<< orphan*/ log_Printf(int, char *, char const *, int);
int /*<<< orphan*/ strcmp(char *, char *);
int strlen(char *);
char *GetLabel(char *line, const char *filename, int linenum) {
  char *argv[40];
  int argc, len;
  argc = MakeArgs(line, argv, 40, 1);
  if (argc == 2 && !strcmp(argv[1], ":"))
    return argv[0];
  if (argc != 1 || (len = strlen(argv[0])) < 2 || argv[0][len - 1] != ':') {
    log_Printf((23), "Bad label in %s (line %d) - missing colon\n", filename,
               linenum);
    return NULL;
  }
  argv[0][len - 1] = '\0';
  return argv[0];
}


x86 assembly (clang, -O0):
<GetLabel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x160(%rbp),%rsi
mov    $0x28,%edx
mov    $0x1,%ecx
call   1060 <MakeArgs@plt>
mov    %eax,-0x164(%rbp)
cmpl   $0x2,-0x164(%rbp)
jne    11af <GetLabel+0x6f>
mov    -0x158(%rbp),%rdi
lea    0xe6f(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11af <GetLabel+0x6f>
mov    -0x160(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    123e <GetLabel+0xfe>
cmpl   $0x1,-0x164(%rbp)
jne    11f7 <GetLabel+0xb7>
mov    -0x160(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x168(%rbp)
cmp    $0x2,%eax
jl     11f7 <GetLabel+0xb7>
mov    -0x160(%rbp),%rax
mov    -0x168(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3a,%eax
je     121c <GetLabel+0xdc>
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    $0x17,%edi
lea    0xdf8(%rip),%rsi
call   1030 <log_Printf@plt>
movq   $0x0,-0x8(%rbp)
jmp    123e <GetLabel+0xfe>
mov    -0x160(%rbp),%rax
mov    -0x168(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x160(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetLabel>:
push   %rbp
push   %rbx
sub    $0x148,%rsp
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rsp,%rsi
mov    $0x28,%edx
mov    $0x1,%ecx
call   1060 <MakeArgs@plt>
cmp    $0x1,%eax
je     1181 <GetLabel+0x41>
cmp    $0x2,%eax
jne    11a6 <GetLabel+0x66>
mov    0x8(%rsp),%rdi
lea    0xe8a(%rip),%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
jne    11a6 <GetLabel+0x66>
jmp    11a0 <GetLabel+0x60>
mov    (%rsp),%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
jl     11a6 <GetLabel+0x66>
mov    (%rsp),%rcx
add    $0xffffffff,%eax
cmpb   $0x3a,(%rcx,%rax,1)
jne    11a6 <GetLabel+0x66>
movb   $0x0,(%rcx,%rax,1)
mov    (%rsp),%rax
jmp    11be <GetLabel+0x7e>
lea    0xe55(%rip),%rsi
mov    $0x17,%edi
mov    %rbx,%rdx
mov    %ebp,%ecx
call   1030 <log_Printf@plt>
xor    %eax,%eax
add    $0x148,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c":\00"
@.str.1 = [43 x i8] c"Bad label in %s (line %d) - missing colon\0A\00"
define i8* @GetLabel(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca [40 x i8*]
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%11 = load i8*, i8** %5
%12 = getelementptr inbounds [40 x i8*], [40 x i8*]* %8, i64 0, i64 0
%13 = call i32 @MakeArgs(i8* %11, i8** %12, i32 40, i32 1)
store i32 %13, i32* %9
%14 = load i32, i32* %9
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %24
16: ; preds = %3
%17 = getelementptr inbounds [40 x i8*], [40 x i8*]* %8, i64 0, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @strcmp(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %16
%22 = getelementptr inbounds [40 x i8*], [40 x i8*]* %8, i64 0, i64 0
%23 = load i8*, i8** %22
store i8* %23, i8** %4
br label %55
24: ; preds = %16, %3
%25 = load i32, i32* %9
%26 = icmp ne i32 %25, 1
br i1 %26, label %42, label %27
27: ; preds = %24
%28 = getelementptr inbounds [40 x i8*], [40 x i8*]* %8, i64 0, i64 0
%29 = load i8*, i8** %28
%30 = call i32 @strlen(i8* %29)
store i32 %30, i32* %10
%31 = icmp slt i32 %30, 2
br i1 %31, label %42, label %32
32: ; preds = %27
%33 = getelementptr inbounds [40 x i8*], [40 x i8*]* %8, i64 0, i64 0
%34 = load i8*, i8** %33
%35 = load i32, i32* %10
%36 = sub nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %34, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp ne i32 %40, 58
br i1 %41, label %42, label %46
42: ; preds = %32, %27, %24
%43 = load i8*, i8** %6
%44 = load i32, i32* %7
%45 = call i32 @log_Printf(i32 23, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %43, i32 %44)
store i8* null, i8** %4
br label %55
46: ; preds = %32
%47 = getelementptr inbounds [40 x i8*], [40 x i8*]* %8, i64 0, i64 0
%48 = load i8*, i8** %47
%49 = load i32, i32* %10
%50 = sub nsw i32 %49, 1
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %48, i64 %51
store i8 0, i8* %52
%53 = getelementptr inbounds [40 x i8*], [40 x i8*]* %8, i64 0, i64 0
%54 = load i8*, i8** %53
store i8* %54, i8** %4
br label %55
55: ; preds = %46, %42, %21
%56 = load i8*, i8** %4
ret i8* %56
}

LLVM IR (-O2):
@.str = [2 x i8] c":\00"
@.str.1 = [43 x i8] c"Bad label in %s (line %d) - missing colon\0A\00"
define i8* @GetLabel(i8* %0, i8* %1, i32 %2) {
%4 = alloca [40 x i8*]
%5 = bitcast [40 x i8*]* %4 to i8*
%6 = getelementptr inbounds [40 x i8*], [40 x i8*]* %4, i64 0, i64 0
%7 = call i32 @MakeArgs(i8* %0, i8** %6, i32 40, i32 1)
switch i32 %7, label %26 [
i32 2, label %8
i32 1, label %15
]
8: ; preds = %3
%9 = getelementptr inbounds [40 x i8*], [40 x i8*]* %4, i64 0, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @strcmp(i8* dereferenceable(1) %10, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %26
13: ; preds = %8
%14 = load i8*, i8** %6
br label %30
15: ; preds = %3
%16 = load i8*, i8** %6
%17 = call i32 @strlen(i8* %16)
%18 = icmp slt i32 %17, 2
br i1 %18, label %26, label %19
19: ; preds = %15
%20 = load i8*, i8** %6
%21 = add nsw i32 %17, -1
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 58
br i1 %25, label %28, label %26
26: ; preds = %8, %3, %19, %15
%27 = call i32 @log_Printf(i32 23, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %1, i32 %2)
br label %30
28: ; preds = %19
store i8 0, i8* %23
%29 = load i8*, i8** %6
br label %30
30: ; preds = %28, %26, %13
%31 = phi i8* [ null, %26 ], [ %29, %28 ], [ %14, %13 ]
ret i8* %31
}