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

/* Variables and functions */
int atoi(int /*<<< orphan*/);
scalar_t__ iupStrEqualNoCase(int /*<<< orphan*/, char *);
char *iupStrReturnInt(int);
char *iupStrReturnStrf(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ uname(struct utsname *);
char *iupdrvGetSystemVersion(void) {
  struct utsname un;
  uname(&un);
  if (iupStrEqualNoCase(un.sysname, "Darwin")) {
    int release = atoi(un.release);
    return iupStrReturnInt(release - 4);
  } else
    return iupStrReturnStrf("%s.%s", un.release, un.version);
}


x86 assembly (clang, -O0):
<iupdrvGetSystemVersion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x18(%rbp),%rdi
call   1030 <uname@plt>
mov    -0x10(%rbp),%edi
lea    0xe95(%rip),%rsi
call   1050 <iupStrEqualNoCase@plt>
cmp    $0x0,%rax
je     1199 <iupdrvGetSystemVersion+0x49>
mov    -0x14(%rbp),%edi
call   1060 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
sub    $0x4,%edi
call   1040 <iupStrReturnInt@plt>
mov    %rax,-0x8(%rbp)
jmp    11af <iupdrvGetSystemVersion+0x5f>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe61(%rip),%rdi
call   1070 <iupStrReturnStrf@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iupdrvGetSystemVersion>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
call   1030 <uname@plt>
mov    0x10(%rsp),%edi
lea    0xe97(%rip),%rsi
call   1050 <iupStrEqualNoCase@plt>
mov    0xc(%rsp),%esi
test   %rax,%rax
je     118a <iupdrvGetSystemVersion+0x3a>
mov    %esi,%edi
call   1060 <atoi@plt>
lea    -0x4(%rax),%edi
add    $0x18,%rsp
jmp    1040 <iupStrReturnInt@plt>
mov    0x8(%rsp),%edx
lea    0xe72(%rip),%rdi
add    $0x18,%rsp
jmp    1070 <iupStrReturnStrf@plt>

LLVM IR (-O0):
%struct.utsname = type { i32, i32, i32 }
@.str = [7 x i8] c"Darwin\00"
@.str.1 = [6 x i8] c"%s.%s\00"
define i8* @iupdrvGetSystemVersion() {
%1 = alloca i8*
%2 = alloca %struct.utsname
%3 = alloca i32
%4 = call i32 @uname(%struct.utsname* %2)
%5 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i32 0, i32 2
%6 = load i32, i32* %5
%7 = call i64 @iupStrEqualNoCase(i32 %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %0
%10 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i32 0, i32 1
%11 = load i32, i32* %10
%12 = call i32 @atoi(i32 %11)
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = sub nsw i32 %13, 4
%15 = call i8* @iupStrReturnInt(i32 %14)
store i8* %15, i8** %1
br label %22
16: ; preds = %0
%17 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i32 0, i32 1
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i32 0, i32 0
%20 = load i32, i32* %19
%21 = call i8* @iupStrReturnStrf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %18, i32 %20)
store i8* %21, i8** %1
br label %22
22: ; preds = %16, %9
%23 = load i8*, i8** %1
ret i8* %23
}

LLVM IR (-O2):
%struct.utsname = type { i32, i32, i32 }
@.str = [7 x i8] c"Darwin\00"
@.str.1 = [6 x i8] c"%s.%s\00"
define i8* @iupdrvGetSystemVersion() {
%1 = alloca %struct.utsname
%2 = bitcast %struct.utsname* %1 to i8*
%3 = call i32 @uname(%struct.utsname* %1)
%4 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 2
%5 = load i32, i32* %4
%6 = tail call i64 @iupStrEqualNoCase(i32 %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
%8 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 1
%9 = load i32, i32* %8
br i1 %7, label %14, label %10
10: ; preds = %0
%11 = tail call i32 @atoi(i32 %9)
%12 = add nsw i32 %11, -4
%13 = tail call i8* @iupStrReturnInt(i32 %12)
br label %18
14: ; preds = %0
%15 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 0
%16 = load i32, i32* %15
%17 = tail call i8* @iupStrReturnStrf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %16)
br label %18
18: ; preds = %14, %10
%19 = phi i8* [ %13, %10 ], [ %17, %14 ]
ret i8* %19
}