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

/* Variables and functions */
void get_cpuinfo_arm(char *);
void get_cpuinfo_x86(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
scalar_t__ strstr(char *, char *);
int /*<<< orphan*/ uname(struct utsname *);
void get_cpuinfo(char *cpuinfo) {
  struct utsname uname_buf;
  uname(&uname_buf);
  if (strstr(uname_buf.machine, "86")) {
    return get_cpuinfo_x86(cpuinfo);
  }
  if (strstr(uname_buf.machine, "arm")) {
    return get_cpuinfo_arm(cpuinfo);
  }
  sprintf(cpuinfo, "%s UNKNOWN\n", uname_buf.machine);
}


x86 assembly (clang, -O0):
<get_cpuinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
call   1040 <uname@plt>
mov    -0x10(%rbp),%rdi
lea    0xe90(%rip),%rsi
call   1070 <strstr@plt>
cmp    $0x0,%rax
je     118d <get_cpuinfo+0x3d>
mov    -0x8(%rbp),%rdi
call   1050 <get_cpuinfo_x86@plt>
jmp    11c9 <get_cpuinfo+0x79>
mov    -0x10(%rbp),%rdi
lea    0xe6b(%rip),%rsi
call   1070 <strstr@plt>
cmp    $0x0,%rax
je     11b5 <get_cpuinfo+0x65>
mov    -0x8(%rbp),%rdi
call   1030 <get_cpuinfo_arm@plt>
jmp    11c9 <get_cpuinfo+0x79>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe43(%rip),%rsi
call   1060 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_cpuinfo>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %rsp,%rdi
call   1040 <uname@plt>
mov    (%rsp),%rbx
lea    0xe96(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strstr@plt>
test   %rax,%rax
je     1186 <get_cpuinfo+0x36>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <get_cpuinfo_x86@plt>
lea    0xe76(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strstr@plt>
test   %rax,%rax
je     11a9 <get_cpuinfo+0x59>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <get_cpuinfo_arm@plt>
lea    0xe57(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <sprintf@plt>

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

LLVM IR (-O2):
%struct.utsname = type { i8* }
@.str = [3 x i8] c"86\00"
@.str.1 = [4 x i8] c"arm\00"
@.str.2 = [12 x i8] c"%s UNKNOWN\0A\00"
define void @get_cpuinfo(i8* %0) {
%2 = alloca %struct.utsname
%3 = bitcast %struct.utsname* %2 to i8*
%4 = call i32 @uname(%struct.utsname* %2)
%5 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i64 0, i32 0
%6 = load i8*, i8** %5
%7 = tail call i64 @strstr(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %1
tail call void @get_cpuinfo_x86(i8* %0)
br label %16
10: ; preds = %1
%11 = tail call i64 @strstr(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %10
tail call void @get_cpuinfo_arm(i8* %0)
br label %16
14: ; preds = %10
%15 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %6)
br label %16
16: ; preds = %14, %13, %9
ret void
}