#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;
};

/* Variables and functions */
int sscanf(int /*<<< orphan*/, char *, unsigned int *, unsigned int *);
scalar_t__ uname(struct utsname *);
bool linux_at_least(unsigned version_first, unsigned version_second) {
  struct utsname info;
  unsigned first, second;
  if (uname(&info) != 0 ||
      sscanf(info.release, "%u.%u.", &first, &second) != 2) {
    return false;
  } else {
    return first > version_first ||
           (first = version_first && second >= version_second);
  }
}


x86 assembly (clang, -O0):
<linux_at_least>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <uname@plt>
cmp    $0x0,%rax
jne    1161 <linux_at_least+0x41>
mov    -0x10(%rbp),%edi
lea    0xeb5(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1040 <sscanf@plt>
cmp    $0x2,%eax
je     116d <linux_at_least+0x4d>
movl   $0x0,-0x4(%rbp)
jmp    11b5 <linux_at_least+0x95>
mov    -0x14(%rbp),%ecx
mov    $0x1,%al
cmp    -0x8(%rbp),%ecx
mov    %al,-0x19(%rbp)
ja     11aa <linux_at_least+0x8a>
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x1a(%rbp)
je     1199 <linux_at_least+0x79>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
setae  %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0x14(%rbp)
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linux_at_least>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r14d
mov    %edi,%ebp
mov    %rsp,%rdi
call   1030 <uname@plt>
xor    %ebx,%ebx
test   %rax,%rax
jne    1177 <linux_at_least+0x57>
mov    (%rsp),%edi
lea    0xeba(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1040 <sscanf@plt>
cmp    $0x2,%eax
jne    1177 <linux_at_least+0x57>
mov    $0x1,%ebx
cmp    %ebp,0xc(%rsp)
ja     1177 <linux_at_least+0x57>
test   %ebp,%ebp
setne  %al
cmp    %r14d,0x8(%rsp)
setae  %cl
and    %al,%cl
movzbl %cl,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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