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

/* Variables and functions */
int /*<<< orphan*/ lang_readstring(char const *, char *, char *, int);
int sscanf(char *, char *, int *, int *, int *);
void lang_readcompatibility(const char *filename, int *ver, int *subver,
                            int *wipver) {
  char compat[32];
  lang_readstring(filename, "LANG_COMPATIBILITY", compat, sizeof(compat));
  if (sscanf(compat, "%d.%d.%d", ver, subver, wipver) < 3)
    *ver = *subver = *wipver = 0;
}


x86 assembly (clang, -O0):
<lang_readcompatibility>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x40(%rbp),%rdx
lea    0xeb9(%rip),%rsi
mov    $0x20,%ecx
call   1030 <lang_readstring@plt>
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
lea    0xeab(%rip),%rsi
call   1040 <sscanf@plt>
cmp    $0x3,%eax
jge    1194 <lang_readcompatibility+0x74>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lang_readcompatibility>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rsi,%rbx
lea    0xec5(%rip),%rsi
mov    %rsp,%r12
mov    %r12,%rdx
mov    $0x20,%ecx
call   1030 <lang_readstring@plt>
lea    0xec1(%rip),%rsi
mov    %r12,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %r15,%r8
call   1040 <sscanf@plt>
cmp    $0x2,%eax
jg     117c <lang_readcompatibility+0x5c>
movl   $0x0,(%r15)
movl   $0x0,(%r14)
movl   $0x0,(%rbx)
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c"LANG_COMPATIBILITY\00"
@.str.1 = [9 x i8] c"%d.%d.%d\00"
define void @lang_readcompatibility(i8* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca [32 x i8]
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%10 = load i8*, i8** %5
%11 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%12 = call i32 @lang_readstring(i8* %10, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %11, i32 32)
%13 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%14 = load i32*, i32** %6
%15 = load i32*, i32** %7
%16 = load i32*, i32** %8
%17 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %14, i32* %15, i32* %16)
%18 = icmp slt i32 %17, 3
br i1 %18, label %19, label %23
19: ; preds = %4
%20 = load i32*, i32** %8
store i32 0, i32* %20
%21 = load i32*, i32** %7
store i32 0, i32* %21
%22 = load i32*, i32** %6
store i32 0, i32* %22
br label %23
23: ; preds = %19, %4
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"LANG_COMPATIBILITY\00"
@.str.1 = [9 x i8] c"%d.%d.%d\00"
define void @lang_readcompatibility(i8* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca [32 x i8]
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%7 = call i32 @lang_readstring(i8* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %6, i32 32)
%8 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = icmp slt i32 %8, 3
br i1 %9, label %10, label %11
10: ; preds = %4
store i32 0, i32* %3
store i32 0, i32* %2
store i32 0, i32* %1
br label %11
11: ; preds = %10, %4
ret void
}