#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*/ in_dynamic(struct cfg_t *);
int /*<<< orphan*/ next_dynamic_alternative(struct cfg_t *);
int /*<<< orphan*/ read_character_err(struct cfg_t *, char *, char *);
int /*<<< orphan*/ write_dynamic(struct cfg_t *, char);
void have_delimiter(struct cfg_t *cfg) {
  char character;
  read_character_err(cfg, &character, "Unmatched [[");

  if (character == '|') {
    next_dynamic_alternative(cfg);
    in_dynamic(cfg);
  } else {
    write_dynamic(cfg, '|');
    write_dynamic(cfg, character);
    in_dynamic(cfg);
  }
  return;
}


x86 assembly (clang, -O0):
<have_delimiter>:
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    $0x7c,%eax
jne    1184 <have_delimiter+0x44>
mov    -0x8(%rbp),%rdi
call   1030 <next_dynamic_alternative@plt>
mov    -0x8(%rbp),%rdi
call   1050 <in_dynamic@plt>
jmp    11a8 <have_delimiter+0x68>
mov    -0x8(%rbp),%rdi
mov    $0x7c,%esi
call   1040 <write_dynamic@plt>
mov    -0x8(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   1040 <write_dynamic@plt>
mov    -0x8(%rbp),%rdi
call   1050 <in_dynamic@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<have_delimiter>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xeb1(%rip),%rdx
lea    0xf(%rsp),%rsi
call   1060 <read_character_err@plt>
cmpb   $0x7c,0xf(%rsp)
jne    116a <have_delimiter+0x2a>
mov    %rbx,%rdi
call   1030 <next_dynamic_alternative@plt>
jmp    1184 <have_delimiter+0x44>
mov    %rbx,%rdi
mov    $0x7c,%esi
call   1040 <write_dynamic@plt>
movsbl 0xf(%rsp),%esi
mov    %rbx,%rdi
call   1040 <write_dynamic@plt>
mov    %rbx,%rdi
call   1050 <in_dynamic@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.cfg_t = type { i32 }
@.str = [13 x i8] c"Unmatched [[\00"
define void @have_delimiter(%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 ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%6 = load i8, i8* %3
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 124
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load %struct.cfg_t*, %struct.cfg_t** %2
%11 = call i32 @next_dynamic_alternative(%struct.cfg_t* %10)
%12 = load %struct.cfg_t*, %struct.cfg_t** %2
%13 = call i32 @in_dynamic(%struct.cfg_t* %12)
br label %22
14: ; preds = %1
%15 = load %struct.cfg_t*, %struct.cfg_t** %2
%16 = call i32 @write_dynamic(%struct.cfg_t* %15, i8 signext 124)
%17 = load %struct.cfg_t*, %struct.cfg_t** %2
%18 = load i8, i8* %3
%19 = call i32 @write_dynamic(%struct.cfg_t* %17, i8 signext %18)
%20 = load %struct.cfg_t*, %struct.cfg_t** %2
%21 = call i32 @in_dynamic(%struct.cfg_t* %20)
br label %22
22: ; preds = %14, %9
ret void
}

LLVM IR (-O2):
%struct.cfg_t = type { i32 }
@.str = [13 x i8] c"Unmatched [[\00"
define void @have_delimiter(%struct.cfg_t* %0) {
%2 = alloca i8
%3 = call i32 @read_character_err(%struct.cfg_t* %0, i8* %2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 124
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @next_dynamic_alternative(%struct.cfg_t* %0)
br label %12
8: ; preds = %1
%9 = call i32 @write_dynamic(%struct.cfg_t* %0, i8 signext 124)
%10 = load i8, i8* %2
%11 = call i32 @write_dynamic(%struct.cfg_t* %0, i8 signext %10)
br label %12
12: ; preds = %8, %6
%13 = call i32 @in_dynamic(%struct.cfg_t* %0)
ret void
}