#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 */
scalar_t__ A_BOLD;
scalar_t__ COLOR_PAIR(int);
int /*<<< orphan*/ setfield_int(char *, scalar_t__);
int /*<<< orphan*/ toupper(int /*<<< orphan*/);
void push_color_pair(char *name, int pairnum) {
  setfield_int(name, COLOR_PAIR(pairnum));
  char allcaps[32], *outch = allcaps;
  do {
    *outch++ = toupper(*name++);
  } while (*name);
  *outch = '\0';
  setfield_int(allcaps, COLOR_PAIR(pairnum) + A_BOLD);
}


x86 assembly (clang, -O0):
<push_color_pair>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <COLOR_PAIR@plt>
mov    -0x40(%rbp),%rdi
mov    %rax,%rsi
call   1030 <setfield_int@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1040 <toupper@plt>
mov    %al,%cl
mov    -0x38(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x38(%rbp)
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1163 <push_color_pair+0x33>
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x30(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <COLOR_PAIR@plt>
mov    -0x48(%rbp),%rdi
mov    %rax,%rsi
mov    0x2e21(%rip),%rax
add    (%rax),%rsi
call   1030 <setfield_int@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<push_color_pair>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
mov    %esi,%edi
call   1050 <COLOR_PAIR@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <setfield_int@plt>
mov    (%rbx),%al
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %al,%edi
call   1040 <toupper@plt>
mov    %al,(%rsp,%rbp,1)
movzbl 0x1(%rbx,%rbp,1),%eax
add    $0x1,%rbp
test   %al,%al
jne    1160 <push_color_pair+0x30>
movb   $0x0,(%rsp,%rbp,1)
mov    %r14d,%edi
call   1050 <COLOR_PAIR@plt>
mov    0x2e55(%rip),%rcx
add    (%rcx),%rax
mov    %rsp,%rdi
mov    %rax,%rsi
call   1030 <setfield_int@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@A_BOLD = global i64 0
define void @push_color_pair(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [32 x i8]
%6 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = call i64 @COLOR_PAIR(i32 %8)
%10 = call i32 @setfield_int(i8* %7, i64 %9)
%11 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
store i8* %11, i8** %6
br label %12
12: ; preds = %21, %2
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %3
%15 = load i8, i8* %13
%16 = sext i8 %15 to i32
%17 = call i32 @toupper(i32 %16)
%18 = trunc i32 %17 to i8
%19 = load i8*, i8** %6
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %6
store i8 %18, i8* %19
br label %21
21: ; preds = %12
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
%24 = icmp ne i8 %23, 0
br i1 %24, label %12, label %25
25: ; preds = %21
%26 = load i8*, i8** %6
store i8 0, i8* %26
%27 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%28 = load i32, i32* %4
%29 = call i64 @COLOR_PAIR(i32 %28)
%30 = load i64, i64* @A_BOLD
%31 = add nsw i64 %29, %30
%32 = call i32 @setfield_int(i8* %27, i64 %31)
ret void
}

LLVM IR (-O2):
@A_BOLD = global i64 0
define void @push_color_pair(i8* %0, i32 %1) {
%3 = alloca [32 x i8]
%4 = tail call i64 @COLOR_PAIR(i32 %1)
%5 = tail call i32 @setfield_int(i8* %0, i64 %4)
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%7 = load i8, i8* %0
br label %8
8: ; preds = %8, %2
%9 = phi i8 [ %7, %2 ], [ %17, %8 ]
%10 = phi i8* [ %0, %2 ], [ %12, %8 ]
%11 = phi i8* [ %6, %2 ], [ %16, %8 ]
%12 = getelementptr inbounds i8, i8* %10, i64 1
%13 = sext i8 %9 to i32
%14 = tail call i32 @toupper(i32 %13)
%15 = trunc i32 %14 to i8
%16 = getelementptr inbounds i8, i8* %11, i64 1
store i8 %15, i8* %11
%17 = load i8, i8* %12
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %8
19: ; preds = %8
store i8 0, i8* %16
%20 = tail call i64 @COLOR_PAIR(i32 %1)
%21 = load i64, i64* @A_BOLD
%22 = add nsw i64 %21, %20
%23 = call i32 @setfield_int(i8* %6, i64 %22)
ret void
}