#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 SIGINT;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ ued_goto_lastrow();
int /*<<< orphan*/ ued_rest_cursor_pos();
int /*<<< orphan*/ ued_save_cursor_pos();
void ued_sig_hand(int sig_num) {
  if (sig_num == SIGINT) {
    ued_save_cursor_pos();
    ued_goto_lastrow();
    printf("\033[2K");
    printf("Type :quit<Enter> to exit %s", "micro editor");
    ued_rest_cursor_pos();
  }
}


x86 assembly (clang, -O0):
<ued_sig_hand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2e93(%rip),%rcx
cmp    (%rcx),%eax
jne    1195 <ued_sig_hand+0x55>
mov    $0x0,%al
call   1060 <ued_save_cursor_pos@plt>
mov    $0x0,%al
call   1050 <ued_goto_lastrow@plt>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe85(%rip),%rdi
lea    0xe9b(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <ued_rest_cursor_pos@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ued_sig_hand>:
push   %rax
mov    0x2ea0(%rip),%rax
cmp    %edi,(%rax)
jne    1185 <ued_sig_hand+0x45>
xor    %eax,%eax
call   1060 <ued_save_cursor_pos@plt>
xor    %eax,%eax
call   1050 <ued_goto_lastrow@plt>
lea    0xe9f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe96(%rip),%rdi
lea    0xeac(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <ued_rest_cursor_pos@plt>
pop    %rax
ret

LLVM IR (-O0):
@SIGINT = global i32 0
@.str = [5 x i8] c"\1B[2K\00"
@.str.1 = [29 x i8] c"Type :quit<Enter> to exit %s\00"
@.str.2 = [13 x i8] c"micro editor\00"
define void @ued_sig_hand(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGINT
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = call i32 (...) @ued_save_cursor_pos()
%8 = call i32 (...) @ued_goto_lastrow()
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (...) @ued_rest_cursor_pos()
br label %12
12: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@SIGINT = global i32 0
@.str = [5 x i8] c"\1B[2K\00"
@.str.1 = [29 x i8] c"Type :quit<Enter> to exit %s\00"
@.str.2 = [13 x i8] c"micro editor\00"
define void @ued_sig_hand(i32 %0) {
%2 = load i32, i32* @SIGINT
%3 = icmp eq i32 %2, %0
br i1 %3, label %4, label %10
4: ; preds = %1
%5 = tail call i32 (...) @ued_save_cursor_pos()
%6 = tail call i32 (...) @ued_goto_lastrow()
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 (...) @ued_rest_cursor_pos()
br label %10
10: ; preds = %4, %1
ret void
}