#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 */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *snprint_list(char *, int, char const *const *);
int /*<<< orphan*/ stderr;
void test_print_list(void) {
  static const char *const test_value[] = {"DEFAULT", "IGNORE", "ERROR", "ABCD",
                                           "123",     "QQ",     "Z",     NULL};
  char buf[73] = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
                 "XXXXXXXXXXXX";
  int i;
  for (i = 0; i < sizeof(buf); i++)
    fprintf(stderr, "(%s)\n", snprint_list(buf, i, test_value));
}


x86 assembly (clang, -O0):
<test_print_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x50(%rbp),%rdi
mov    $0x58,%esi
mov    $0x49,%edx
call   1030 <memset@plt>
movl   $0x0,-0x54(%rbp)
movslq -0x54(%rbp),%rax
cmp    $0x49,%rax
jae    119f <test_print_list+0x6f>
mov    0x2e71(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x58(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x54(%rbp),%esi
lea    0x2c56(%rip),%rdx
call   1050 <snprint_list@plt>
mov    -0x58(%rbp),%edi
mov    %rax,%rdx
lea    0xe97(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1152 <test_print_list+0x22>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_print_list>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movaps 0xecb(%rip),%xmm0
movups %xmm0,0x39(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
xor    %ebx,%ebx
mov    0x2e82(%rip),%r13
lea    0x2c73(%rip),%r14
mov    %rsp,%r15
lea    0xecc(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13),%ebp
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
call   1040 <snprint_list@plt>
mov    %ebp,%edi
mov    %r12,%rsi
mov    %rax,%rdx
call   1030 <fprintf@plt>
add    $0x1,%ebx
cmp    $0x49,%ebx
jne    1170 <test_print_list+0x50>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@test_print_list.test_value = internal constant [8 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i32 0, i32 0), i8* null]
@.str = [8 x i8] c"DEFAULT\00"
@.str.1 = [7 x i8] c"IGNORE\00"
@.str.2 = [6 x i8] c"ERROR\00"
@.str.3 = [5 x i8] c"ABCD\00"
@.str.4 = [4 x i8] c"123\00"
@.str.5 = [3 x i8] c"QQ\00"
@.str.6 = [2 x i8] c"Z\00"
@stderr = global i32 0
@.str.7 = [6 x i8] c"(%s)\0A\00"
define void @test_print_list() {
%1 = alloca [73 x i8]
%2 = alloca i32
%3 = bitcast [73 x i8]* %1 to i8*
store i32 0, i32* %2
br label %4
4: ; preds = %14, %0
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = icmp ult i64 %6, 73
br i1 %7, label %8, label %17
8: ; preds = %4
%9 = load i32, i32* @stderr
%10 = getelementptr inbounds [73 x i8], [73 x i8]* %1, i64 0, i64 0
%11 = load i32, i32* %2
%12 = call i8* @snprint_list(i8* %10, i32 %11, i8** getelementptr inbounds ([8 x i8*], [8 x i8*]* @test_print_list.test_value, i64 0, i64 0))
%13 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %8
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %4
17: ; preds = %4
ret void
}

LLVM IR (-O2):
@test_print_list.test_value = internal constant [8 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i32 0, i32 0), i8* null]
@.str = [8 x i8] c"DEFAULT\00"
@.str.1 = [7 x i8] c"IGNORE\00"
@.str.2 = [6 x i8] c"ERROR\00"
@.str.3 = [5 x i8] c"ABCD\00"
@.str.4 = [4 x i8] c"123\00"
@.str.5 = [3 x i8] c"QQ\00"
@.str.6 = [2 x i8] c"Z\00"
@stderr = global i32 0
@.str.7 = [6 x i8] c"(%s)\0A\00"
define void @test_print_list() {
%1 = alloca [73 x i8]
%2 = getelementptr inbounds [73 x i8], [73 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %8, %3 ]
%5 = load i32, i32* @stderr
%6 = call i8* @snprint_list(i8* %2, i32 %4, i8** getelementptr inbounds ([8 x i8*], [8 x i8*]* @test_print_list.test_value, i64 0, i64 0))
%7 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %6)
%8 = add nuw nsw i32 %4, 1
%9 = icmp eq i32 %8, 73
br i1 %9, label %10, label %3
10: ; preds = %3
ret void
}