#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 regionstruct {
  int dummy;
};
struct pixelstruct {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ generate_picture(struct regionstruct *, int, int, int, int,
                                    int, int, int, int, int);
int max_height(struct regionstruct *, int *, int *);
int max_width(struct regionstruct *, int *, int *);
void make_pic_from_region(struct regionstruct *preg, int n, int begbit,
                          int endbit) {
  int i, j, k, l, width, height, minx, maxx, miny, maxy;
  struct pixelstruct *pix;
  width = max_width(preg, &minx, &maxx);
  height = max_height(preg, &miny, &maxy);
  generate_picture(preg, n, width, minx, maxx, height, miny, maxy, begbit,
                   endbit);
}


x86 assembly (clang, -O0):
<make_pic_from_region>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x68,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x38(%rbp),%rsi
lea    -0x3c(%rbp),%rdx
call   1050 <max_width@plt>
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x44(%rbp),%rdx
call   1040 <max_height@plt>
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x30(%rbp),%edx
mov    -0x38(%rbp),%ecx
mov    -0x3c(%rbp),%r8d
mov    -0x34(%rbp),%r9d
mov    -0x40(%rbp),%ebx
mov    -0x44(%rbp),%r11d
mov    -0x18(%rbp),%r10d
mov    -0x1c(%rbp),%eax
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1030 <generate_picture@plt>
add    $0x68,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_pic_from_region>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%r15d
mov    %edx,%r14d
mov    %esi,%r12d
mov    %rdi,%rbx
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1050 <max_width@plt>
mov    %eax,%r13d
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1040 <max_height@plt>
mov    0x14(%rsp),%ecx
mov    0x10(%rsp),%r8d
mov    0xc(%rsp),%r10d
mov    0x8(%rsp),%ebp
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r13d,%edx
mov    %eax,%r9d
push   %r15
push   %r14
push   %rbp
push   %r10
call   1030 <generate_picture@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.regionstruct = type { i32 }
%struct.pixelstruct = type { i32 }
define void @make_pic_from_region(%struct.regionstruct* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca %struct.regionstruct*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca %struct.pixelstruct*
store %struct.regionstruct* %0, %struct.regionstruct** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%20 = load %struct.regionstruct*, %struct.regionstruct** %5
%21 = call i32 @max_width(%struct.regionstruct* %20, i32* %15, i32* %16)
store i32 %21, i32* %13
%22 = load %struct.regionstruct*, %struct.regionstruct** %5
%23 = call i32 @max_height(%struct.regionstruct* %22, i32* %17, i32* %18)
store i32 %23, i32* %14
%24 = load %struct.regionstruct*, %struct.regionstruct** %5
%25 = load i32, i32* %6
%26 = load i32, i32* %13
%27 = load i32, i32* %15
%28 = load i32, i32* %16
%29 = load i32, i32* %14
%30 = load i32, i32* %17
%31 = load i32, i32* %18
%32 = load i32, i32* %7
%33 = load i32, i32* %8
%34 = call i32 @generate_picture(%struct.regionstruct* %24, i32 %25, i32 %26, i32 %27, i32 %28, i32 %29, i32 %30, i32 %31, i32 %32, i32 %33)
ret void
}

LLVM IR (-O2):
%struct.regionstruct = type { i32 }
%struct.pixelstruct = type { i32 }
define void @make_pic_from_region(%struct.regionstruct* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = bitcast i32* %7 to i8*
%12 = bitcast i32* %8 to i8*
%13 = call i32 @max_width(%struct.regionstruct* %0, i32* %5, i32* %6)
%14 = call i32 @max_height(%struct.regionstruct* %0, i32* %7, i32* %8)
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = load i32, i32* %7
%18 = load i32, i32* %8
%19 = call i32 @generate_picture(%struct.regionstruct* %0, i32 %1, i32 %13, i32 %15, i32 %16, i32 %14, i32 %17, i32 %18, i32 %2, i32 %3)
ret void
}