#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 sscanf(char *, char *, int *);
int /*<<< orphan*/ strcpy(char *, char *);
void get_file_line(char *sin, char *linefile, int *pline) {
  char *s;
  for (s = sin; (*s != '\0') && (*s != ':'); s++)
    ;
  if (*s != ':') {
    (void)strcpy(linefile, "--UNKNOWN--");
    *pline = -1;
  } else {
    *s = '\0';
    (void)strcpy(linefile, sin + 1);
    *s = ':';
    if (sscanf(s + 1, "%d", pline) != 1) {
      *pline = -1;
    }
  }
}


x86 assembly (clang, -O0):
<get_file_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x21(%rbp)
je     1161 <get_file_line+0x41>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1171 <get_file_line+0x51>
jmp    1187 <get_file_line+0x67>
jmp    1176 <get_file_line+0x56>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    113c <get_file_line+0x1c>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
je     11b6 <get_file_line+0x96>
mov    -0x10(%rbp),%rdi
lea    0xe5e(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
movl   $0xffffffff,(%rax)
jmp    1205 <get_file_line+0xe5>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x1,%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rax
movb   $0x3a,(%rax)
mov    -0x20(%rbp),%rdi
add    $0x1,%rdi
mov    -0x18(%rbp),%rdx
lea    0xe24(%rip),%rsi
call   1040 <sscanf@plt>
cmp    $0x1,%eax
je     1200 <get_file_line+0xe0>
mov    -0x18(%rbp),%rax
movl   $0xffffffff,(%rax)
jmp    1205 <get_file_line+0xe5>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_file_line>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rcx
mov    %rdi,%rax
lea    0x1(%rdi),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl -0x1(%rbx),%edx
test   %dl,%dl
je     1153 <get_file_line+0x33>
cmp    $0x3a,%dl
je     1164 <get_file_line+0x44>
add    $0x1,%rbx
jmp    1140 <get_file_line+0x20>
lea    0xea6(%rip),%rsi
mov    %rcx,%rdi
call   1030 <strcpy@plt>
jmp    1192 <get_file_line+0x72>
movb   $0x0,-0x1(%rbx)
add    $0x1,%rax
mov    %rcx,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
movb   $0x3a,-0x1(%rbx)
lea    0xe8a(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
je     1199 <get_file_line+0x79>
movl   $0xffffffff,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"--UNKNOWN--\00"
@.str.1 = [3 x i8] c"%d\00"
define void @get_file_line(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%8 = load i8*, i8** %4
store i8* %8, i8** %7
br label %9
9: ; preds = %22, %3
%10 = load i8*, i8** %7
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %9
%15 = load i8*, i8** %7
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 58
br label %19
19: ; preds = %14, %9
%20 = phi i1 [ false, %9 ], [ %18, %14 ]
br i1 %20, label %21, label %25
21: ; preds = %19
br label %22
22: ; preds = %21
%23 = load i8*, i8** %7
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %7
br label %9
25: ; preds = %19
%26 = load i8*, i8** %7
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 58
br i1 %29, label %30, label %34
30: ; preds = %25
%31 = load i8*, i8** %5
%32 = call i32 @strcpy(i8* %31, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%33 = load i32*, i32** %6
store i32 -1, i32* %33
br label %49
34: ; preds = %25
%35 = load i8*, i8** %7
store i8 0, i8* %35
%36 = load i8*, i8** %5
%37 = load i8*, i8** %4
%38 = getelementptr inbounds i8, i8* %37, i64 1
%39 = call i32 @strcpy(i8* %36, i8* %38)
%40 = load i8*, i8** %7
store i8 58, i8* %40
%41 = load i8*, i8** %7
%42 = getelementptr inbounds i8, i8* %41, i64 1
%43 = load i32*, i32** %6
%44 = call i32 @sscanf(i8* %42, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %43)
%45 = icmp ne i32 %44, 1
br i1 %45, label %46, label %48
46: ; preds = %34
%47 = load i32*, i32** %6
store i32 -1, i32* %47
br label %48
48: ; preds = %46, %34
br label %49
49: ; preds = %48, %30
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"--UNKNOWN--\00"
@.str.1 = [3 x i8] c"%d\00"
define void @get_file_line(i8* %0, i8* %1, i32* %2) {
br label %4
4: ; preds = %7, %3
%5 = phi i8* [ %0, %3 ], [ %8, %7 ]
%6 = load i8, i8* %5
switch i8 %6, label %7 [
i8 58, label %11
i8 0, label %9
]
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
br label %4
9: ; preds = %4
%10 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %17
11: ; preds = %4
store i8 0, i8* %5
%12 = getelementptr inbounds i8, i8* %0, i64 1
%13 = tail call i32 @strcpy(i8* %1, i8* %12)
store i8 58, i8* %5
%14 = getelementptr inbounds i8, i8* %5, i64 1
%15 = tail call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%16 = icmp eq i32 %15, 1
br i1 %16, label %18, label %17
17: ; preds = %11, %9
store i32 -1, i32* %2
br label %18
18: ; preds = %17, %11
ret void
}