#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 */

/* Variables and functions */
int draw_block4x4_rgtc1_shared(unsigned char const *, unsigned int *, int, int);
int /*<<< orphan*/ memset(unsigned int *, int /*<<< orphan*/, int);
int draw_block4x4_rgtc2(const unsigned char *bitstring,
                        unsigned int *image_buffer, int flags) {
  memset(image_buffer, 0, 64);
  int r = draw_block4x4_rgtc1_shared(bitstring, image_buffer, 0, flags);
  if (r == 0)
    return 0;
  return draw_block4x4_rgtc1_shared(&bitstring[8], image_buffer, 1, flags);
}


x86 assembly (clang, -O0):
<draw_block4x4_rgtc2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1030 <memset@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%ecx
xor    %edx,%edx
call   1040 <draw_block4x4_rgtc1_shared@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    116e <draw_block4x4_rgtc2+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    118a <draw_block4x4_rgtc2+0x6a>
mov    -0x10(%rbp),%rdi
add    $0x8,%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%ecx
mov    $0x1,%edx
call   1040 <draw_block4x4_rgtc1_shared@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_block4x4_rgtc2>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1030 <memset@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    %r14d,%ecx
call   1040 <draw_block4x4_rgtc1_shared@plt>
test   %eax,%eax
je     116b <draw_block4x4_rgtc2+0x4b>
add    $0x8,%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
mov    %r14d,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <draw_block4x4_rgtc1_shared@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @draw_block4x4_rgtc2(i8* %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
%9 = load i32*, i32** %6
%10 = call i32 @memset(i32* %9, i32 0, i32 64)
%11 = load i8*, i8** %5
%12 = load i32*, i32** %6
%13 = load i32, i32* %7
%14 = call i32 @draw_block4x4_rgtc1_shared(i8* %11, i32* %12, i32 0, i32 %13)
store i32 %14, i32* %8
%15 = load i32, i32* %8
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %3
store i32 0, i32* %4
br label %24
18: ; preds = %3
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i64 8
%21 = load i32*, i32** %6
%22 = load i32, i32* %7
%23 = call i32 @draw_block4x4_rgtc1_shared(i8* %20, i32* %21, i32 1, i32 %22)
store i32 %23, i32* %4
br label %24
24: ; preds = %18, %17
%25 = load i32, i32* %4
ret i32 %25
}

LLVM IR (-O2):
define i32 @draw_block4x4_rgtc2(i8* %0, i32* %1, i32 %2) {
%4 = tail call i32 @memset(i32* %1, i32 0, i32 64)
%5 = tail call i32 @draw_block4x4_rgtc1_shared(i8* %0, i32* %1, i32 0, i32 %2)
%6 = icmp eq i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %0, i64 8
%9 = tail call i32 @draw_block4x4_rgtc1_shared(i8* %8, i32* %1, i32 1, i32 %2)
br label %10
10: ; preds = %3, %7
%11 = phi i32 [ %9, %7 ], [ 0, %3 ]
ret i32 %11
}