#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*/ printf(char *);
void sigint(int signo) {
  int i, j;
  volatile int k;
  printf("sigint starting\n");
  for (i = 0; i < 400000; i++)
    for (j = 0; j < 3000; j++)
      k += i * j;
  printf("sigint finished\n");
}


x86 assembly (clang, -O0):
<sigint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x61a80,-0x8(%rbp)
jge    117f <sigint+0x6f>
movl   $0x0,-0xc(%rbp)
cmpl   $0xbb8,-0xc(%rbp)
jge    116c <sigint+0x5c>
mov    -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1142 <sigint+0x32>
jmp    1171 <sigint+0x61>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112e <sigint+0x1e>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigint>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %r8d,%r8d
xor    %r9d,%r9d
xor    %r10d,%r10d
xor    %esi,%esi
xor    %edi,%edi
nopw   0x0(%rax,%rax,1)
mov    $0xbb8,%eax
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
add    %ecx,0x4(%rsp)
lea    (%rdi,%rcx,1),%edx
add    %edx,0x4(%rsp)
lea    (%r8,%rcx,1),%edx
add    %edx,0x4(%rsp)
lea    (%r9,%rcx,1),%edx
add    %edx,0x4(%rsp)
lea    (%rsi,%rcx,1),%edx
add    %edx,0x4(%rsp)
add    %r10d,%ecx
add    $0xfffffffb,%eax
jne    1140 <sigint+0x30>
add    $0x1,%edi
add    $0x4,%esi
add    $0x5,%r10d
add    $0x3,%r9d
add    $0x2,%r8d
cmp    $0x61a80,%edi
jne    1130 <sigint+0x20>
lea    0xe85(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"sigint starting\0A\00"
@.str.1 = [17 x i8] c"sigint finished\0A\00"
define void @sigint(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %7
7: ; preds = %24, %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 400000
br i1 %9, label %10, label %27
10: ; preds = %7
store i32 0, i32* %4
br label %11
11: ; preds = %20, %10
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 3000
br i1 %13, label %14, label %23
14: ; preds = %11
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = mul nsw i32 %15, %16
%18 = load volatile i32, i32* %5
%19 = add nsw i32 %18, %17
store volatile i32 %19, i32* %5
br label %20
20: ; preds = %14
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
br label %11
23: ; preds = %11
br label %24
24: ; preds = %23
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %7
27: ; preds = %7
%28 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [16 x i8] c"sigint starting\00"
@str.2 = [16 x i8] c"sigint finished\00"
define void @sigint(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %1, %30
%6 = phi i32 [ 0, %1 ], [ %31, %30 ]
br label %7
7: ; preds = %7, %5
%8 = phi i32 [ 0, %5 ], [ %28, %7 ]
%9 = mul nuw nsw i32 %8, %6
%10 = load volatile i32, i32* %2
%11 = add nsw i32 %10, %9
store volatile i32 %11, i32* %2
%12 = add nuw nsw i32 %8, 1
%13 = mul nuw nsw i32 %12, %6
%14 = load volatile i32, i32* %2
%15 = add nsw i32 %14, %13
store volatile i32 %15, i32* %2
%16 = add nuw nsw i32 %8, 2
%17 = mul nuw nsw i32 %16, %6
%18 = load volatile i32, i32* %2
%19 = add nsw i32 %18, %17
store volatile i32 %19, i32* %2
%20 = add nuw nsw i32 %8, 3
%21 = mul nuw nsw i32 %20, %6
%22 = load volatile i32, i32* %2
%23 = add nsw i32 %22, %21
store volatile i32 %23, i32* %2
%24 = add nuw nsw i32 %8, 4
%25 = mul nuw nsw i32 %24, %6
%26 = load volatile i32, i32* %2
%27 = add nsw i32 %26, %25
store volatile i32 %27, i32* %2
%28 = add nuw nsw i32 %8, 5
%29 = icmp eq i32 %28, 3000
br i1 %29, label %30, label %7
30: ; preds = %7
%31 = add nuw nsw i32 %6, 1
%32 = icmp eq i32 %31, 400000
br i1 %32, label %33, label %5
33: ; preds = %30
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.2, i64 0, i64 0))
ret void
}