#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 map_rec {
  int dummy;
};
typedef int VISIT;

/* Variables and functions */
#define endorder 131
#define leaf 130
int /*<<< orphan*/ map_rebuild(struct map_rec *, int /*<<< orphan*/);
#define postorder 129
#define preorder 128
void map_rebuild_action(const void *nodep, const VISIT which, const int depth) {
  static int map_idx;
  switch (which) {
  case preorder:
    break;
  case postorder:
    map_rebuild(*(struct map_rec **)nodep, map_idx++);
    break;
  case endorder:
    break;
  case leaf:
    map_rebuild(*(struct map_rec **)nodep, map_idx++);
    break;
  }
}


x86 assembly (clang, -O0):
<map_rebuild_action>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3,%eax
ja     1194 <map_rebuild_action+0x84>
mov    -0x18(%rbp),%rax
lea    0xebe(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1194 <map_rebuild_action+0x84>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    0x2ecf(%rip),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,0x2ec4(%rip)
call   1030 <map_rebuild@plt>
jmp    1194 <map_rebuild_action+0x84>
jmp    1194 <map_rebuild_action+0x84>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    0x2ea8(%rip),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,0x2e9d(%rip)
call   1030 <map_rebuild@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<map_rebuild_action>:
cmp    $0x82,%esi
je     1120 <map_rebuild_action+0x10>
cmp    $0x81,%esi
jne    1137 <map_rebuild_action+0x27>
mov    (%rdi),%rdi
mov    0x2f03(%rip),%esi
lea    0x1(%rsi),%eax
mov    %eax,0x2efa(%rip)
jmp    1030 <map_rebuild@plt>
ret

LLVM IR (-O0):
%struct.map_rec = type { i32 }
@map_rebuild_action.map_idx = internal global i32 0
define void @map_rebuild_action(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
switch i32 %7, label %24 [
i32 128, label %8
i32 129, label %9
i32 131, label %16
i32 130, label %17
]
8: ; preds = %3
br label %24
9: ; preds = %3
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to %struct.map_rec**
%12 = load %struct.map_rec*, %struct.map_rec** %11
%13 = load i32, i32* @map_rebuild_action.map_idx
%14 = add nsw i32 %13, 1
store i32 %14, i32* @map_rebuild_action.map_idx
%15 = call i32 @map_rebuild(%struct.map_rec* %12, i32 %13)
br label %24
16: ; preds = %3
br label %24
17: ; preds = %3
%18 = load i8*, i8** %4
%19 = bitcast i8* %18 to %struct.map_rec**
%20 = load %struct.map_rec*, %struct.map_rec** %19
%21 = load i32, i32* @map_rebuild_action.map_idx
%22 = add nsw i32 %21, 1
store i32 %22, i32* @map_rebuild_action.map_idx
%23 = call i32 @map_rebuild(%struct.map_rec* %20, i32 %21)
br label %24
24: ; preds = %3, %17, %16, %9, %8
ret void
}

LLVM IR (-O2):
%struct.map_rec = type { i32 }
@map_rebuild_action.map_idx = internal unnamed_addr global i32 0
define void @map_rebuild_action(i8* nocapture %0, i32 %1, i32 %2) {
switch i32 %1, label %16 [
i32 130, label %10
i32 129, label %4
]
4: ; preds = %3
%5 = bitcast i8* %0 to %struct.map_rec**
%6 = load %struct.map_rec*, %struct.map_rec** %5
%7 = load i32, i32* @map_rebuild_action.map_idx
%8 = add nsw i32 %7, 1
store i32 %8, i32* @map_rebuild_action.map_idx
%9 = tail call i32 @map_rebuild(%struct.map_rec* %6, i32 %7)
br label %16
10: ; preds = %3
%11 = bitcast i8* %0 to %struct.map_rec**
%12 = load %struct.map_rec*, %struct.map_rec** %11
%13 = load i32, i32* @map_rebuild_action.map_idx
%14 = add nsw i32 %13, 1
store i32 %14, i32* @map_rebuild_action.map_idx
%15 = tail call i32 @map_rebuild(%struct.map_rec* %12, i32 %13)
br label %16
16: ; preds = %3, %10, %4
ret void
}