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

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ bignumberplus(struct strlnode **, struct strlnode **,
                                 struct strlnode **);
int /*<<< orphan*/ create(struct strlnode **, int /*<<< orphan*/);
int /*<<< orphan*/ readtolnode(struct strlnode **, int *, int);
int /*<<< orphan*/ writetosqlist(int *, struct strlnode *);
void TestCase05_1() {
  struct strlnode *plus;
  struct strlnode *p;
  struct strlnode *q;
  int a[] = {4, 8, 6, 3, 0, 2, 7, 9, 3, 1, 0, 4, 2, 1, 3, 5, 2, 6};
  int b[] = {9, 2, 0, 8, 6, 7, 8, 3, 1, 0, 3, 6, 9, 2, 0, 1, 6, 8};
  int j = 0;
  create(&plus, 0);
  create(&p, 0);
  create(&q, 0);
  readtolnode(&p, a, 18);
  readtolnode(&q, b, 18);
  bignumberplus(&plus, &p, &q);
  int result[19];
  writetosqlist(result, plus);
  int c[] = {1, 4, 0, 7, 1, 7, 0, 6, 2, 4, 1, 4, 1, 1, 3, 3, 6, 9, 4};
  for (j = 0; j < 19; j++) {
    assert(result[j] == c[j]);
  }
}


