#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 */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ printf(char *, ...);
char *strerror(int /*<<< orphan*/);
int uname(struct utsname *);
int main(int argc, char **argv) {
  struct utsname utsn;
  int ret, i;
  if (argc != 1) {
    printf("arch: extra operand");
    for (i = 1; i < argc; i++)
      printf(" '%s'", argv[i]);
    printf("\n");
    return -1;
  }
  ret = uname(&utsn);
  if (ret != 0) {
    printf("uname error: %s\n", strerror(errno));
    return -1;
  }
  printf("%s\n", utsn.machine);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     11b3 <main+0x83>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1199 <main+0x69>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1165 <main+0x35>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    120d <main+0xdd>
lea    -0x18(%rbp),%rdi
call   1040 <uname@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     11f4 <main+0xc4>
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %rax,%rsi
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    120d <main+0xdd>
mov    -0x18(%rbp),%rsi
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x1,%edi
jne    1192 <main+0x42>
mov    %rsp,%rdi
call   1060 <uname@plt>
test   %eax,%eax
je     11e8 <main+0x98>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
lea    0xe99(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%eax
jmp    11f3 <main+0xa3>
mov    %rsi,%r15
mov    %edi,%ebp
lea    0xe62(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x2,%ebp
jl     11d7 <main+0x87>
mov    %ebp,%ebp
mov    $0x1,%ebx
lea    0xe5c(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    11c0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xffffffff,%eax
jmp    11f3 <main+0xa3>
mov    (%rsp),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.utsname = type { i8* }
@.str = [20 x i8] c"arch: extra operand\00"
@.str.1 = [6 x i8] c" '%s'\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [17 x i8] c"uname error: %s\0A\00"
@errno = global i32 0
@.str.4 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.utsname
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 1
br i1 %10, label %11, label %29
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %8
br label %13
13: ; preds = %24, %11
%14 = load i32, i32* %8
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %27
17: ; preds = %13
%18 = load i8**, i8*** %5
%19 = load i32, i32* %8
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %17
%25 = load i32, i32* %8
%26 = add nsw i32 %25, 1
store i32 %26, i32* %8
br label %13
27: ; preds = %13
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %41
29: ; preds = %2
%30 = call i32 @uname(%struct.utsname* %6)
store i32 %30, i32* %7
%31 = load i32, i32* %7
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %37
33: ; preds = %29
%34 = load i32, i32* @errno
%35 = call i8* @strerror(i32 %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %35)
store i32 -1, i32* %3
br label %41
37: ; preds = %29
%38 = getelementptr inbounds %struct.utsname, %struct.utsname* %6, i32 0, i32 0
%39 = load i8*, i8** %38
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %39)
store i32 0, i32* %3
br label %41
41: ; preds = %37, %33, %27
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
%struct.utsname = type { i8* }
@.str = [20 x i8] c"arch: extra operand\00"
@.str.1 = [6 x i8] c" '%s'\00"
@.str.3 = [17 x i8] c"uname error: %s\0A\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.utsname
%4 = bitcast %struct.utsname* %3 to i8*
%5 = icmp eq i32 %0, 1
br i1 %5, label %20, label %6
6: ; preds = %2
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%8 = icmp sgt i32 %0, 1
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = zext i32 %0 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 1, %9 ], [ %16, %11 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = add nuw nsw i64 %12, 1
%17 = icmp eq i64 %16, %10
br i1 %17, label %18, label %11
18: ; preds = %11, %6
%19 = tail call i32 @putchar(i32 10)
br label %31
20: ; preds = %2
%21 = call i32 @uname(%struct.utsname* %3)
%22 = icmp eq i32 %21, 0
br i1 %22, label %27, label %23
23: ; preds = %20
%24 = load i32, i32* @errno
%25 = tail call i8* @strerror(i32 %24)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %25)
br label %31
27: ; preds = %20
%28 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 0
%29 = load i8*, i8** %28
%30 = tail call i32 @puts(i8* dereferenceable(1) %29)
br label %31
31: ; preds = %27, %23, %18
%32 = phi i32 [ -1, %18 ], [ -1, %23 ], [ 0, %27 ]
ret i32 %32
}