#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 rk_conv_context {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ brk_roman_free(struct rk_conv_context *);
int /*<<< orphan*/ free(struct rk_conv_context *);
int /*<<< orphan*/ rk_register_map(struct rk_conv_context *, int,
                                   int /*<<< orphan*/ *);
int /*<<< orphan*/ rk_select_map(struct rk_conv_context *,
                                 int /*<<< orphan*/ *);
void rk_context_free(struct rk_conv_context *cc) {
  int i;
  brk_roman_free(cc);
  rk_select_map(cc, NULL);
  for (i = 0; i < 10; i++) {
    rk_register_map(cc, i, NULL);
  }
  free(cc);
}


x86 assembly (clang, -O0):
<rk_context_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <brk_roman_free@plt>
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <rk_select_map@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1191 <rk_context_free+0x51>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
xor    %eax,%eax
mov    %eax,%edx
call   1050 <rk_register_map@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1169 <rk_context_free+0x29>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rk_context_free>:
push   %rbx
mov    %rdi,%rbx
call   1040 <brk_roman_free@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <rk_select_map@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <rk_register_map@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1050 <rk_register_map@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %edx,%edx
call   1050 <rk_register_map@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %edx,%edx
call   1050 <rk_register_map@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %edx,%edx
call   1050 <rk_register_map@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %edx,%edx
call   1050 <rk_register_map@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %edx,%edx
call   1050 <rk_register_map@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %edx,%edx
call   1050 <rk_register_map@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %edx,%edx
call   1050 <rk_register_map@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %edx,%edx
call   1050 <rk_register_map@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.rk_conv_context = type { i32 }
define void @rk_context_free(%struct.rk_conv_context* %0) {
%2 = alloca %struct.rk_conv_context*
%3 = alloca i32
store %struct.rk_conv_context* %0, %struct.rk_conv_context** %2
%4 = load %struct.rk_conv_context*, %struct.rk_conv_context** %2
%5 = call i32 @brk_roman_free(%struct.rk_conv_context* %4)
%6 = load %struct.rk_conv_context*, %struct.rk_conv_context** %2
%7 = call i32 @rk_select_map(%struct.rk_conv_context* %6, i32* null)
store i32 0, i32* %3
br label %8
8: ; preds = %15, %1
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %18
11: ; preds = %8
%12 = load %struct.rk_conv_context*, %struct.rk_conv_context** %2
%13 = load i32, i32* %3
%14 = call i32 @rk_register_map(%struct.rk_conv_context* %12, i32 %13, i32* null)
br label %15
15: ; preds = %11
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %8
18: ; preds = %8
%19 = load %struct.rk_conv_context*, %struct.rk_conv_context** %2
%20 = call i32 @free(%struct.rk_conv_context* %19)
ret void
}

LLVM IR (-O2):
%struct.rk_conv_context = type { i32 }
define void @rk_context_free(%struct.rk_conv_context* %0) {
%2 = tail call i32 @brk_roman_free(%struct.rk_conv_context* %0)
%3 = tail call i32 @rk_select_map(%struct.rk_conv_context* %0, i32* null)
%4 = tail call i32 @rk_register_map(%struct.rk_conv_context* %0, i32 0, i32* null)
%5 = tail call i32 @rk_register_map(%struct.rk_conv_context* %0, i32 1, i32* null)
%6 = tail call i32 @rk_register_map(%struct.rk_conv_context* %0, i32 2, i32* null)
%7 = tail call i32 @rk_register_map(%struct.rk_conv_context* %0, i32 3, i32* null)
%8 = tail call i32 @rk_register_map(%struct.rk_conv_context* %0, i32 4, i32* null)
%9 = tail call i32 @rk_register_map(%struct.rk_conv_context* %0, i32 5, i32* null)
%10 = tail call i32 @rk_register_map(%struct.rk_conv_context* %0, i32 6, i32* null)
%11 = tail call i32 @rk_register_map(%struct.rk_conv_context* %0, i32 7, i32* null)
%12 = tail call i32 @rk_register_map(%struct.rk_conv_context* %0, i32 8, i32* null)
%13 = tail call i32 @rk_register_map(%struct.rk_conv_context* %0, i32 9, i32* null)
%14 = tail call i32 @free(%struct.rk_conv_context* %0)
ret void
}