#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 idn_qname_iterator(char **label) {
  static int next_iter = 0;
  if (NULL == label) {
    next_iter = 0;
    return 1 + 1;
  }
  if (0 == next_iter)
    *label = "normal";
  else if (1 == next_iter)
    *label = "idn";
  else
    return -1;
  return next_iter++;
}


x86 assembly (clang, -O0):
<idn_qname_iterator>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    112a <idn_qname_iterator+0x2a>
movl   $0x0,0x2f06(%rip)
movl   $0x2,-0x4(%rbp)
jmp    1194 <idn_qname_iterator+0x94>
xor    %eax,%eax
cmp    0x2ef2(%rip),%eax
jne    114b <idn_qname_iterator+0x4b>
mov    -0x10(%rbp),%rax
lea    0xebd(%rip),%rcx
mov    %rcx,(%rax)
jmp    1180 <idn_qname_iterator+0x80>
mov    $0x1,%eax
cmp    0x2ece(%rip),%eax
jne    116f <idn_qname_iterator+0x6f>
mov    -0x10(%rbp),%rax
lea    0xea0(%rip),%rcx
mov    %rcx,(%rax)
jmp    117b <idn_qname_iterator+0x7b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1194 <idn_qname_iterator+0x94>
jmp    1180 <idn_qname_iterator+0x80>
mov    0x2e9e(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2e93(%rip)
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<idn_qname_iterator>:
test   %rdi,%rdi
je     1122 <idn_qname_iterator+0x22>
mov    0x2f19(%rip),%ecx
test   %ecx,%ecx
je     112b <idn_qname_iterator+0x2b>
mov    $0xffffffff,%eax
cmp    $0x1,%ecx
jne    1140 <idn_qname_iterator+0x40>
lea    0xee7(%rip),%rax
jmp    1132 <idn_qname_iterator+0x32>
mov    $0x2,%ecx
xor    %eax,%eax
jmp    1138 <idn_qname_iterator+0x38>
lea    0xece(%rip),%rax
mov    %rax,(%rdi)
lea    0x1(%rcx),%eax
mov    %eax,0x2ee6(%rip)
mov    %ecx,%eax
ret

LLVM IR (-O0):
@idn_qname_iterator.next_iter = internal global i32 0
@.str = [7 x i8] c"normal\00"
@.str.1 = [4 x i8] c"idn\00"
define i32 @idn_qname_iterator(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
store i8** %0, i8*** %3
%4 = load i8**, i8*** %3
%5 = icmp eq i8** null, %4
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* @idn_qname_iterator.next_iter
store i32 2, i32* %2
br label %22
7: ; preds = %1
%8 = load i32, i32* @idn_qname_iterator.next_iter
%9 = icmp eq i32 0, %8
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = load i8**, i8*** %3
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %11
br label %19
12: ; preds = %7
%13 = load i32, i32* @idn_qname_iterator.next_iter
%14 = icmp eq i32 1, %13
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = load i8**, i8*** %3
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %16
br label %18
17: ; preds = %12
store i32 -1, i32* %2
br label %22
18: ; preds = %15
br label %19
19: ; preds = %18, %10
%20 = load i32, i32* @idn_qname_iterator.next_iter
%21 = add nsw i32 %20, 1
store i32 %21, i32* @idn_qname_iterator.next_iter
store i32 %20, i32* %2
br label %22
22: ; preds = %19, %17, %6
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
@idn_qname_iterator.next_iter = internal unnamed_addr global i32 0
@.str = [7 x i8] c"normal\00"
@.str.1 = [4 x i8] c"idn\00"
define i32 @idn_qname_iterator(i8** writeonly %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = load i32, i32* @idn_qname_iterator.next_iter
switch i32 %4, label %12 [
i32 0, label %6
i32 1, label %5
]
5: ; preds = %3
br label %6
6: ; preds = %3, %5
%7 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %3 ]
store i8* %7, i8** %0
%8 = add nuw nsw i32 %4, 1
br label %9
9: ; preds = %1, %6
%10 = phi i32 [ %8, %6 ], [ 0, %1 ]
%11 = phi i32 [ %4, %6 ], [ 2, %1 ]
store i32 %10, i32* @idn_qname_iterator.next_iter
br label %12
12: ; preds = %9, %3
%13 = phi i32 [ -1, %3 ], [ %11, %9 ]
ret i32 %13
}