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

/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
scalar_t__ strncmp(int /*<<< orphan*/, char const *, int /*<<< orphan*/);
int uname(struct utsname *);
int is_32bit_system() {
  struct utsname sys_info;
  int uname_res = uname(&sys_info);
  if (uname_res != 0) {
    return 1;
  }
  const char arch_64[] = "x86_64";
  if (strncmp(sys_info.machine, arch_64, strlen(arch_64)) == 0) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_32bit_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x8(%rbp),%rdi
call   1050 <uname@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     115a <is_32bit_system+0x2a>
movl   $0x1,-0x4(%rbp)
jmp    11b9 <is_32bit_system+0x89>
mov    0xea0(%rip),%eax
mov    %eax,-0x13(%rbp)
mov    0xe9a(%rip),%ax
mov    %ax,-0xf(%rbp)
mov    0xe92(%rip),%al
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
lea    -0x13(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x13(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11b2 <is_32bit_system+0x82>
movl   $0x0,-0x4(%rbp)
jmp    11b9 <is_32bit_system+0x89>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_32bit_system>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
call   1050 <uname@plt>
mov    %eax,%ecx
mov    $0x1,%eax
test   %ecx,%ecx
jne    1184 <is_32bit_system+0x54>
movl   $0x34365f,0x13(%rsp)
movl   $0x5f363878,0x10(%rsp)
5f
mov    0x8(%rsp),%ebx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.utsname = type { i32 }
@__const.is_32bit_system.arch_64 = [7 x i8] c"x86_64\00"
define i32 @is_32bit_system() {
%1 = alloca i32
%2 = alloca %struct.utsname
%3 = alloca i32
%4 = alloca [7 x i8]
%5 = call i32 @uname(%struct.utsname* %2)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %0
store i32 1, i32* %1
br label %20
9: ; preds = %0
%10 = bitcast [7 x i8]* %4 to i8*
%11 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i32 0, i32 0
%12 = load i32, i32* %11
%13 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
%14 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
%16 = call i64 @strncmp(i32 %12, i8* %13, i32 %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %9
store i32 0, i32* %1
br label %20
19: ; preds = %9
store i32 1, i32* %1
br label %20
20: ; preds = %19, %18, %8
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
%struct.utsname = type { i32 }
@__const.is_32bit_system.arch_64 = [7 x i8] c"x86_64\00"
define i32 @is_32bit_system() {
%1 = alloca %struct.utsname
%2 = alloca [7 x i8]
%3 = bitcast %struct.utsname* %1 to i8*
%4 = call i32 @uname(%struct.utsname* %1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %14
6: ; preds = %0
%7 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 0
%9 = load i32, i32* %8
%10 = call i32 @strlen(i8* %7)
%11 = call i64 @strncmp(i32 %9, i8* %7, i32 %10)
%12 = icmp ne i64 %11, 0
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %0, %6
%15 = phi i32 [ %13, %6 ], [ 1, %0 ]
ret i32 %15
}