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

/* Variables and functions */
int /*<<< orphan*/ have_closing_paren(struct cfg_t *);
int /*<<< orphan*/ read_character_err(struct cfg_t *, char *, char *);
int /*<<< orphan*/ write_tag(struct cfg_t *, char);
void in_tag(struct cfg_t *cfg) {
  char character;
  read_character_err(cfg, &character,
                     "Unmatched (( and therefore unmatched [[, as well");

  if (character == ')') {
    have_closing_paren(cfg);
  } else {
    write_tag(cfg, character);
    in_tag(cfg);
  }
  return;
}


x86 assembly (clang, -O0):
<in_tag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x9(%rbp),%rsi
lea    0xea5(%rip),%rdx
call   1060 <read_character_err@plt>
movsbl -0x9(%rbp),%eax
cmp    $0x29,%eax
jne    117b <in_tag+0x3b>
mov    -0x8(%rbp),%rdi
call   1030 <have_closing_paren@plt>
jmp    1191 <in_tag+0x51>
mov    -0x8(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   1050 <write_tag@plt>
mov    -0x8(%rbp),%rdi
call   1040 <in_tag@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<in_tag>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xeb1(%rip),%rdx
lea    0xf(%rsp),%rsi
call   1060 <read_character_err@plt>
mov    0xf(%rsp),%al
cmp    $0x29,%al
jne    116b <in_tag+0x2b>
mov    %rbx,%rdi
call   1030 <have_closing_paren@plt>
jmp    117e <in_tag+0x3e>
movsbl %al,%esi
mov    %rbx,%rdi
call   1050 <write_tag@plt>
mov    %rbx,%rdi
call   1040 <in_tag@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.cfg_t = type { i32 }
@.str = [49 x i8] c"Unmatched (( and therefore unmatched [[, as well\00"
define void @in_tag(%struct.cfg_t* %0) {
%2 = alloca %struct.cfg_t*
%3 = alloca i8
store %struct.cfg_t* %0, %struct.cfg_t** %2
%4 = load %struct.cfg_t*, %struct.cfg_t** %2
%5 = call i32 @read_character_err(%struct.cfg_t* %4, i8* %3, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%6 = load i8, i8* %3
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 41
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load %struct.cfg_t*, %struct.cfg_t** %2
%11 = call i32 @have_closing_paren(%struct.cfg_t* %10)
br label %17
12: ; preds = %1
%13 = load %struct.cfg_t*, %struct.cfg_t** %2
%14 = load i8, i8* %3
%15 = call i32 @write_tag(%struct.cfg_t* %13, i8 signext %14)
%16 = load %struct.cfg_t*, %struct.cfg_t** %2
br label %17
17: ; preds = %12, %9
ret void
}

LLVM IR (-O2):
%struct.cfg_t = type { i32 }
@.str = [49 x i8] c"Unmatched (( and therefore unmatched [[, as well\00"
define void @in_tag(%struct.cfg_t* %0) {
%2 = alloca i8
%3 = call i32 @read_character_err(%struct.cfg_t* %0, i8* %2, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 41
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @have_closing_paren(%struct.cfg_t* %0)
br label %10
8: ; preds = %1
%9 = call i32 @write_tag(%struct.cfg_t* %0, i8 signext %4)
br label %10
10: ; preds = %8, %6
ret void
}