#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 */

/* Variables and functions */
int /*<<< orphan*/ esc(char *);
int /*<<< orphan*/ padding(int);
int /*<<< orphan*/ send_char(int);
int /*<<< orphan*/ sprintf(char *, char *, char, char);
void scs(int g, int c) {
  char temp[10];
  sprintf(temp, "%c%c", g ? ')' : '(', c);
  esc(temp);
  sprintf(temp, "%c%c", g ? '(' : ')', 'B');
  esc(temp);
  send_char(g ? 0016 : 0017);
  padding(4);
}


x86 assembly (clang, -O0):
<scs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x12(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    $0x28,%eax
mov    $0x29,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%eax
lea    0xe8f(%rip),%rsi
movsbl %cl,%edx
movsbl %al,%ecx
call   1060 <sprintf@plt>
lea    -0x12(%rbp),%rdi
call   1050 <esc@plt>
lea    -0x12(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    $0x29,%eax
mov    $0x28,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
lea    0xe5d(%rip),%rsi
mov    $0x42,%ecx
movsbl %al,%edx
call   1060 <sprintf@plt>
lea    -0x12(%rbp),%rdi
call   1050 <esc@plt>
mov    -0x4(%rbp),%ecx
mov    $0xf,%edi
mov    $0xe,%eax
cmp    $0x0,%ecx
cmovne %eax,%edi
call   1030 <send_char@plt>
mov    $0x4,%edi
call   1040 <padding@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scs>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
test   %edi,%edi
sete   %bl
movsbl %sil,%ecx
mov    %ebx,%edx
xor    $0x29,%edx
lea    0xea0(%rip),%r14
lea    0x6(%rsp),%r15
mov    %r15,%rdi
mov    %r14,%rsi
call   1060 <sprintf@plt>
mov    %r15,%rdi
call   1050 <esc@plt>
lea    0x28(%rbx),%edx
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x42,%ecx
call   1060 <sprintf@plt>
mov    %r15,%rdi
call   1050 <esc@plt>
or     $0xe,%ebx
mov    %ebx,%edi
call   1030 <send_char@plt>
mov    $0x4,%edi
call   1040 <padding@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%c%c\00"
define void @scs(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [10 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 41, i32 40
%11 = trunc i32 %10 to i8
%12 = load i32, i32* %4
%13 = trunc i32 %12 to i8
%14 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext %11, i8 signext %13)
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%16 = call i32 @esc(i8* %15)
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%18 = load i32, i32* %3
%19 = icmp ne i32 %18, 0
%20 = zext i1 %19 to i64
%21 = select i1 %19, i32 40, i32 41
%22 = trunc i32 %21 to i8
%23 = call i32 @sprintf(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext %22, i8 signext 66)
%24 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%25 = call i32 @esc(i8* %24)
%26 = load i32, i32* %3
%27 = icmp ne i32 %26, 0
%28 = zext i1 %27 to i64
%29 = select i1 %27, i32 14, i32 15
%30 = call i32 @send_char(i32 %29)
%31 = call i32 @padding(i32 4)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%c%c\00"
define void @scs(i32 %0, i32 %1) {
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 0
%6 = select i1 %5, i8 40, i8 41
%7 = trunc i32 %1 to i8
%8 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext %6, i8 signext %7)
%9 = call i32 @esc(i8* %4)
%10 = select i1 %5, i8 41, i8 40
%11 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext %10, i8 signext 66)
%12 = call i32 @esc(i8* %4)
%13 = select i1 %5, i32 15, i32 14
%14 = call i32 @send_char(i32 %13)
%15 = call i32 @padding(i32 4)
ret void
}