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

/* Variables and functions */
struct ListNode *addTwoNumbers(struct ListNode *, struct ListNode *);
struct ListNode *createByArray(int *);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ showListNode(struct ListNode *);
void testAddTowNumber(void) {
  int input1[] = {5, -1};
  int input2[] = {5, -1};
  struct ListNode *inputList1 = createByArray(input1);
  struct ListNode *inputList2 = createByArray(input2);
  showListNode(inputList1);
  putchar('\n');
  showListNode(inputList2);
  putchar('\n');
  struct ListNode *result = addTwoNumbers(inputList1, inputList2);
  showListNode(result);
}


x86 assembly (clang, -O0):
<testAddTowNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xeb1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0xea6(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x8(%rbp),%rdi
call   1050 <createByArray@plt>
mov    %rax,-0x18(%rbp)
lea    -0x10(%rbp),%rdi
call   1050 <createByArray@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <showListNode@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x20(%rbp),%rdi
call   1060 <showListNode@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <addTwoNumbers@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1060 <showListNode@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testAddTowNumber>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movabs $0xffffffff00000005,%rax
ff ff ff
mov    %rax,0x10(%rsp)
mov    %rax,0x8(%rsp)
lea    0x10(%rsp),%rdi
call   1050 <createByArray@plt>
mov    %rax,%r14
lea    0x8(%rsp),%rdi
call   1050 <createByArray@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1060 <showListNode@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1060 <showListNode@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <addTwoNumbers@plt>
mov    %rax,%rdi
call   1060 <showListNode@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.ListNode = type { i32 }
@__const.testAddTowNumber.input1 = [2 x i32] [i32 5, i32 -1]
@__const.testAddTowNumber.input2 = [2 x i32] [i32 5, i32 -1]
define void @testAddTowNumber() {
%1 = alloca [2 x i32]
%2 = alloca [2 x i32]
%3 = alloca %struct.ListNode*
%4 = alloca %struct.ListNode*
%5 = alloca %struct.ListNode*
%6 = bitcast [2 x i32]* %1 to i8*
%7 = bitcast [2 x i32]* %2 to i8*
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%9 = call %struct.ListNode* @createByArray(i32* %8)
store %struct.ListNode* %9, %struct.ListNode** %3
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%11 = call %struct.ListNode* @createByArray(i32* %10)
store %struct.ListNode* %11, %struct.ListNode** %4
%12 = load %struct.ListNode*, %struct.ListNode** %3
%13 = call i32 @showListNode(%struct.ListNode* %12)
%14 = call i32 @putchar(i8 signext 10)
%15 = load %struct.ListNode*, %struct.ListNode** %4
%16 = call i32 @showListNode(%struct.ListNode* %15)
%17 = call i32 @putchar(i8 signext 10)
%18 = load %struct.ListNode*, %struct.ListNode** %3
%19 = load %struct.ListNode*, %struct.ListNode** %4
%20 = call %struct.ListNode* @addTwoNumbers(%struct.ListNode* %18, %struct.ListNode* %19)
store %struct.ListNode* %20, %struct.ListNode** %5
%21 = load %struct.ListNode*, %struct.ListNode** %5
%22 = call i32 @showListNode(%struct.ListNode* %21)
ret void
}

LLVM IR (-O2):
%struct.ListNode = type { i32 }
define void @testAddTowNumber() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
store i64 -4294967291, i64* %1
%4 = bitcast i64* %2 to i8*
store i64 -4294967291, i64* %2
%5 = bitcast i64* %1 to i32*
%6 = call %struct.ListNode* @createByArray(i32* %5)
%7 = bitcast i64* %2 to i32*
%8 = call %struct.ListNode* @createByArray(i32* %7)
%9 = call i32 @showListNode(%struct.ListNode* %6)
%10 = call i32 @putchar(i8 signext 10)
%11 = call i32 @showListNode(%struct.ListNode* %8)
%12 = call i32 @putchar(i8 signext 10)
%13 = call %struct.ListNode* @addTwoNumbers(%struct.ListNode* %6, %struct.ListNode* %8)
%14 = call i32 @showListNode(%struct.ListNode* %13)
ret void
}