#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 *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
struct ListNode *node_build(char *);
int /*<<< orphan*/ show(struct ListNode *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc < 3) {
    fprintf(stderr, "Usage: ./test n1 n2\n");
    exit(-1);
  }
  struct ListNode *l1 = node_build(argv[1]);
  struct ListNode *l2 = node_build(argv[2]);
  struct ListNode *res = addTwoNumbers(l1, l2);
  show(l1);
  show(l2);
  show(res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    118f <main+0x3f>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
lea    0xe80(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <node_build@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <node_build@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <addTwoNumbers@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <show@plt>
mov    -0x20(%rbp),%rdi
call   1040 <show@plt>
mov    -0x28(%rbp),%rdi
call   1040 <show@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x2,%edi
jle    11a3 <main+0x53>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1060 <node_build@plt>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
call   1060 <node_build@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <addTwoNumbers@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1040 <show@plt>
mov    %rbx,%rdi
call   1040 <show@plt>
mov    %r15,%rdi
call   1040 <show@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
lea    0xe4d(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
%struct.ListNode = type { i32 }
@stderr = global i32 0
@.str = [21 x i8] c"Usage: ./test n1 n2\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.ListNode*
%7 = alloca %struct.ListNode*
%8 = alloca %struct.ListNode*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 -1)
unreachable
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call %struct.ListNode* @node_build(i8* %18)
store %struct.ListNode* %19, %struct.ListNode** %6
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call %struct.ListNode* @node_build(i8* %22)
store %struct.ListNode* %23, %struct.ListNode** %7
%24 = load %struct.ListNode*, %struct.ListNode** %6
%25 = load %struct.ListNode*, %struct.ListNode** %7
%26 = call %struct.ListNode* @addTwoNumbers(%struct.ListNode* %24, %struct.ListNode* %25)
store %struct.ListNode* %26, %struct.ListNode** %8
%27 = load %struct.ListNode*, %struct.ListNode** %6
%28 = call i32 @show(%struct.ListNode* %27)
%29 = load %struct.ListNode*, %struct.ListNode** %7
%30 = call i32 @show(%struct.ListNode* %29)
%31 = load %struct.ListNode*, %struct.ListNode** %8
%32 = call i32 @show(%struct.ListNode* %31)
ret i32 0
}

LLVM IR (-O2):
%struct.ListNode = type { i32 }
@stderr = global i32 0
@.str = [21 x i8] c"Usage: ./test n1 n2\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call %struct.ListNode* @node_build(i8* %10)
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call %struct.ListNode* @node_build(i8* %13)
%15 = tail call %struct.ListNode* @addTwoNumbers(%struct.ListNode* %11, %struct.ListNode* %14)
%16 = tail call i32 @show(%struct.ListNode* %11)
%17 = tail call i32 @show(%struct.ListNode* %14)
%18 = tail call i32 @show(%struct.ListNode* %15)
ret i32 0
}