x86 assembly (clang, -O0):
<TestCase05_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
lea    -0x60(%rbp),%rdi
lea    0xe8a(%rip),%rsi
mov    $0x48,%edx
call   1070 <memcpy@plt>
lea    -0xb0(%rbp),%rdi
lea    0xec2(%rip),%rsi
mov    $0x48,%edx
call   1070 <memcpy@plt>
movl   $0x0,-0xb4(%rbp)
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1050 <create@plt>
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1050 <create@plt>
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1050 <create@plt>
lea    -0x60(%rbp),%rsi
lea    -0x10(%rbp),%rdi
mov    $0x12,%edx
call   1080 <readtolnode@plt>
lea    -0xb0(%rbp),%rsi
lea    -0x18(%rbp),%rdi
mov    $0x12,%edx
call   1080 <readtolnode@plt>
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <bignumberplus@plt>
lea    -0x100(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <writetosqlist@plt>
lea    -0x150(%rbp),%rdi
lea    0xe87(%rip),%rsi
mov    $0x4c,%edx
call   1070 <memcpy@plt>
movl   $0x0,-0xb4(%rbp)
cmpl   $0x13,-0xb4(%rbp)
jge    1277 <TestCase05_1+0x117>
movslq -0xb4(%rbp),%rax
mov    -0x100(%rbp,%rax,4),%eax
movslq -0xb4(%rbp),%rcx
cmp    -0x150(%rbp,%rcx,4),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    122d <TestCase05_1+0xcd>
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestCase05_1>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    0xedb(%rip),%rax
mov    %rax,0xb0(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xe9d(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xe7e(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xe5f(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
mov    0xee3(%rip),%rax
mov    %rax,0x60(%rsp)
movaps 0xec7(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xeab(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe8f(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe73(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0x8(%rsp),%r14
xor    %ebx,%ebx
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <create@plt>
lea    0x18(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
call   1050 <create@plt>
lea    0x10(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
call   1050 <create@plt>
lea    0x70(%rsp),%rsi
mov    %r15,%rdi
mov    $0x12,%edx
call   1070 <readtolnode@plt>
lea    0x20(%rsp),%rsi
mov    %r12,%rdi
mov    $0x12,%edx
call   1070 <readtolnode@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <bignumberplus@plt>
mov    0x8(%rsp),%rsi
lea    0xc0(%rsp),%rdi
call   1030 <writetosqlist@plt>
lea    0xe44(%rip),%r14
nopl   0x0(%rax)
mov    0xc0(%rsp,%rbx,1),%eax
xor    %edi,%edi
cmp    (%rbx,%r14,1),%eax
sete   %dil
call   1060 <assert@plt>
add    $0x4,%rbx
cmp    $0x4c,%rbx
jne    1260 <TestCase05_1+0x110>
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.strlnode = type { i32 }
@__const.TestCase05_1.a = [18 x i32] [i32 4, i32 8, i32 6, i32 3, i32 0, i32 2, i32 7, i32 9, i32 3, i32 1, i32 0, i32 4, i32 2, i32 1, i32 3, i32 5, i32 2, i32 6]
@__const.TestCase05_1.b = [18 x i32] [i32 9, i32 2, i32 0, i32 8, i32 6, i32 7, i32 8, i32 3, i32 1, i32 0, i32 3, i32 6, i32 9, i32 2, i32 0, i32 1, i32 6, i32 8]
@__const.TestCase05_1.c = [19 x i32] [i32 1, i32 4, i32 0, i32 7, i32 1, i32 7, i32 0, i32 6, i32 2, i32 4, i32 1, i32 4, i32 1, i32 1, i32 3, i32 3, i32 6, i32 9, i32 4]
define void @TestCase05_1() {
%1 = alloca %struct.strlnode*
%2 = alloca %struct.strlnode*
%3 = alloca %struct.strlnode*
%4 = alloca [18 x i32]
%5 = alloca [18 x i32]
%6 = alloca i32
%7 = alloca [19 x i32]
%8 = alloca [19 x i32]
%9 = bitcast [18 x i32]* %4 to i8*
%10 = bitcast [18 x i32]* %5 to i8*
store i32 0, i32* %6
%11 = call i32 @create(%struct.strlnode** %1, i32 0)
%12 = call i32 @create(%struct.strlnode** %2, i32 0)
%13 = call i32 @create(%struct.strlnode** %3, i32 0)
%14 = getelementptr inbounds [18 x i32], [18 x i32]* %4, i64 0, i64 0
%15 = call i32 @readtolnode(%struct.strlnode** %2, i32* %14, i32 18)
%16 = getelementptr inbounds [18 x i32], [18 x i32]* %5, i64 0, i64 0
%17 = call i32 @readtolnode(%struct.strlnode** %3, i32* %16, i32 18)
%18 = call i32 @bignumberplus(%struct.strlnode** %1, %struct.strlnode** %2, %struct.strlnode** %3)
%19 = getelementptr inbounds [19 x i32], [19 x i32]* %7, i64 0, i64 0
%20 = load %struct.strlnode*, %struct.strlnode** %1
%21 = call i32 @writetosqlist(i32* %19, %struct.strlnode* %20)
%22 = bitcast [19 x i32]* %8 to i8*
store i32 0, i32* %6
br label %23
23: ; preds = %38, %0
%24 = load i32, i32* %6
%25 = icmp slt i32 %24, 19
br i1 %25, label %26, label %41
26: ; preds = %23
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [19 x i32], [19 x i32]* %7, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [19 x i32], [19 x i32]* %8, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = icmp eq i32 %30, %34
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
br label %38
38: ; preds = %26
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %23
41: ; preds = %23
ret void
}

LLVM IR (-O2):
%struct.strlnode = type { i32 }
@__const.TestCase05_1.a = [18 x i32] [i32 4, i32 8, i32 6, i32 3, i32 0, i32 2, i32 7, i32 9, i32 3, i32 1, i32 0, i32 4, i32 2, i32 1, i32 3, i32 5, i32 2, i32 6]
@__const.TestCase05_1.b = [18 x i32] [i32 9, i32 2, i32 0, i32 8, i32 6, i32 7, i32 8, i32 3, i32 1, i32 0, i32 3, i32 6, i32 9, i32 2, i32 0, i32 1, i32 6, i32 8]
@__const.TestCase05_1.c = [19 x i32] [i32 1, i32 4, i32 0, i32 7, i32 1, i32 7, i32 0, i32 6, i32 2, i32 4, i32 1, i32 4, i32 1, i32 1, i32 3, i32 3, i32 6, i32 9, i32 4]
define void @TestCase05_1() {
%1 = alloca %struct.strlnode*
%2 = alloca %struct.strlnode*
%3 = alloca %struct.strlnode*
%4 = alloca [18 x i32]
%5 = alloca [18 x i32]
%6 = alloca [19 x i32]
%7 = bitcast %struct.strlnode** %1 to i8*
%8 = bitcast %struct.strlnode** %2 to i8*
%9 = bitcast %struct.strlnode** %3 to i8*
%10 = bitcast [18 x i32]* %4 to i8*
%11 = bitcast [18 x i32]* %5 to i8*
%12 = call i32 @create(%struct.strlnode** %1, i32 0)
%13 = call i32 @create(%struct.strlnode** %2, i32 0)
%14 = call i32 @create(%struct.strlnode** %3, i32 0)
%15 = getelementptr inbounds [18 x i32], [18 x i32]* %4, i64 0, i64 0
%16 = call i32 @readtolnode(%struct.strlnode** %2, i32* %15, i32 18)
%17 = getelementptr inbounds [18 x i32], [18 x i32]* %5, i64 0, i64 0
%18 = call i32 @readtolnode(%struct.strlnode** %3, i32* %17, i32 18)
%19 = call i32 @bignumberplus(%struct.strlnode** %1, %struct.strlnode** %2, %struct.strlnode** %3)
%20 = bitcast [19 x i32]* %6 to i8*
%21 = getelementptr inbounds [19 x i32], [19 x i32]* %6, i64 0, i64 0
%22 = load %struct.strlnode*, %struct.strlnode** %1
%23 = call i32 @writetosqlist(i32* %21, %struct.strlnode* %22)
br label %24
24: ; preds = %0, %24
%25 = phi i64 [ 0, %0 ], [ %33, %24 ]
%26 = getelementptr inbounds [19 x i32], [19 x i32]* %6, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = getelementptr inbounds [19 x i32], [19 x i32]* @__const.TestCase05_1.c, i64 0, i64 %25
%29 = load i32, i32* %28
%30 = icmp eq i32 %27, %29
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = add nuw nsw i64 %25, 1
%34 = icmp eq i64 %33, 19
br i1 %34, label %35, label %24
35: ; preds = %24
ret void
}