#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 */
void *bmp_to_buffer(char const *, int, int, int);
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ save_bmp(char const *, int, int, void *, int);
void test_bmp_to_buffer_1(const char *path, const char *outpath, int w, int h,
                          int bpp) {
  void *buffer = NULL;
  buffer = bmp_to_buffer(path, w, h, bpp);
  if (buffer) {
    save_bmp(outpath, w, h, buffer, bpp);
    free(buffer);
  }
}


x86 assembly (clang, -O0):
<test_bmp_to_buffer_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   1050 <bmp_to_buffer@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1193 <test_bmp_to_buffer_1+0x63>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
call   1040 <save_bmp@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_bmp_to_buffer_1>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r14d
mov    %ecx,%r12d
mov    %edx,%ebx
mov    %rsi,%r15
mov    %edx,%esi
mov    %ecx,%edx
mov    %r8d,%ecx
call   1050 <bmp_to_buffer@plt>
test   %rax,%rax
je     117a <test_bmp_to_buffer_1+0x4a>
mov    %rax,%rbp
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r12d,%edx
mov    %rax,%rcx
mov    %r14d,%r8d
call   1040 <save_bmp@plt>
mov    %rbp,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @test_bmp_to_buffer_1(i8* %0, i8* %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i8* @bmp_to_buffer(i8* %0, i32 %2, i32 %3, i32 %4)
%7 = icmp eq i8* %6, null
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = tail call i32 @save_bmp(i8* %1, i32 %2, i32 %3, i8* %6, i32 %4)
%10 = tail call i32 @free(i8* %6)
br label %11
11: ; preds = %8, %5
ret void
}