#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 uint32_t;

/* Variables and functions */
int pack_int8(uint8_t *int8, uint8_t *outbuf, uint32_t *outsize) {
  if ((NULL == int8) || (NULL == outbuf) || (NULL == outsize)) {
    return -1;
  }
  if (1 > *outsize) {
    return -1;
  }
  *outsize = 1;
  *outbuf = *int8;
  return 0;
}


x86 assembly (clang, -O0):
<pack_int8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
je     1134 <pack_int8+0x34>
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
je     1134 <pack_int8+0x34>
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
jne    1140 <pack_int8+0x40>
movl   $0xffffffff,-0x4(%rbp)
jmp    117a <pack_int8+0x7a>
mov    -0x20(%rbp),%rcx
mov    $0x1,%eax
cmp    (%rcx),%eax
jle    115d <pack_int8+0x5d>
movl   $0xffffffff,-0x4(%rbp)
jmp    117a <pack_int8+0x7a>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pack_int8>:
mov    $0xffffffff,%eax
test   %rdi,%rdi
je     1125 <pack_int8+0x25>
test   %rsi,%rsi
je     1125 <pack_int8+0x25>
test   %rdx,%rdx
je     1125 <pack_int8+0x25>
cmpl   $0x0,(%rdx)
jle    1125 <pack_int8+0x25>
movl   $0x1,(%rdx)
mov    (%rdi),%eax
mov    %eax,(%rsi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @pack_int8(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
%8 = load i32*, i32** %5
%9 = icmp eq i32* null, %8
br i1 %9, label %16, label %10
10: ; preds = %3
%11 = load i32*, i32** %6
%12 = icmp eq i32* null, %11
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i32*, i32** %7
%15 = icmp eq i32* null, %14
br i1 %15, label %16, label %17
16: ; preds = %13, %10, %3
store i32 -1, i32* %4
br label %27
17: ; preds = %13
%18 = load i32*, i32** %7
%19 = load i32, i32* %18
%20 = icmp sgt i32 1, %19
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 -1, i32* %4
br label %27
22: ; preds = %17
%23 = load i32*, i32** %7
store i32 1, i32* %23
%24 = load i32*, i32** %5
%25 = load i32, i32* %24
%26 = load i32*, i32** %6
store i32 %25, i32* %26
store i32 0, i32* %4
br label %27
27: ; preds = %22, %21, %16
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
define i32 @pack_int8(i32* %0, i32* writeonly %1, i32* %2) {
%4 = icmp eq i32* %0, null
%5 = icmp eq i32* %1, null
%6 = or i1 %4, %5
%7 = icmp eq i32* %2, null
%8 = or i1 %6, %7
br i1 %8, label %14, label %9
9: ; preds = %3
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 1
br i1 %11, label %14, label %12
12: ; preds = %9
store i32 1, i32* %2
%13 = load i32, i32* %0
store i32 %13, i32* %1
br label %14
14: ; preds = %9, %3, %12
%15 = phi i32 [ 0, %12 ], [ -1, %3 ], [ -1, %9 ]
ret i32 %15
}