#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 {
  char *release;
};

/* Variables and functions */
int atoi(char *);
char *strsep(char **, char *);
int /*<<< orphan*/ uname(struct utsname *);
void get_kver(int *k1, int *k2, int *k3) {
  struct utsname uval;
  char *kver;
  char *r1, *r2, *r3;
  uname(&uval);
  kver = uval.release;
  r1 = strsep(&kver, ".");
  r2 = strsep(&kver, ".");
  r3 = strsep(&kver, ".");
  *k1 = atoi(r1);
  *k2 = atoi(r2);
  *k3 = atoi(r3);
}


x86 assembly (clang, -O0):
<get_kver>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <uname@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x28(%rbp),%rdi
lea    0xea0(%rip),%rsi
call   1040 <strsep@plt>
mov    %rax,-0x30(%rbp)
lea    -0x28(%rbp),%rdi
lea    0xe8c(%rip),%rsi
call   1040 <strsep@plt>
mov    %rax,-0x38(%rbp)
lea    -0x28(%rbp),%rdi
lea    0xe78(%rip),%rsi
call   1040 <strsep@plt>
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x40(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_kver>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,0x8(%rsp)
mov    %rsi,%r15
mov    %rdi,%r12
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <uname@plt>
lea    0xea3(%rip),%r13
mov    %rbx,%rdi
mov    %r13,%rsi
call   1040 <strsep@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    %r13,%rsi
call   1040 <strsep@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    %r13,%rsi
call   1040 <strsep@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1050 <atoi@plt>
mov    %eax,(%r12)
mov    %r14,%rdi
call   1050 <atoi@plt>
mov    %eax,(%r15)
mov    %rbx,%rdi
call   1050 <atoi@plt>
mov    0x8(%rsp),%rcx
mov    %eax,(%rcx)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.utsname = type { i8* }
@.str = [2 x i8] c".\00"
define void @get_kver(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca %struct.utsname
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%12 = call i32 @uname(%struct.utsname* %7)
%13 = getelementptr inbounds %struct.utsname, %struct.utsname* %7, i32 0, i32 0
%14 = load i8*, i8** %13
store i8* %14, i8** %8
%15 = call i8* @strsep(i8** %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %15, i8** %9
%16 = call i8* @strsep(i8** %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %16, i8** %10
%17 = call i8* @strsep(i8** %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %17, i8** %11
%18 = load i8*, i8** %9
%19 = call i32 @atoi(i8* %18)
%20 = load i32*, i32** %4
store i32 %19, i32* %20
%21 = load i8*, i8** %10
%22 = call i32 @atoi(i8* %21)
%23 = load i32*, i32** %5
store i32 %22, i32* %23
%24 = load i8*, i8** %11
%25 = call i32 @atoi(i8* %24)
%26 = load i32*, i32** %6
store i32 %25, i32* %26
ret void
}

LLVM IR (-O2):
%struct.utsname = type { i8* }
@.str = [2 x i8] c".\00"
define void @get_kver(i32* nocapture writeonly %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = bitcast i8** %4 to %struct.utsname*
%7 = call i32 @uname(%struct.utsname* %6)
%8 = call i8* @strsep(i8** %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = call i8* @strsep(i8** %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = call i8* @strsep(i8** %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @atoi(i8* %8)
store i32 %11, i32* %0
%12 = call i32 @atoi(i8* %9)
store i32 %12, i32* %1
%13 = call i32 @atoi(i8* %10)
store i32 %13, i32* %2
ret void
}