#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*/ SIGINT;
int /*<<< orphan*/ SIGQUIT;
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int main(void) {
  int i;
  signal(SIGINT, SIG_IGN);
  signal(SIGQUIT, SIG_IGN);
  for (i = 20; i > 0; i--) {
    sleep(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
call   1030 <signal@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
mov    0x2e82(%rip),%rax
mov    (%rax),%esi
call   1030 <signal@plt>
movl   $0x14,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1186 <main+0x66>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1164 <main+0x44>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
mov    0x2ea7(%rip),%rbx
mov    (%rbx),%esi
call   1030 <signal@plt>
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%esi
call   1030 <signal@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@SIGINT = global i32 0
@SIG_IGN = global i32 0
@SIGQUIT = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @SIGINT
%4 = load i32, i32* @SIG_IGN
%5 = call i32 @signal(i32 %3, i32 %4)
%6 = load i32, i32* @SIGQUIT
%7 = load i32, i32* @SIG_IGN
%8 = call i32 @signal(i32 %6, i32 %7)
store i32 20, i32* %2
br label %9
9: ; preds = %14, %0
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = call i32 @sleep(i32 1)
br label %14
14: ; preds = %12
%15 = load i32, i32* %2
%16 = add nsw i32 %15, -1
store i32 %16, i32* %2
br label %9
17: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@SIGINT = global i32 0
@SIG_IGN = global i32 0
@SIGQUIT = global i32 0
define i32 @main() {
%1 = load i32, i32* @SIGINT
%2 = load i32, i32* @SIG_IGN
%3 = tail call i32 @signal(i32 %1, i32 %2)
%4 = load i32, i32* @SIGQUIT
%5 = load i32, i32* @SIG_IGN
%6 = tail call i32 @signal(i32 %4, i32 %5)
%7 = tail call i32 @sleep(i32 1)
%8 = tail call i32 @sleep(i32 1)
%9 = tail call i32 @sleep(i32 1)
%10 = tail call i32 @sleep(i32 1)
%11 = tail call i32 @sleep(i32 1)
%12 = tail call i32 @sleep(i32 1)
%13 = tail call i32 @sleep(i32 1)
%14 = tail call i32 @sleep(i32 1)
%15 = tail call i32 @sleep(i32 1)
%16 = tail call i32 @sleep(i32 1)
%17 = tail call i32 @sleep(i32 1)
%18 = tail call i32 @sleep(i32 1)
%19 = tail call i32 @sleep(i32 1)
%20 = tail call i32 @sleep(i32 1)
%21 = tail call i32 @sleep(i32 1)
%22 = tail call i32 @sleep(i32 1)
%23 = tail call i32 @sleep(i32 1)
%24 = tail call i32 @sleep(i32 1)
%25 = tail call i32 @sleep(i32 1)
%26 = tail call i32 @sleep(i32 1)
ret i32 0
}