#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 ic_symbol {
  int dummy;
};
struct ic_kludge {
  int dummy;
};
struct ic_decl_type_struct {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *);
struct ic_symbol *
ic_decl_type_struct_mangled_name(struct ic_decl_type_struct *);
char *ic_symbol_contents(struct ic_symbol *);
int /*<<< orphan*/ puts(char *);
unsigned int
ic_b2c_compile_type_struct_header(struct ic_kludge *kludge,
                                  struct ic_decl_type_struct *tdecl_struct,
                                  FILE *f) {
  struct ic_symbol *mangled_type_name = 0;
  char *mangled_type_name_ch = 0;
  if (!kludge) {
    puts("ic_b2c_compile_type_struct_header: kludge was null");
    return 0;
  }
  if (!tdecl_struct) {
    puts("ic_b2c_compile_type_struct_header: tdecl_struct was null");
    return 0;
  }
  if (!f) {
    puts("ic_b2c_compile_type_struct_header: f was null");
    return 0;
  }
  mangled_type_name = ic_decl_type_struct_mangled_name(tdecl_struct);
  if (!mangled_type_name) {
    puts("ic_b2c_compile_type_struct_header: call to "
         "ic_decl_type_struct_mangled_name failed");
    return 0;
  }
  mangled_type_name_ch = ic_symbol_contents(mangled_type_name);
  if (!mangled_type_name_ch) {
    puts(
        "ic_b2c_compile_type_struct_header: call to ic_symbol_contents failed");
    return 0;
  }
  fprintf(f, "typedef struct %s * %s;\n", mangled_type_name_ch,
          mangled_type_name_ch);
  return 1;
}


