#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 user_isr() {
  static int i = 0;
  float a = 1e38;
  float b = 1e38;
  float c;
  printf("user_isr:\tbegin\n");
  if (i) {
    printf("user_isr:\tagain, will not trigger float exception\n");
    goto out;
  }
  i = 1;
  printf("user_isr:\tbefore float overflow\n");
  c = a * b;
  printf("user_isr:\tafter float overflow\n");
out:
  printf("user_isr:\tend\n");
}


x86 assembly (clang, -O0):
<user_isr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  0xee0(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  0xed3(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,0x2ee7(%rip)
je     115c <user_isr+0x4c>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
jmp    118d <user_isr+0x7d>
movl   $0x1,0x2ec6(%rip)
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
movss  -0x4(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<user_isr>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
cmpb   $0x0,0x2f08(%rip)
je     112f <user_isr+0x1f>
lea    0xf30(%rip),%rdi
jmp    1149 <user_isr+0x39>
movb   $0x1,0x2ef6(%rip)
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
lea    0xefa(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@user_isr.i = internal global i32 0
@.str = [17 x i8] c"user_isr:\09begin\0A\00"
@.str.1 = [51 x i8] c"user_isr:\09again, will not trigger float exception\0A\00"
@.str.2 = [33 x i8] c"user_isr:\09before float overflow\0A\00"
@.str.3 = [32 x i8] c"user_isr:\09after float overflow\0A\00"
@.str.4 = [15 x i8] c"user_isr:\09end\0A\00"
define void @user_isr() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
store float 0x47D2CED320000000, float* %1
store float 0x47D2CED320000000, float* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @user_isr.i
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
br label %15
9: ; preds = %0
store i32 1, i32* @user_isr.i
%10 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%11 = load float, float* %1
%12 = load float, float* %2
%13 = fmul float %11, %12
store float %13, float* %3
%14 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
br label %15
15: ; preds = %9, %7
%16 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@user_isr.i = internal unnamed_addr global i1 false
@str = [16 x i8] c"user_isr:\09begin\00"
@str.5 = [32 x i8] c"user_isr:\09before float overflow\00"
@str.6 = [31 x i8] c"user_isr:\09after float overflow\00"
@str.7 = [14 x i8] c"user_isr:\09end\00"
@str.8 = [50 x i8] c"user_isr:\09again, will not trigger float exception\00"
define void @user_isr() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%2 = load i1, i1* @user_isr.i
br i1 %2, label %5, label %3
3: ; preds = %0
store i1 true, i1* @user_isr.i
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.5, i64 0, i64 0))
br label %5
5: ; preds = %0, %3
%6 = phi i8* [ getelementptr inbounds ([31 x i8], [31 x i8]* @str.6, i64 0, i64 0), %3 ], [ getelementptr inbounds ([50 x i8], [50 x i8]* @str.8, i64 0, i64 0), %0 ]
%7 = tail call i32 @puts(i8* dereferenceable(1) %6)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.7, i64 0, i64 0))
ret void
}