#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 atoi(char *);
char *strtok(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ uname(struct utsname *);
int check_linux_version_newer(int major, int minor, int subminor) {
  int newer = 0;
  int check_version, current_version;
  struct utsname uname_buffer;
  char *ptr;
  int current_major = 0, current_minor = 0, current_sub = 0;
  uname(&uname_buffer);
  ptr = strtok(uname_buffer.release, ".");
  if (ptr != NULL)
    current_major = atoi(ptr);
  ptr = strtok(NULL, ".");
  if (ptr != NULL)
    current_minor = atoi(ptr);
  ptr = strtok(NULL, ".");
  if (ptr != NULL)
    current_sub = atoi(ptr);
  check_version = (((major & 0xff) << 24) | ((minor & 0xff) << 16) |
                   ((subminor & 0xff) << 8));
  current_version =
      (((current_major & 0xff) << 24) | ((current_minor & 0xff) << 16) |
       ((current_sub & 0xff) << 8));
  if (current_version >= check_version)
    newer = 1;
  return newer;
}


x86 assembly (clang, -O0):
<check_linux_version_newer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <uname@plt>
mov    -0x20(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1191 <check_linux_version_newer+0x61>
mov    -0x28(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x2c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe64(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11bc <check_linux_version_newer+0x8c>
mov    -0x28(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x30(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe39(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11e7 <check_linux_version_newer+0xb7>
mov    -0x28(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x34(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%ecx
and    $0xff,%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x2c(%rbp),%eax
and    $0xff,%eax
shl    $0x18,%eax
mov    -0x30(%rbp),%ecx
and    $0xff,%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x34(%rbp),%ecx
and    $0xff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     124e <check_linux_version_newer+0x11e>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_linux_version_newer>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%r14d
mov    %edi,%r12d
mov    %rsp,%rdi
call   1030 <uname@plt>
mov    (%rsp),%rdi
lea    0xea9(%rip),%rsi
call   1040 <strtok@plt>
xor    %ebp,%ebp
mov    $0x0,%r13d
test   %rax,%rax
je     1178 <check_linux_version_newer+0x48>
mov    %rax,%rdi
call   1050 <atoi@plt>
mov    %eax,%r13d
shl    $0x18,%r13d
lea    0xe81(%rip),%rsi
xor    %edi,%edi
call   1040 <strtok@plt>
test   %rax,%rax
je     1199 <check_linux_version_newer+0x69>
mov    %rax,%rdi
call   1050 <atoi@plt>
movzbl %al,%ebp
shl    $0x10,%ebp
lea    0xe60(%rip),%rsi
xor    %ebx,%ebx
xor    %edi,%edi
call   1040 <strtok@plt>
test   %rax,%rax
je     11bc <check_linux_version_newer+0x8c>
mov    %rax,%rdi
call   1050 <atoi@plt>
shl    $0x8,%eax
movzwl %ax,%ebx
shl    $0x18,%r12d
movzbl %r14b,%eax
shl    $0x10,%eax
or     %r12d,%eax
shl    $0x8,%r15d
movzwl %r15w,%ecx
or     %eax,%ecx
or     %r13d,%ebp
or     %ebx,%ebp
xor    %eax,%eax
cmp    %ecx,%ebp
setge  %al
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.utsname = type { i32* }
@.str = [2 x i8] c".\00"
define i32 @check_linux_version_newer(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.utsname
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
store i32 0, i32* %12
store i32 0, i32* %13
store i32 0, i32* %14
%15 = call i32 @uname(%struct.utsname* %10)
%16 = getelementptr inbounds %struct.utsname, %struct.utsname* %10, i32 0, i32 0
%17 = load i32*, i32** %16
%18 = call i8* @strtok(i32* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %18, i8** %11
%19 = load i8*, i8** %11
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %24
21: ; preds = %3
%22 = load i8*, i8** %11
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %12
br label %24
24: ; preds = %21, %3
%25 = call i8* @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %25, i8** %11
%26 = load i8*, i8** %11
%27 = icmp ne i8* %26, null
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = load i8*, i8** %11
%30 = call i32 @atoi(i8* %29)
store i32 %30, i32* %13
br label %31
31: ; preds = %28, %24
%32 = call i8* @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %32, i8** %11
%33 = load i8*, i8** %11
%34 = icmp ne i8* %33, null
br i1 %34, label %35, label %38
35: ; preds = %31
%36 = load i8*, i8** %11
%37 = call i32 @atoi(i8* %36)
store i32 %37, i32* %14
br label %38
38: ; preds = %35, %31
%39 = load i32, i32* %4
%40 = and i32 %39, 255
%41 = shl i32 %40, 24
%42 = load i32, i32* %5
%43 = and i32 %42, 255
%44 = shl i32 %43, 16
%45 = or i32 %41, %44
%46 = load i32, i32* %6
%47 = and i32 %46, 255
%48 = shl i32 %47, 8
%49 = or i32 %45, %48
store i32 %49, i32* %8
%50 = load i32, i32* %12
%51 = and i32 %50, 255
%52 = shl i32 %51, 24
%53 = load i32, i32* %13
%54 = and i32 %53, 255
%55 = shl i32 %54, 16
%56 = or i32 %52, %55
%57 = load i32, i32* %14
%58 = and i32 %57, 255
%59 = shl i32 %58, 8
%60 = or i32 %56, %59
store i32 %60, i32* %9
%61 = load i32, i32* %9
%62 = load i32, i32* %8
%63 = icmp sge i32 %61, %62
br i1 %63, label %64, label %65
64: ; preds = %38
store i32 1, i32* %7
br label %65
65: ; preds = %64, %38
%66 = load i32, i32* %7
ret i32 %66
}

LLVM IR (-O2):
%struct.utsname = type { i32* }
@.str = [2 x i8] c".\00"
define i32 @check_linux_version_newer(i32 %0, i32 %1, i32 %2) {
%4 = alloca %struct.utsname
%5 = bitcast %struct.utsname* %4 to i8*
%6 = call i32 @uname(%struct.utsname* %4)
%7 = getelementptr inbounds %struct.utsname, %struct.utsname* %4, i64 0, i32 0
%8 = load i32*, i32** %7
%9 = tail call i8* @strtok(i32* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i8* %9, null
br i1 %10, label %14, label %11
11: ; preds = %3
%12 = tail call i32 @atoi(i8* %9)
%13 = shl i32 %12, 24
br label %14
14: ; preds = %11, %3
%15 = phi i32 [ %13, %11 ], [ 0, %3 ]
%16 = tail call i8* @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i8* %16, null
br i1 %17, label %22, label %18
18: ; preds = %14
%19 = tail call i32 @atoi(i8* %16)
%20 = shl i32 %19, 16
%21 = and i32 %20, 16711680
br label %22
22: ; preds = %18, %14
%23 = phi i32 [ %21, %18 ], [ 0, %14 ]
%24 = tail call i8* @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%25 = icmp eq i8* %24, null
br i1 %25, label %30, label %26
26: ; preds = %22
%27 = tail call i32 @atoi(i8* %24)
%28 = shl i32 %27, 8
%29 = and i32 %28, 65280
br label %30
30: ; preds = %26, %22
%31 = phi i32 [ %29, %26 ], [ 0, %22 ]
%32 = shl i32 %0, 24
%33 = shl i32 %1, 16
%34 = and i32 %33, 16711680
%35 = or i32 %34, %32
%36 = shl i32 %2, 8
%37 = and i32 %36, 65280
%38 = or i32 %35, %37
%39 = or i32 %23, %15
%40 = or i32 %39, %31
%41 = icmp sge i32 %40, %38
%42 = zext i1 %41 to i32
ret i32 %42
}