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

/* Variables and functions */
int /*<<< orphan*/ imgSetPixelBuffer(struct imgImage *, void *, int);
int imgSetAllPixelBuffers(struct imgImage *img, void *buffer0, void *buffer1,
                          void *buffer2, void *buffer3) {
  if (!img)
    return -1;
  imgSetPixelBuffer(img, buffer0, 0);
  imgSetPixelBuffer(img, buffer1, 1);
  imgSetPixelBuffer(img, buffer2, 2);
  imgSetPixelBuffer(img, buffer3, 3);
  return 0;
}


x86 assembly (clang, -O0):
<imgSetAllPixelBuffers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1143 <imgSetAllPixelBuffers+0x33>
movl   $0xffffffff,-0x4(%rbp)
jmp    118f <imgSetAllPixelBuffers+0x7f>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
xor    %edx,%edx
call   1030 <imgSetPixelBuffer@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x1,%edx
call   1030 <imgSetPixelBuffer@plt>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x2,%edx
call   1030 <imgSetPixelBuffer@plt>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    $0x3,%edx
call   1030 <imgSetPixelBuffer@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imgSetAllPixelBuffers>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %rdi,%rdi
je     1165 <imgSetAllPixelBuffers+0x55>
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%rbp
mov    %rdi,%rbx
xor    %r12d,%r12d
xor    %edx,%edx
call   1030 <imgSetPixelBuffer@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x1,%edx
call   1030 <imgSetPixelBuffer@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x2,%edx
call   1030 <imgSetPixelBuffer@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3,%edx
call   1030 <imgSetPixelBuffer@plt>
jmp    116b <imgSetAllPixelBuffers+0x5b>
mov    $0xffffffff,%r12d
mov    %r12d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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