#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 */
struct __UTAC__EXCEPTION {
  int dummy;
};
struct __UTAC__CFLOW_FUNC {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __utac__exception__cf_handler_free(void *);
int stub1(int, int);
void __utac__exception__cf_handler_reset(void *exception) {
  struct __UTAC__EXCEPTION *excep;
  struct __UTAC__CFLOW_FUNC *cf;
  unsigned long __cil_tmp5;
  unsigned long __cil_tmp6;
  struct __UTAC__CFLOW_FUNC *__cil_tmp7;
  unsigned long __cil_tmp8;
  unsigned long __cil_tmp9;
  int (*__cil_tmp10)(int, int);
  unsigned long __cil_tmp11;
  unsigned long __cil_tmp12;
  int __cil_tmp13;
  unsigned long __cil_tmp14;
  unsigned long __cil_tmp15;
  struct __UTAC__CFLOW_FUNC **mem_16;
  int (**mem_17)(int, int);
  int *mem_18;
  struct __UTAC__CFLOW_FUNC **mem_19;
  {
    excep = (struct __UTAC__EXCEPTION *)exception;
    __cil_tmp5 = (unsigned long)excep;
    __cil_tmp6 = __cil_tmp5 + 24;
    mem_16 = (struct __UTAC__CFLOW_FUNC **)__cil_tmp6;
    cf = *mem_16;
    {
      while (1) {
      while_6_continue:;
        {
          __cil_tmp7 = (struct __UTAC__CFLOW_FUNC *)0;
          __cil_tmp8 = (unsigned long)__cil_tmp7;
          __cil_tmp9 = (unsigned long)cf;
          if (__cil_tmp9 != __cil_tmp8) {
          } else {
            goto while_6_break;
          }
        }
        {
          mem_17 = (int (**)(int, int))cf;
          __cil_tmp10 = *mem_17;
          __cil_tmp11 = (unsigned long)cf;
          __cil_tmp12 = __cil_tmp11 + 8;
          mem_18 = (int *)__cil_tmp12;
          __cil_tmp13 = *mem_18;
          (*__cil_tmp10)(4, __cil_tmp13);
          __cil_tmp14 = (unsigned long)cf;
          __cil_tmp15 = __cil_tmp14 + 16;
          mem_19 = (struct __UTAC__CFLOW_FUNC **)__cil_tmp15;
          cf = *mem_19;
        }
      }
    while_6_break:;
    }
    { __utac__exception__cf_handler_free(exception); }
    return;
  }
}


x86 assembly (clang, -O0):
<__utac__exception__cf_handler_reset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x18,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1153 <__utac__exception__cf_handler_reset+0x43>
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x38(%rbp),%rax
je     117e <__utac__exception__cf_handler_reset+0x6e>
jmp    1183 <__utac__exception__cf_handler_reset+0x73>
jmp    1201 <__utac__exception__cf_handler_reset+0xf1>
mov    -0x18(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x48(%rbp),%rax
mov    -0x5c(%rbp),%esi
mov    $0x4,%edi
call   *%rax
mov    -0x18(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x90(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    114e <__utac__exception__cf_handler_reset+0x3e>
mov    -0x8(%rbp),%rdi
call   1030 <__utac__exception__cf_handler_free@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__utac__exception__cf_handler_reset>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    0x18(%rdi),%rbx
test   %rbx,%rbx
je     1133 <__utac__exception__cf_handler_reset+0x23>
mov    0x8(%rbx),%esi
mov    $0x4,%edi
call   *(%rbx)
mov    0x10(%rbx),%rbx
test   %rbx,%rbx
jne    1120 <__utac__exception__cf_handler_reset+0x10>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <__utac__exception__cf_handler_free@plt>

LLVM IR (-O0):
%struct.__UTAC__EXCEPTION = type { i32 }
%struct.__UTAC__CFLOW_FUNC = type { i32 }
define void @__utac__exception__cf_handler_reset(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.__UTAC__EXCEPTION*
%4 = alloca %struct.__UTAC__CFLOW_FUNC*
%5 = alloca i64
%6 = alloca i64
%7 = alloca %struct.__UTAC__CFLOW_FUNC*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32 (i32, i32)*
%11 = alloca i64
%12 = alloca i64
%13 = alloca i32
%14 = alloca i64
%15 = alloca i64
%16 = alloca %struct.__UTAC__CFLOW_FUNC**
%17 = alloca i32 (i32, i32)**
%18 = alloca i32*
%19 = alloca %struct.__UTAC__CFLOW_FUNC**
store i8* %0, i8** %2
%20 = load i8*, i8** %2
%21 = bitcast i8* %20 to %struct.__UTAC__EXCEPTION*
store %struct.__UTAC__EXCEPTION* %21, %struct.__UTAC__EXCEPTION** %3
%22 = load %struct.__UTAC__EXCEPTION*, %struct.__UTAC__EXCEPTION** %3
%23 = ptrtoint %struct.__UTAC__EXCEPTION* %22 to i64
store i64 %23, i64* %5
%24 = load i64, i64* %5
%25 = add i64 %24, 24
store i64 %25, i64* %6
%26 = load i64, i64* %6
%27 = inttoptr i64 %26 to %struct.__UTAC__CFLOW_FUNC**
store %struct.__UTAC__CFLOW_FUNC** %27, %struct.__UTAC__CFLOW_FUNC*** %16
%28 = load %struct.__UTAC__CFLOW_FUNC**, %struct.__UTAC__CFLOW_FUNC*** %16
%29 = load %struct.__UTAC__CFLOW_FUNC*, %struct.__UTAC__CFLOW_FUNC** %28
store %struct.__UTAC__CFLOW_FUNC* %29, %struct.__UTAC__CFLOW_FUNC** %4
br label %30
30: ; preds = %1, %41
br label %31
31: ; preds = %30
store %struct.__UTAC__CFLOW_FUNC* null, %struct.__UTAC__CFLOW_FUNC** %7
%32 = load %struct.__UTAC__CFLOW_FUNC*, %struct.__UTAC__CFLOW_FUNC** %7
%33 = ptrtoint %struct.__UTAC__CFLOW_FUNC* %32 to i64
store i64 %33, i64* %8
%34 = load %struct.__UTAC__CFLOW_FUNC*, %struct.__UTAC__CFLOW_FUNC** %4
%35 = ptrtoint %struct.__UTAC__CFLOW_FUNC* %34 to i64
store i64 %35, i64* %9
%36 = load i64, i64* %9
%37 = load i64, i64* %8
%38 = icmp ne i64 %36, %37
br i1 %38, label %39, label %40
39: ; preds = %31
br label %41
40: ; preds = %31
br label %65
41: ; preds = %39
%42 = load %struct.__UTAC__CFLOW_FUNC*, %struct.__UTAC__CFLOW_FUNC** %4
%43 = bitcast %struct.__UTAC__CFLOW_FUNC* %42 to i32 (i32, i32)**
store i32 (i32, i32)** %43, i32 (i32, i32)*** %17
%44 = load i32 (i32, i32)**, i32 (i32, i32)*** %17
%45 = load i32 (i32, i32)*, i32 (i32, i32)** %44
store i32 (i32, i32)* %45, i32 (i32, i32)** %10
%46 = load %struct.__UTAC__CFLOW_FUNC*, %struct.__UTAC__CFLOW_FUNC** %4
%47 = ptrtoint %struct.__UTAC__CFLOW_FUNC* %46 to i64
store i64 %47, i64* %11
%48 = load i64, i64* %11
%49 = add i64 %48, 8
store i64 %49, i64* %12
%50 = load i64, i64* %12
%51 = inttoptr i64 %50 to i32*
store i32* %51, i32** %18
%52 = load i32*, i32** %18
%53 = load i32, i32* %52
store i32 %53, i32* %13
%54 = load i32 (i32, i32)*, i32 (i32, i32)** %10
%55 = load i32, i32* %13
%56 = call i32 %54(i32 4, i32 %55)
%57 = load %struct.__UTAC__CFLOW_FUNC*, %struct.__UTAC__CFLOW_FUNC** %4
%58 = ptrtoint %struct.__UTAC__CFLOW_FUNC* %57 to i64
store i64 %58, i64* %14
%59 = load i64, i64* %14
%60 = add i64 %59, 16
store i64 %60, i64* %15
%61 = load i64, i64* %15
%62 = inttoptr i64 %61 to %struct.__UTAC__CFLOW_FUNC**
store %struct.__UTAC__CFLOW_FUNC** %62, %struct.__UTAC__CFLOW_FUNC*** %19
%63 = load %struct.__UTAC__CFLOW_FUNC**, %struct.__UTAC__CFLOW_FUNC*** %19
%64 = load %struct.__UTAC__CFLOW_FUNC*, %struct.__UTAC__CFLOW_FUNC** %63
store %struct.__UTAC__CFLOW_FUNC* %64, %struct.__UTAC__CFLOW_FUNC** %4
br label %30
65: ; preds = %40
%66 = load i8*, i8** %2
%67 = call i32 @__utac__exception__cf_handler_free(i8* %66)
ret void
}

LLVM IR (-O2):
%struct.__UTAC__CFLOW_FUNC = type { i32 }
define void @__utac__exception__cf_handler_reset(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = add i64 %2, 24
%4 = inttoptr i64 %3 to %struct.__UTAC__CFLOW_FUNC**
%5 = load %struct.__UTAC__CFLOW_FUNC*, %struct.__UTAC__CFLOW_FUNC** %4
%6 = icmp eq %struct.__UTAC__CFLOW_FUNC* %5, null
br i1 %6, label %20, label %7
7: ; preds = %1, %7
%8 = phi %struct.__UTAC__CFLOW_FUNC* [ %18, %7 ], [ %5, %1 ]
%9 = ptrtoint %struct.__UTAC__CFLOW_FUNC* %8 to i64
%10 = bitcast %struct.__UTAC__CFLOW_FUNC* %8 to i32 (i32, i32)**
%11 = load i32 (i32, i32)*, i32 (i32, i32)** %10
%12 = add i64 %9, 8
%13 = inttoptr i64 %12 to i32*
%14 = load i32, i32* %13
%15 = tail call i32 %11(i32 4, i32 %14)
%16 = add i64 %9, 16
%17 = inttoptr i64 %16 to %struct.__UTAC__CFLOW_FUNC**
%18 = load %struct.__UTAC__CFLOW_FUNC*, %struct.__UTAC__CFLOW_FUNC** %17
%19 = icmp eq %struct.__UTAC__CFLOW_FUNC* %18, null
br i1 %19, label %20, label %7
20: ; preds = %7, %1
%21 = tail call i32 @__utac__exception__cf_handler_free(i8* %0)
ret void
}