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

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  int n, sum = 0;
  struct stu *merge(void);
  struct stu *insert(struct stu *, struct stu *);
  void print(struct stu *);
  struct stu *ahead, *bhead, *abh;
  printf("input list a:\n");
  printf("press '0' to continue\n");
  ahead = merge();
  sum = sum + n;
  printf("input list b:\n");
  bhead = merge();
  sum = sum + n;
  abh = insert(ahead, bhead);
  print(abh);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
call   1050 <merge@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
call   1050 <merge@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <insert@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <print@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
call   1050 <merge@plt>
mov    %rax,%rbx
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
call   1050 <merge@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1060 <insert@plt>
mov    %rax,%rdi
call   1040 <print@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.stu = type { i32 }
@.str = [15 x i8] c"input list a:\0A\00"
@.str.1 = [23 x i8] c"press '0' to continue\0A\00"
@.str.2 = [15 x i8] c"input list b:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.stu*
%5 = alloca %struct.stu*
%6 = alloca %struct.stu*
store i32 0, i32* %1
store i32 0, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%9 = call %struct.stu* @merge()
store %struct.stu* %9, %struct.stu** %4
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = add nsw i32 %10, %11
store i32 %12, i32* %3
%13 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%14 = call %struct.stu* @merge()
store %struct.stu* %14, %struct.stu** %5
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = add nsw i32 %15, %16
store i32 %17, i32* %3
%18 = load %struct.stu*, %struct.stu** %4
%19 = load %struct.stu*, %struct.stu** %5
%20 = call %struct.stu* @insert(%struct.stu* %18, %struct.stu* %19)
store %struct.stu* %20, %struct.stu** %6
%21 = load %struct.stu*, %struct.stu** %6
ret i32 0
}

LLVM IR (-O2):
%struct.stu = type { i32 }
@str = [14 x i8] c"input list a:\00"
@str.3 = [22 x i8] c"press '0' to continue\00"
@str.4 = [14 x i8] c"input list b:\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.3, i64 0, i64 0))
%3 = tail call %struct.stu* @merge()
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.4, i64 0, i64 0))
%5 = tail call %struct.stu* @merge()
%6 = tail call %struct.stu* @insert(%struct.stu* %3, %struct.stu* %5)
tail call void @print(%struct.stu* %6)
ret i32 0
}