int st_cDown(int n, char cr_stop) {
  struct _ {
    long _;
    int i;
  };
  static const struct _ __reset__;
  static struct _ cr_ctx;
  struct _ *_ = &cr_ctx;
  if (!_->_) {
    *_ = (struct _){0, n};
  }
  if (cr_stop)
    _->_ = cr_stop;
  long *cr_state = &_->_;
  switch (_->_) {
  case 0:;
    while (_->i > 0) {
      *cr_state = 61;
      return _->i--;
    case 61:;
    };
  default: {
    cr_ctx = __reset__;
    return 0;
  }
  };
}


x86 assembly (clang, -O0):
<st_cDown>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %edi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
lea    0x2f14(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1147 <st_cDown+0x47>
mov    -0x18(%rbp),%rax
movq   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%ecx
mov    %ecx,-0x20(%rbp)
mov    -0x28(%rbp),%rcx
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rcx
mov    %rcx,0x8(%rax)
cmpb   $0x0,-0x9(%rbp)
je     115d <st_cDown+0x5d>
movsbq -0x9(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
test   %rax,%rax
je     1191 <st_cDown+0x91>
jmp    117e <st_cDown+0x7e>
mov    -0x38(%rbp),%rax
sub    $0x3d,%rax
je     11c6 <st_cDown+0xc6>
jmp    11d0 <st_cDown+0xd0>
jmp    1196 <st_cDown+0x96>
mov    -0x18(%rbp),%rax
cmpl   $0x0,0x8(%rax)
jle    11cb <st_cDown+0xcb>
mov    -0x30(%rbp),%rax
movq   $0x3d,(%rax)
mov    -0x18(%rbp),%rcx
mov    0x8(%rcx),%eax
mov    %eax,%edx
add    $0xffffffff,%edx
mov    %edx,0x8(%rcx)
mov    %eax,-0x4(%rbp)
jmp    11f3 <st_cDown+0xf3>
jmp    1196 <st_cDown+0x96>
jmp    11d0 <st_cDown+0xd0>
mov    0xe29(%rip),%rax
mov    %rax,0x2e4a(%rip)
mov    0xe23(%rip),%rax
mov    %rax,0x2e44(%rip)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<st_cDown>:
mov    0x2f21(%rip),%rax
test   %rax,%rax
jne    1112 <st_cDown+0x12>
mov    %edi,0x2f1e(%rip)
test   %sil,%sil
movsbq %sil,%rcx
cmove  %rax,%rcx
cmp    $0x3d,%rcx
je     1128 <st_cDown+0x28>
test   %rcx,%rcx
jne    1147 <st_cDown+0x47>
mov    0x2f02(%rip),%eax
test   %eax,%eax
jle    1147 <st_cDown+0x47>
movq   $0x3d,0x2eeb(%rip)
lea    -0x1(%rax),%ecx
mov    %ecx,0x2eea(%rip)
ret
xorps  %xmm0,%xmm0
movups %xmm0,0x2ed7(%rip)
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct._ = type { i64, i32 }
@st_cDown.__reset__ = internal constant %struct._ zeroinitializer
@st_cDown.cr_ctx = internal global %struct._ zeroinitializer
define i32 @st_cDown(i32 %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = alloca %struct._*
%7 = alloca %struct._
%8 = alloca i64*
store i32 %0, i32* %4
store i8 %1, i8* %5
store %struct._* @st_cDown.cr_ctx, %struct._** %6
%9 = load %struct._*, %struct._** %6
%10 = getelementptr inbounds %struct._, %struct._* %9, i32 0, i32 0
%11 = load i64, i64* %10
%12 = icmp ne i64 %11, 0
br i1 %12, label %20, label %13
13: ; preds = %2
%14 = load %struct._*, %struct._** %6
%15 = getelementptr inbounds %struct._, %struct._* %7, i32 0, i32 0
store i64 0, i64* %15
%16 = getelementptr inbounds %struct._, %struct._* %7, i32 0, i32 1
%17 = load i32, i32* %4
store i32 %17, i32* %16
%18 = bitcast %struct._* %14 to i8*
%19 = bitcast %struct._* %7 to i8*
br label %20
20: ; preds = %13, %2
%21 = load i8, i8* %5
%22 = icmp ne i8 %21, 0
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i8, i8* %5
%25 = sext i8 %24 to i64
%26 = load %struct._*, %struct._** %6
%27 = getelementptr inbounds %struct._, %struct._* %26, i32 0, i32 0
store i64 %25, i64* %27
br label %28
28: ; preds = %23, %20
%29 = load %struct._*, %struct._** %6
%30 = getelementptr inbounds %struct._, %struct._* %29, i32 0, i32 0
store i64* %30, i64** %8
%31 = load %struct._*, %struct._** %6
%32 = getelementptr inbounds %struct._, %struct._* %31, i32 0, i32 0
%33 = load i64, i64* %32
switch i64 %33, label %48 [
i64 0, label %34
i64 61, label %46
]
34: ; preds = %28
br label %35
35: ; preds = %46, %34
%36 = load %struct._*, %struct._** %6
%37 = getelementptr inbounds %struct._, %struct._* %36, i32 0, i32 1
%38 = load i32, i32* %37
%39 = icmp sgt i32 %38, 0
br i1 %39, label %40, label %47
40: ; preds = %35
%41 = load i64*, i64** %8
store i64 61, i64* %41
%42 = load %struct._*, %struct._** %6
%43 = getelementptr inbounds %struct._, %struct._* %42, i32 0, i32 1
%44 = load i32, i32* %43
%45 = add nsw i32 %44, -1
store i32 %45, i32* %43
store i32 %44, i32* %3
br label %49
46: ; preds = %28
br label %35
47: ; preds = %35
br label %48
48: ; preds = %28, %47
store i32 0, i32* %3
br label %49
49: ; preds = %48, %40
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
%struct._ = type { i64, i32 }
@st_cDown.cr_ctx = internal unnamed_addr global %struct._ zeroinitializer
define i32 @st_cDown(i32 %0, i8 signext %1) {
%3 = load i64, i64* getelementptr inbounds (%struct._, %struct._* @st_cDown.cr_ctx, i64 0, i32 0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %2
store i32 %0, i32* getelementptr inbounds (%struct._, %struct._* @st_cDown.cr_ctx, i64 0, i32 1)
br label %6
6: ; preds = %5, %2
%7 = icmp eq i8 %1, 0
%8 = sext i8 %1 to i64
%9 = select i1 %7, i64 %3, i64 %8
switch i64 %9, label %15 [
i64 0, label %10
i64 61, label %10
]
10: ; preds = %6, %6
%11 = load i32, i32* getelementptr inbounds (%struct._, %struct._* @st_cDown.cr_ctx, i64 0, i32 1)
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
store i64 61, i64* getelementptr inbounds (%struct._, %struct._* @st_cDown.cr_ctx, i64 0, i32 0)
%14 = add nsw i32 %11, -1
store i32 %14, i32* getelementptr inbounds (%struct._, %struct._* @st_cDown.cr_ctx, i64 0, i32 1)
br label %16
15: ; preds = %10, %6
br label %16
16: ; preds = %15, %13
%17 = phi i32 [ 0, %15 ], [ %11, %13 ]
ret i32 %17
}