#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 */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ uint16_t;
typedef int /*<<< orphan*/ int8_t;
typedef int /*<<< orphan*/ int64_t;
typedef int /*<<< orphan*/ int32_t;
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int _stdint(char *, int, char *, int);
int main(int argc, char *argv[]) {
  int ret = 0;
  (void)argc;
  ret |= _stdint(argv[0], sizeof(int8_t), "int8_t", 1);
  ret |= _stdint(argv[0], sizeof(int16_t), "int16_t", 2);
  ret |= _stdint(argv[0], sizeof(int32_t), "int32_t", 4);
  ret |= _stdint(argv[0], sizeof(int64_t), "int64_t", 8);
  ret |= _stdint(argv[0], sizeof(uint8_t), "uint8_t", 1);
  ret |= _stdint(argv[0], sizeof(uint16_t), "uint16_t", 2);
  ret |= _stdint(argv[0], sizeof(uint32_t), "uint32_t", 4);
  ret |= _stdint(argv[0], sizeof(uint64_t), "uint64_t", 8);
  return (ret == 0) ? 0 : 2;
}


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)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x4,%esi
lea    0xec1(%rip),%rdx
mov    $0x1,%ecx
call   1030 <_stdint@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x4,%esi
lea    0xea6(%rip),%rdx
mov    $0x2,%ecx
call   1030 <_stdint@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x4,%ecx
lea    0xe8c(%rip),%rdx
mov    %ecx,%esi
call   1030 <_stdint@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x4,%esi
lea    0xe75(%rip),%rdx
mov    $0x8,%ecx
call   1030 <_stdint@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x4,%esi
lea    0xe37(%rip),%rdx
mov    $0x1,%ecx
call   1030 <_stdint@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x4,%esi
lea    0xe1c(%rip),%rdx
mov    $0x2,%ecx
call   1030 <_stdint@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x4,%ecx
lea    0xe02(%rip),%rdx
mov    %ecx,%esi
call   1030 <_stdint@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x4,%esi
lea    0xdeb(%rip),%rdx
mov    $0x8,%ecx
call   1030 <_stdint@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edx
mov    $0x2,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    (%rsi),%rdi
lea    0xed9(%rip),%rdx
mov    $0x4,%esi
mov    $0x1,%ecx
call   1030 <_stdint@plt>
mov    %eax,%ebp
mov    (%r12),%rdi
lea    0xec5(%rip),%rdx
mov    $0x4,%esi
mov    $0x2,%ecx
call   1030 <_stdint@plt>
mov    %eax,%r14d
or     %ebp,%r14d
mov    (%r12),%rdi
lea    0xeae(%rip),%rdx
mov    $0x4,%esi
mov    $0x4,%ecx
call   1030 <_stdint@plt>
mov    %eax,%r15d
mov    (%r12),%rdi
lea    0xe9a(%rip),%rdx
mov    $0x4,%esi
mov    $0x8,%ecx
call   1030 <_stdint@plt>
mov    %eax,%r13d
or     %r15d,%r13d
or     %r14d,%r13d
mov    (%r12),%rdi
lea    0xe5c(%rip),%rdx
mov    $0x4,%esi
mov    $0x1,%ecx
call   1030 <_stdint@plt>
mov    %eax,%r14d
mov    (%r12),%rdi
lea    0xe47(%rip),%rdx
mov    $0x4,%esi
mov    $0x2,%ecx
call   1030 <_stdint@plt>
mov    %eax,%ebx
or     %r14d,%ebx
mov    (%r12),%rdi
lea    0xe31(%rip),%rdx
mov    $0x4,%esi
mov    $0x4,%ecx
call   1030 <_stdint@plt>
mov    %eax,%ebp
or     %ebx,%ebp
or     %r13d,%ebp
mov    (%r12),%rdi
lea    0xe19(%rip),%rdx
mov    $0x4,%esi
mov    $0x8,%ecx
call   1030 <_stdint@plt>
xor    %ecx,%ecx
or     %ebp,%eax
setne  %cl
add    %ecx,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"int8_t\00"
@.str.1 = [8 x i8] c"int16_t\00"
@.str.2 = [8 x i8] c"int32_t\00"
@.str.3 = [8 x i8] c"int64_t\00"
@.str.4 = [8 x i8] c"uint8_t\00"
@.str.5 = [9 x i8] c"uint16_t\00"
@.str.6 = [9 x i8] c"uint32_t\00"
@.str.7 = [9 x i8] c"uint64_t\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 0
%10 = load i8*, i8** %9
%11 = call i32 @_stdint(i8* %10, i32 4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 1)
%12 = load i32, i32* %6
%13 = or i32 %12, %11
store i32 %13, i32* %6
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @_stdint(i8* %16, i32 4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 2)
%18 = load i32, i32* %6
%19 = or i32 %18, %17
store i32 %19, i32* %6
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 @_stdint(i8* %22, i32 4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 4)
%24 = load i32, i32* %6
%25 = or i32 %24, %23
store i32 %25, i32* %6
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 0
%28 = load i8*, i8** %27
%29 = call i32 @_stdint(i8* %28, i32 4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 8)
%30 = load i32, i32* %6
%31 = or i32 %30, %29
store i32 %31, i32* %6
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 0
%34 = load i8*, i8** %33
%35 = call i32 @_stdint(i8* %34, i32 4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 1)
%36 = load i32, i32* %6
%37 = or i32 %36, %35
store i32 %37, i32* %6
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 0
%40 = load i8*, i8** %39
%41 = call i32 @_stdint(i8* %40, i32 4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 2)
%42 = load i32, i32* %6
%43 = or i32 %42, %41
store i32 %43, i32* %6
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 0
%46 = load i8*, i8** %45
%47 = call i32 @_stdint(i8* %46, i32 4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32 4)
%48 = load i32, i32* %6
%49 = or i32 %48, %47
store i32 %49, i32* %6
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 0
%52 = load i8*, i8** %51
%53 = call i32 @_stdint(i8* %52, i32 4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 8)
%54 = load i32, i32* %6
%55 = or i32 %54, %53
store i32 %55, i32* %6
%56 = load i32, i32* %6
%57 = icmp eq i32 %56, 0
%58 = zext i1 %57 to i64
%59 = select i1 %57, i32 0, i32 2
ret i32 %59
}

