#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 zint_symbol {
  int dummy;
};

/* Variables and functions */
int ZBarcode_Buffer(struct zint_symbol *, int);
int ZBarcode_Encode(struct zint_symbol *, unsigned char *, int);
int ZBarcode_Encode_and_Buffer(struct zint_symbol *symbol, unsigned char *input,
                               int length, int rotate_angle) {
  int error_number;
  int first_err;
  error_number = ZBarcode_Encode(symbol, input, length);
  if (error_number >= 5) {
    return error_number;
  }
  first_err = error_number;
  error_number = ZBarcode_Buffer(symbol, rotate_angle);
  if (error_number == 0) {
    error_number = first_err;
  }
  return error_number;
}


x86 assembly (clang, -O0):
<ZBarcode_Encode_and_Buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <ZBarcode_Encode@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jl     115e <ZBarcode_Encode_and_Buffer+0x3e>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1189 <ZBarcode_Encode_and_Buffer+0x69>
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1040 <ZBarcode_Buffer@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    1183 <ZBarcode_Encode_and_Buffer+0x63>
mov    -0x28(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ZBarcode_Encode_and_Buffer>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %rdi,%rbx
call   1030 <ZBarcode_Encode@plt>
mov    %eax,%ebp
cmp    $0x4,%eax
jg     1146 <ZBarcode_Encode_and_Buffer+0x26>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1040 <ZBarcode_Buffer@plt>
test   %eax,%eax
cmovne %eax,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.zint_symbol = type { i32 }
define i32 @ZBarcode_Encode_and_Buffer(%struct.zint_symbol* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca %struct.zint_symbol*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store %struct.zint_symbol* %0, %struct.zint_symbol** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%12 = load %struct.zint_symbol*, %struct.zint_symbol** %6
%13 = load i8*, i8** %7
%14 = load i32, i32* %8
%15 = call i32 @ZBarcode_Encode(%struct.zint_symbol* %12, i8* %13, i32 %14)
store i32 %15, i32* %10
%16 = load i32, i32* %10
%17 = icmp sge i32 %16, 5
br i1 %17, label %18, label %20
18: ; preds = %4
%19 = load i32, i32* %10
store i32 %19, i32* %5
br label %31
20: ; preds = %4
%21 = load i32, i32* %10
store i32 %21, i32* %11
%22 = load %struct.zint_symbol*, %struct.zint_symbol** %6
%23 = load i32, i32* %9
%24 = call i32 @ZBarcode_Buffer(%struct.zint_symbol* %22, i32 %23)
store i32 %24, i32* %10
%25 = load i32, i32* %10
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %20
%28 = load i32, i32* %11
store i32 %28, i32* %10
br label %29
29: ; preds = %27, %20
%30 = load i32, i32* %10
store i32 %30, i32* %5
br label %31
31: ; preds = %29, %18
%32 = load i32, i32* %5
ret i32 %32
}

LLVM IR (-O2):
%struct.zint_symbol = type { i32 }
define i32 @ZBarcode_Encode_and_Buffer(%struct.zint_symbol* %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 @ZBarcode_Encode(%struct.zint_symbol* %0, i8* %1, i32 %2)
%6 = icmp sgt i32 %5, 4
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = tail call i32 @ZBarcode_Buffer(%struct.zint_symbol* %0, i32 %3)
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 %5, i32 %8
br label %11
11: ; preds = %4, %7
%12 = phi i32 [ %10, %7 ], [ %5, %4 ]
ret i32 %12
}