x86 assembly (clang, -O0):
<ic_b2c_compile_type_struct_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1187 <ic_b2c_compile_type_struct_header+0x47>
lea    0xe8a(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    124c <ic_b2c_compile_type_struct_header+0x10c>
cmpq   $0x0,-0x18(%rbp)
jne    11aa <ic_b2c_compile_type_struct_header+0x6a>
lea    0xe9a(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    124c <ic_b2c_compile_type_struct_header+0x10c>
cmpq   $0x0,-0x20(%rbp)
jne    11cd <ic_b2c_compile_type_struct_header+0x8d>
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    124c <ic_b2c_compile_type_struct_header+0x10c>
mov    -0x18(%rbp),%rdi
call   1060 <ic_decl_type_struct_mangled_name@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11fd <ic_b2c_compile_type_struct_header+0xbd>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    124c <ic_b2c_compile_type_struct_header+0x10c>
mov    -0x28(%rbp),%rdi
call   1040 <ic_symbol_contents@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    122d <ic_b2c_compile_type_struct_header+0xed>
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    124c <ic_b2c_compile_type_struct_header+0x10c>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    -0x30(%rbp),%rcx
lea    0xef2(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ic_b2c_compile_type_struct_header>:
push   %rbx
test   %rdi,%rdi
je     1189 <ic_b2c_compile_type_struct_header+0x49>
test   %rsi,%rsi
je     1192 <ic_b2c_compile_type_struct_header+0x52>
mov    %rdx,%rbx
test   %rdx,%rdx
je     119b <ic_b2c_compile_type_struct_header+0x5b>
mov    %rsi,%rdi
call   1060 <ic_decl_type_struct_mangled_name@plt>
test   %rax,%rax
je     11a4 <ic_b2c_compile_type_struct_header+0x64>
mov    %rax,%rdi
call   1040 <ic_symbol_contents@plt>
test   %rax,%rax
je     11ad <ic_b2c_compile_type_struct_header+0x6d>
lea    0xfbe(%rip),%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
mov    %rax,%rcx
call   1050 <fprintf@plt>
mov    $0x1,%eax
pop    %rbx
ret
lea    0xe70(%rip),%rdi
jmp    11b4 <ic_b2c_compile_type_struct_header+0x74>
lea    0xe9a(%rip),%rdi
jmp    11b4 <ic_b2c_compile_type_struct_header+0x74>
lea    0xeca(%rip),%rdi
jmp    11b4 <ic_b2c_compile_type_struct_header+0x74>
lea    0xeef(%rip),%rdi
jmp    11b4 <ic_b2c_compile_type_struct_header+0x74>
lea    0xf39(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.ic_kludge = type { i32 }
%struct.ic_decl_type_struct = type { i32 }
%struct.ic_symbol = type { i32 }
@.str = [51 x i8] c"ic_b2c_compile_type_struct_header: kludge was null\00"
@.str.1 = [57 x i8] c"ic_b2c_compile_type_struct_header: tdecl_struct was null\00"
@.str.2 = [46 x i8] c"ic_b2c_compile_type_struct_header: f was null\00"
@.str.3 = [83 x i8] c"ic_b2c_compile_type_struct_header: call to ic_decl_type_struct_mangled_name failed\00"
@.str.4 = [69 x i8] c"ic_b2c_compile_type_struct_header: call to ic_symbol_contents failed\00"
@.str.5 = [25 x i8] c"typedef struct %s * %s;\0A\00"
define i32 @ic_b2c_compile_type_struct_header(%struct.ic_kludge* %0, %struct.ic_decl_type_struct* %1, i32* %2) {
%4 = alloca i32
%5 = alloca %struct.ic_kludge*
%6 = alloca %struct.ic_decl_type_struct*
%7 = alloca i32*
%8 = alloca %struct.ic_symbol*
%9 = alloca i8*
store %struct.ic_kludge* %0, %struct.ic_kludge** %5
store %struct.ic_decl_type_struct* %1, %struct.ic_decl_type_struct** %6
store i32* %2, i32** %7
store %struct.ic_symbol* null, %struct.ic_symbol** %8
store i8* null, i8** %9
%10 = load %struct.ic_kludge*, %struct.ic_kludge** %5
%11 = icmp ne %struct.ic_kludge* %10, null
br i1 %11, label %14, label %12
12: ; preds = %3
%13 = call i32 @puts(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %43
14: ; preds = %3
%15 = load %struct.ic_decl_type_struct*, %struct.ic_decl_type_struct** %6
%16 = icmp ne %struct.ic_decl_type_struct* %15, null
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = call i32 @puts(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %4
br label %43
19: ; preds = %14
%20 = load i32*, i32** %7
%21 = icmp ne i32* %20, null
br i1 %21, label %24, label %22
22: ; preds = %19
%23 = call i32 @puts(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %43
24: ; preds = %19
%25 = load %struct.ic_decl_type_struct*, %struct.ic_decl_type_struct** %6
%26 = call %struct.ic_symbol* @ic_decl_type_struct_mangled_name(%struct.ic_decl_type_struct* %25)
store %struct.ic_symbol* %26, %struct.ic_symbol** %8
%27 = load %struct.ic_symbol*, %struct.ic_symbol** %8
%28 = icmp ne %struct.ic_symbol* %27, null
br i1 %28, label %31, label %29
29: ; preds = %24
%30 = call i32 @puts(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %4
br label %43
31: ; preds = %24
%32 = load %struct.ic_symbol*, %struct.ic_symbol** %8
%33 = call i8* @ic_symbol_contents(%struct.ic_symbol* %32)
store i8* %33, i8** %9
%34 = load i8*, i8** %9
%35 = icmp ne i8* %34, null
br i1 %35, label %38, label %36
36: ; preds = %31
%37 = call i32 @puts(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %4
br label %43
38: ; preds = %31
%39 = load i32*, i32** %7
%40 = load i8*, i8** %9
%41 = load i8*, i8** %9
%42 = call i32 @fprintf(i32* %39, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* %40, i8* %41)
store i32 1, i32* %4
br label %43
43: ; preds = %38, %36, %29, %22, %17, %12
%44 = load i32, i32* %4
ret i32 %44
}

LLVM IR (-O2):
%struct.ic_kludge = type { i32 }
%struct.ic_decl_type_struct = type { i32 }
%struct.ic_symbol = type { i32 }
@.str = [51 x i8] c"ic_b2c_compile_type_struct_header: kludge was null\00"
@.str.1 = [57 x i8] c"ic_b2c_compile_type_struct_header: tdecl_struct was null\00"
@.str.2 = [46 x i8] c"ic_b2c_compile_type_struct_header: f was null\00"
@.str.3 = [83 x i8] c"ic_b2c_compile_type_struct_header: call to ic_decl_type_struct_mangled_name failed\00"
@.str.4 = [69 x i8] c"ic_b2c_compile_type_struct_header: call to ic_symbol_contents failed\00"
@.str.5 = [25 x i8] c"typedef struct %s * %s;\0A\00"
define i32 @ic_b2c_compile_type_struct_header(%struct.ic_kludge* readnone %0, %struct.ic_decl_type_struct* %1, i32* %2) {
%4 = icmp eq %struct.ic_kludge* %0, null
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %27
7: ; preds = %3
%8 = icmp eq %struct.ic_decl_type_struct* %1, null
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
br label %27
11: ; preds = %7
%12 = icmp eq i32* %2, null
br i1 %12, label %13, label %15
13: ; preds = %11
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
br label %27
15: ; preds = %11
%16 = tail call %struct.ic_symbol* @ic_decl_type_struct_mangled_name(%struct.ic_decl_type_struct* %1)
%17 = icmp eq %struct.ic_symbol* %16, null
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([83 x i8], [83 x i8]* @.str.3, i64 0, i64 0))
br label %27
20: ; preds = %15
%21 = tail call i8* @ic_symbol_contents(%struct.ic_symbol* %16)
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str.4, i64 0, i64 0))
br label %27
25: ; preds = %20
%26 = tail call i32 @fprintf(i32* %2, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* %21, i8* %21)
br label %27
27: ; preds = %25, %23, %18, %13, %9, %5
%28 = phi i32 [ 1, %25 ], [ 0, %23 ], [ 0, %18 ], [ 0, %13 ], [ 0, %9 ], [ 0, %5 ]
ret i32 %28
}