#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 *sysname;
  char *nodename;
  char *release;
  char *version;
  char *machine;
  char *__domainname;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strstr(char *, char *);
int /*<<< orphan*/ uname(struct utsname *);
int main(void) {
  char distro[1024], *release;
  struct utsname Distro;
  uname(&Distro);
  printf("Sysname:%s\n", Distro.sysname);
  printf("Nodename:%s\n", Distro.nodename);
  printf("Release:%s\n", Distro.release);
  printf("Version:%s\n", Distro.version);
  printf("Machine:%s\n", Distro.machine);
  printf("Domainname:%s\n", Distro.__domainname);
  strcpy(distro, Distro.release);
  release = strstr(distro, "ARCH");
  if (strcmp(release, "ARCH") == 0)
    printf("ARCH\n");
  else if (strcmp(release, "arch") == 0)
    printf("arch\n");
  else
    printf("Debian Based!\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x448(%rbp),%rdi
call   1050 <uname@plt>
mov    -0x448(%rbp),%rsi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x440(%rbp),%rsi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x438(%rbp),%rsi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x430(%rbp),%rsi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x428(%rbp),%rsi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x420(%rbp),%rsi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x410(%rbp),%rdi
mov    -0x438(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x410(%rbp),%rdi
lea    0xe3f(%rip),%rsi
call   1070 <strstr@plt>
mov    %rax,-0x418(%rbp)
mov    -0x418(%rbp),%rdi
lea    0xe25(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1249 <main+0xf9>
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    128c <main+0x13c>
mov    -0x418(%rbp),%rdi
lea    0xe00(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1279 <main+0x129>
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1287 <main+0x137>
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    128c <main+0x13c>
mov    -0x4(%rbp),%eax
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x430,%rsp
mov    %rsp,%rdi
call   1060 <uname@plt>
mov    (%rsp),%rsi
lea    0xe81(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%rsi
lea    0xe7a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%rbx
lea    0xe74(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rsp),%rsi
lea    0xe6a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%rsp),%rsi
lea    0xe63(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x28(%rsp),%rsi
lea    0xe5c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x30(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xe60(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <strstr@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     123d <main+0xdd>
lea    0xe36(%rip),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
lea    0xe13(%rip),%rbx
cmove  %r15,%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.utsname = type { i8*, i8*, i8*, i8*, i8*, i8* }
@.str = [12 x i8] c"Sysname:%s\0A\00"
@.str.1 = [13 x i8] c"Nodename:%s\0A\00"
@.str.2 = [12 x i8] c"Release:%s\0A\00"
@.str.3 = [12 x i8] c"Version:%s\0A\00"
@.str.4 = [12 x i8] c"Machine:%s\0A\00"
@.str.5 = [15 x i8] c"Domainname:%s\0A\00"
@.str.6 = [5 x i8] c"ARCH\00"
@.str.7 = [6 x i8] c"ARCH\0A\00"
@.str.8 = [5 x i8] c"arch\00"
@.str.9 = [6 x i8] c"arch\0A\00"
@.str.10 = [15 x i8] c"Debian Based!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca i8*
%4 = alloca %struct.utsname
store i32 0, i32* %1
%5 = call i32 @uname(%struct.utsname* %4)
%6 = getelementptr inbounds %struct.utsname, %struct.utsname* %4, i32 0, i32 0
%7 = load i8*, i8** %6
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds %struct.utsname, %struct.utsname* %4, i32 0, i32 1
%10 = load i8*, i8** %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds %struct.utsname, %struct.utsname* %4, i32 0, i32 2
%13 = load i8*, i8** %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds %struct.utsname, %struct.utsname* %4, i32 0, i32 3
%16 = load i8*, i8** %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds %struct.utsname, %struct.utsname* %4, i32 0, i32 4
%19 = load i8*, i8** %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %19)
%21 = getelementptr inbounds %struct.utsname, %struct.utsname* %4, i32 0, i32 5
%22 = load i8*, i8** %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%25 = getelementptr inbounds %struct.utsname, %struct.utsname* %4, i32 0, i32 2
%26 = load i8*, i8** %25
%27 = call i32 @strcpy(i8* %24, i8* %26)
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%29 = call i8* @strstr(i8* %28, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
store i8* %29, i8** %3
%30 = load i8*, i8** %3
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %0
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %44
35: ; preds = %0
%36 = load i8*, i8** %3
%37 = call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %35
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
br label %43
41: ; preds = %35
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0))
br label %43
43: ; preds = %41, %39
br label %44
44: ; preds = %43, %33
%45 = load i32, i32* %1
ret i32 %45
}

LLVM IR (-O2):
%struct.utsname = type { i8*, i8*, i8*, i8*, i8*, i8* }
@.str = [12 x i8] c"Sysname:%s\0A\00"
@.str.1 = [13 x i8] c"Nodename:%s\0A\00"
@.str.2 = [12 x i8] c"Release:%s\0A\00"
@.str.3 = [12 x i8] c"Version:%s\0A\00"
@.str.4 = [12 x i8] c"Machine:%s\0A\00"
@.str.5 = [15 x i8] c"Domainname:%s\0A\00"
@str = [14 x i8] c"Debian Based!\00"
@str.11 = [5 x i8] c"arch\00"
@str.12 = [5 x i8] c"ARCH\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = alloca %struct.utsname
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%4 = bitcast %struct.utsname* %2 to i8*
%5 = call i32 @uname(%struct.utsname* %2)
%6 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i64 0, i32 0
%7 = load i8*, i8** %6
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i64 0, i32 1
%10 = load i8*, i8** %9
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i64 0, i32 2
%13 = load i8*, i8** %12
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i64 0, i32 3
%16 = load i8*, i8** %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i64 0, i32 4
%19 = load i8*, i8** %18
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %19)
%21 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i64 0, i32 5
%22 = load i8*, i8** %21
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8* %22)
%24 = call i32 @strcpy(i8* %3, i8* %13)
%25 = call i8* @strstr(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.12, i64 0, i64 0))
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str.12, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %32, label %28
28: ; preds = %0
%29 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str.11, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
%31 = select i1 %30, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str.11, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0)
br label %32
32: ; preds = %28, %0
%33 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @str.12, i64 0, i64 0), %0 ], [ %31, %28 ]
%34 = call i32 @puts(i8* dereferenceable(1) %33)
ret i32 0
}