LLVM IR (-O2):
@.str = [7 x i8] c"int8_t\00"
@.str.1 = [8 x i8] c"int16_t\00"
@.str.2 = [8 x i8] c"int32_t\00"
@.str.3 = [8 x i8] c"int64_t\00"
@.str.4 = [8 x i8] c"uint8_t\00"
@.str.5 = [9 x i8] c"uint16_t\00"
@.str.6 = [9 x i8] c"uint32_t\00"
@.str.7 = [9 x i8] c"uint64_t\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i32 @_stdint(i8* %3, i32 4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 1)
%5 = load i8*, i8** %1
%6 = tail call i32 @_stdint(i8* %5, i32 4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 2)
%7 = or i32 %6, %4
%8 = load i8*, i8** %1
%9 = tail call i32 @_stdint(i8* %8, i32 4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 4)
%10 = or i32 %7, %9
%11 = load i8*, i8** %1
%12 = tail call i32 @_stdint(i8* %11, i32 4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 8)
%13 = or i32 %10, %12
%14 = load i8*, i8** %1
%15 = tail call i32 @_stdint(i8* %14, i32 4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 1)
%16 = or i32 %13, %15
%17 = load i8*, i8** %1
%18 = tail call i32 @_stdint(i8* %17, i32 4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 2)
%19 = or i32 %16, %18
%20 = load i8*, i8** %1
%21 = tail call i32 @_stdint(i8* %20, i32 4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32 4)
%22 = or i32 %19, %21
%23 = load i8*, i8** %1
%24 = tail call i32 @_stdint(i8* %23, i32 4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 8)
%25 = or i32 %22, %24
%26 = icmp eq i32 %25, 0
%27 = select i1 %26, i32 0, i32 2
ret i32 %27
}