#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 */
typedef int /*<<< orphan*/ tmp_val;

/* Variables and functions */
int /*<<< orphan*/ get_string(char *, char *, int);
int /*<<< orphan*/ html_screenshot(char *, int /*<<< orphan*/);
int /*<<< orphan*/ msg_print(char *);
int /*<<< orphan*/ my_strcpy(char *, char *, int);
void do_cmd_save_screen(void) {
  char tmp_val[256];
  my_strcpy(tmp_val, "dump.html", sizeof(tmp_val));
  if (!get_string("File: ", tmp_val, sizeof(tmp_val)))
    return;
  html_screenshot(tmp_val, 0);
  msg_print("Dump saved.");
}


x86 assembly (clang, -O0):
<do_cmd_save_screen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
lea    -0x100(%rbp),%rdi
lea    0xea7(%rip),%rsi
mov    $0x100,%edx
call   1040 <my_strcpy@plt>
lea    -0x100(%rbp),%rsi
lea    0xe99(%rip),%rdi
mov    $0x100,%edx
call   1050 <get_string@plt>
cmp    $0x0,%eax
jne    1189 <do_cmd_save_screen+0x49>
jmp    11a3 <do_cmd_save_screen+0x63>
lea    -0x100(%rbp),%rdi
xor    %esi,%esi
call   1030 <html_screenshot@plt>
lea    0xe73(%rip),%rdi
call   1060 <msg_print@plt>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_cmd_save_screen>:
push   %rbx
sub    $0x100,%rsp
lea    0xeb1(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x100,%edx
call   1040 <my_strcpy@plt>
lea    0xea4(%rip),%rdi
mov    %rbx,%rsi
mov    $0x100,%edx
call   1050 <get_string@plt>
test   %eax,%eax
je     118d <do_cmd_save_screen+0x4d>
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <html_screenshot@plt>
lea    0xe89(%rip),%rdi
call   1060 <msg_print@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"dump.html\00"
@.str.1 = [7 x i8] c"File: \00"
@.str.2 = [12 x i8] c"Dump saved.\00"
define void @do_cmd_save_screen() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @my_strcpy(i8* %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 256)
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%5 = call i32 @get_string(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 256)
%6 = icmp ne i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %0
br label %12
8: ; preds = %0
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%10 = call i32 @html_screenshot(i8* %9, i32 0)
%11 = call i32 @msg_print(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %8, %7
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"dump.html\00"
@.str.1 = [7 x i8] c"File: \00"
@.str.2 = [12 x i8] c"Dump saved.\00"
define void @do_cmd_save_screen() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @my_strcpy(i8* %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 256)
%4 = call i32 @get_string(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 256)
%5 = icmp eq i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %0
%7 = call i32 @html_screenshot(i8* %2, i32 0)
%8 = call i32 @msg_print(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %0, %6
ret void
}