#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
char *helper_read_line(int /*<<< orphan*/ *);
int sscanf(char *, char *, int *, int *);
void parse_default_file(char *dflfile, int *vid, int *svid) {
  char *line;
  FILE *fh;
  fh = fopen(dflfile, "r");
  if (!fh) {
    *vid = -1;
    *svid = -1;
    return;
  }
  line = helper_read_line(fh);
  if (sscanf(line, "%i.%i", vid, svid) != 2) {
    *vid = -1;
    *svid = -1;
  }
  free(line);
  fclose(fh);
}


x86 assembly (clang, -O0):
<parse_default_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    119c <parse_default_file+0x4c>
mov    -0x10(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    -0x18(%rbp),%rax
movl   $0xffffffff,(%rax)
jmp    11f0 <parse_default_file+0xa0>
mov    -0x28(%rbp),%rdi
call   1050 <helper_read_line@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe46(%rip),%rsi
call   1060 <sscanf@plt>
cmp    $0x2,%eax
je     11de <parse_default_file+0x8e>
mov    -0x10(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    -0x18(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_default_file>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
lea    0xe9b(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11c0 <parse_default_file+0x70>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <helper_read_line@plt>
mov    %rax,%r12
lea    0xe7e(%rip),%rsi
mov    %rax,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1060 <sscanf@plt>
cmp    $0x2,%eax
je     11a5 <parse_default_file+0x55>
movl   $0xffffffff,(%r15)
movl   $0xffffffff,(%r14)
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <fclose@plt>
movl   $0xffffffff,(%r15)
movl   $0xffffffff,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [6 x i8] c"%i.%i\00"
define void @parse_default_file(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i32*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%9 = load i8*, i8** %4
%10 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %10, i32** %8
%11 = load i32*, i32** %8
%12 = icmp ne i32* %11, null
br i1 %12, label %16, label %13
13: ; preds = %3
%14 = load i32*, i32** %5
store i32 -1, i32* %14
%15 = load i32*, i32** %6
store i32 -1, i32* %15
br label %32
16: ; preds = %3
%17 = load i32*, i32** %8
%18 = call i8* @helper_read_line(i32* %17)
store i8* %18, i8** %7
%19 = load i8*, i8** %7
%20 = load i32*, i32** %5
%21 = load i32*, i32** %6
%22 = call i32 @sscanf(i8* %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %20, i32* %21)
%23 = icmp ne i32 %22, 2
br i1 %23, label %24, label %27
24: ; preds = %16
%25 = load i32*, i32** %5
store i32 -1, i32* %25
%26 = load i32*, i32** %6
store i32 -1, i32* %26
br label %27
27: ; preds = %24, %16
%28 = load i8*, i8** %7
%29 = call i32 @free(i8* %28)
%30 = load i32*, i32** %8
%31 = call i32 @fclose(i32* %30)
br label %32
32: ; preds = %27, %13
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [6 x i8] c"%i.%i\00"
define void @parse_default_file(i8* nocapture %0, i32* %1, i32* %2) {
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %7
6: ; preds = %3
store i32 -1, i32* %1
store i32 -1, i32* %2
br label %15
7: ; preds = %3
%8 = tail call i8* @helper_read_line(i32* %4)
%9 = tail call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%10 = icmp eq i32 %9, 2
br i1 %10, label %12, label %11
11: ; preds = %7
store i32 -1, i32* %1
store i32 -1, i32* %2
br label %12
12: ; preds = %11, %7
%13 = tail call i32 @free(i8* %8)
%14 = tail call i32 @fclose(i32* %4)
br label %15
15: ; preds = %12, %6
ret void
}