#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 */
struct utsname {
  int /*<<< orphan*/ release;
  int /*<<< orphan*/ sysname;
};

/* Variables and functions */
scalar_t__ KERNEL_VERSION(int, int, unsigned int);
int sscanf(int /*<<< orphan*/, char *, unsigned int *, unsigned int *,
           unsigned int *);
scalar_t__ strcmp(int /*<<< orphan*/, char *);
bool linux_4_8_or_higher(const struct utsname *utsname) {
  unsigned int maj, min, rel;
  if (strcmp(utsname->sysname, "Linux"))
    return false;
  if (sscanf(utsname->release, "%u.%u.%u", &maj, &min, &rel) != 3)
    return false;
  return KERNEL_VERSION(maj, min, rel) >= KERNEL_VERSION(4, 8, 0);
}


x86 assembly (clang, -O0):
<linux_4_8_or_higher>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
lea    0xeb6(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1165 <linux_4_8_or_higher+0x35>
movl   $0x0,-0x4(%rbp)
jmp    11d0 <linux_4_8_or_higher+0xa0>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
lea    0xe94(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
call   1050 <sscanf@plt>
cmp    $0x3,%eax
je     1198 <linux_4_8_or_higher+0x68>
movl   $0x0,-0x4(%rbp)
jmp    11d0 <linux_4_8_or_higher+0xa0>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1030 <KERNEL_VERSION@plt>
mov    %rax,-0x28(%rbp)
mov    $0x4,%edi
mov    $0x8,%esi
xor    %edx,%edx
call   1030 <KERNEL_VERSION@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
setge  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linux_4_8_or_higher>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
mov    0x4(%rdi),%edi
lea    0xebd(%rip),%rsi
call   1040 <strcmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
jne    119f <linux_4_8_or_higher+0x6f>
mov    (%rbx),%edi
lea    0xeae(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
call   1050 <sscanf@plt>
cmp    $0x3,%eax
jne    119f <linux_4_8_or_higher+0x6f>
mov    0x14(%rsp),%edi
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
call   1030 <KERNEL_VERSION@plt>
mov    %rax,%rbx
mov    $0x4,%edi
mov    $0x8,%esi
xor    %edx,%edx
call   1030 <KERNEL_VERSION@plt>
xor    %ebp,%ebp
cmp    %rax,%rbx
setge  %bpl
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.utsname = type { i32, i32 }
@.str = [6 x i8] c"Linux\00"
@.str.1 = [9 x i8] c"%u.%u.%u\00"
define i32 @linux_4_8_or_higher(%struct.utsname* %0) {
%2 = alloca i32
%3 = alloca %struct.utsname*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store %struct.utsname* %0, %struct.utsname** %3
%7 = load %struct.utsname*, %struct.utsname** %3
%8 = getelementptr inbounds %struct.utsname, %struct.utsname* %7, i32 0, i32 1
%9 = load i32, i32* %8
%10 = call i64 @strcmp(i32 %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %1
store i32 0, i32* %2
br label %28
13: ; preds = %1
%14 = load %struct.utsname*, %struct.utsname** %3
%15 = getelementptr inbounds %struct.utsname, %struct.utsname* %14, i32 0, i32 0
%16 = load i32, i32* %15
%17 = call i32 @sscanf(i32 %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5, i32* %6)
%18 = icmp ne i32 %17, 3
br i1 %18, label %19, label %20
19: ; preds = %13
store i32 0, i32* %2
br label %28
20: ; preds = %13
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = load i32, i32* %6
%24 = call i64 @KERNEL_VERSION(i32 %21, i32 %22, i32 %23)
%25 = call i64 @KERNEL_VERSION(i32 4, i32 8, i32 0)
%26 = icmp sge i64 %24, %25
%27 = zext i1 %26 to i32
store i32 %27, i32* %2
br label %28
28: ; preds = %20, %19, %12
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
%struct.utsname = type { i32, i32 }
@.str = [6 x i8] c"Linux\00"
@.str.1 = [9 x i8] c"%u.%u.%u\00"
define i32 @linux_4_8_or_higher(%struct.utsname* nocapture %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = getelementptr inbounds %struct.utsname, %struct.utsname* %0, i64 0, i32 1
%9 = load i32, i32* %8
%10 = tail call i64 @strcmp(i32 %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %25
12: ; preds = %1
%13 = getelementptr inbounds %struct.utsname, %struct.utsname* %0, i64 0, i32 0
%14 = load i32, i32* %13
%15 = call i32 @sscanf(i32 %14, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%16 = icmp eq i32 %15, 3
br i1 %16, label %17, label %25
17: ; preds = %12
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = call i64 @KERNEL_VERSION(i32 %18, i32 %19, i32 %20)
%22 = call i64 @KERNEL_VERSION(i32 4, i32 8, i32 0)
%23 = icmp sge i64 %21, %22
%24 = zext i1 %23 to i32
br label %25
25: ; preds = %12, %1, %17
%26 = phi i32 [ %24, %17 ], [ 0, %1 ], [ 0, %12 ]
ret i32 %26
}