#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 /*<<< orphan*/ FS460_image_request_freeze(int /*<<< orphan*/, int,
                                              int /*<<< orphan*/);
int /*<<< orphan*/ FS460_load_image(char *);
int /*<<< orphan*/ FS460_save_image(char *);
void bitmap_test(void) {
  static int mode = 0;
  switch (mode++) {
  default:
    mode = 1;
  case 0:
    FS460_save_image("test_out.bmp");
    break;
  case 1:
    FS460_load_image("test_in.bmp");
    break;
  case 2:
    FS460_image_request_freeze(0, 0x0002 | 0x0001, 0);
    break;
  }
}


x86 assembly (clang, -O0):
<bitmap_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2efe(%rip),%eax
mov    %eax,-0x4(%rbp)
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2ef0(%rip)
test   %eax,%eax
je     1185 <bitmap_test+0x55>
jmp    1159 <bitmap_test+0x29>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
je     1196 <bitmap_test+0x66>
jmp    116a <bitmap_test+0x3a>
mov    -0x4(%rbp),%eax
sub    $0x2,%eax
je     11a7 <bitmap_test+0x77>
jmp    117b <bitmap_test+0x4b>
movl   $0x1,0x2eb7(%rip)
lea    0xe74(%rip),%rdi
call   1040 <FS460_save_image@plt>
jmp    11b5 <bitmap_test+0x85>
lea    0xe70(%rip),%rdi
call   1050 <FS460_load_image@plt>
jmp    11b5 <bitmap_test+0x85>
xor    %edx,%edx
mov    $0x3,%esi
mov    %edx,%edi
call   1030 <FS460_image_request_freeze@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitmap_test>:
mov    0x2f06(%rip),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x2efd(%rip)
test   %eax,%eax
je     1171 <bitmap_test+0x41>
cmp    $0x1,%eax
je     115b <bitmap_test+0x2b>
cmp    $0x2,%eax
jne    1167 <bitmap_test+0x37>
xor    %edi,%edi
mov    $0x3,%esi
xor    %edx,%edx
jmp    1030 <FS460_image_request_freeze@plt>
lea    0xeab(%rip),%rdi
jmp    1050 <FS460_load_image@plt>
movl   $0x1,0x2ecb(%rip)
lea    0xe88(%rip),%rdi
jmp    1040 <FS460_save_image@plt>

LLVM IR (-O0):
@bitmap_test.mode = internal global i32 0
@.str = [13 x i8] c"test_out.bmp\00"
@.str.1 = [12 x i8] c"test_in.bmp\00"
define void @bitmap_test() {
%1 = load i32, i32* @bitmap_test.mode
%2 = add nsw i32 %1, 1
store i32 %2, i32* @bitmap_test.mode
switch i32 %1, label %3 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
]
3: ; preds = %0
store i32 1, i32* @bitmap_test.mode
br label %4
4: ; preds = %0, %3
%5 = call i32 @FS460_save_image(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %10
6: ; preds = %0
%7 = call i32 @FS460_load_image(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %10
8: ; preds = %0
%9 = call i32 @FS460_image_request_freeze(i32 0, i32 3, i32 0)
br label %10
10: ; preds = %8, %6, %4
ret void
}

LLVM IR (-O2):
@bitmap_test.mode = internal unnamed_addr global i32 0
@.str = [13 x i8] c"test_out.bmp\00"
@.str.1 = [12 x i8] c"test_in.bmp\00"
define void @bitmap_test() {
%1 = load i32, i32* @bitmap_test.mode
%2 = add nsw i32 %1, 1
store i32 %2, i32* @bitmap_test.mode
switch i32 %1, label %3 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
]
3: ; preds = %0
store i32 1, i32* @bitmap_test.mode
br label %4
4: ; preds = %0, %3
%5 = tail call i32 @FS460_save_image(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %10
6: ; preds = %0
%7 = tail call i32 @FS460_load_image(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %10
8: ; preds = %0
%9 = tail call i32 @FS460_image_request_freeze(i32 0, i32 3, i32 0)
br label %10
10: ; preds = %8, %6, %4
ret void
}