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

/* Variables and functions */
struct node *append(struct node *, struct node *, int);
int /*<<< orphan*/ printf(char *, int);
struct node *push(struct node *, int);
int /*<<< orphan*/ scanf(char *, int *);
void not_random_add(struct node **head, struct node **tail, int x) {
  int add;
  printf("Enter #%d: ", (x + 1));
  scanf("%d", &add);
  if (*head == NULL) {
    *head = push(*head, x);
    *tail = *head;
  } else {
    *tail = append(*head, *tail, add);
  }
}


x86 assembly (clang, -O0):
<not_random_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%esi
add    $0x1,%esi
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
lea    0xea0(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jne    11af <not_random_add+0x6f>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x14(%rbp),%esi
call   1060 <push@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
jmp    11cf <not_random_add+0x8f>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x18(%rbp),%edx
call   1030 <append@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<not_random_add>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0x1(%rbx),%esi
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
lea    0xea5(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    (%r15),%rdi
test   %rdi,%rdi
je     1187 <not_random_add+0x47>
mov    (%r14),%rsi
mov    0xc(%rsp),%edx
call   1030 <append@plt>
jmp    1193 <not_random_add+0x53>
xor    %edi,%edi
mov    %ebx,%esi
call   1060 <push@plt>
mov    %rax,(%r15)
mov    %rax,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [12 x i8] c"Enter #%d: \00"
@.str.1 = [3 x i8] c"%d\00"
define void @not_random_add(%struct.node** %0, %struct.node** %1, i32 %2) {
%4 = alloca %struct.node**
%5 = alloca %struct.node**
%6 = alloca i32
%7 = alloca i32
store %struct.node** %0, %struct.node*** %4
store %struct.node** %1, %struct.node*** %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = add nsw i32 %8, 1
%10 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%12 = load %struct.node**, %struct.node*** %4
%13 = load %struct.node*, %struct.node** %12
%14 = icmp eq %struct.node* %13, null
br i1 %14, label %15, label %24
15: ; preds = %3
%16 = load %struct.node**, %struct.node*** %4
%17 = load %struct.node*, %struct.node** %16
%18 = load i32, i32* %6
%19 = call %struct.node* @push(%struct.node* %17, i32 %18)
%20 = load %struct.node**, %struct.node*** %4
store %struct.node* %19, %struct.node** %20
%21 = load %struct.node**, %struct.node*** %4
%22 = load %struct.node*, %struct.node** %21
%23 = load %struct.node**, %struct.node*** %5
store %struct.node* %22, %struct.node** %23
br label %32
24: ; preds = %3
%25 = load %struct.node**, %struct.node*** %4
%26 = load %struct.node*, %struct.node** %25
%27 = load %struct.node**, %struct.node*** %5
%28 = load %struct.node*, %struct.node** %27
%29 = load i32, i32* %7
%30 = call %struct.node* @append(%struct.node* %26, %struct.node* %28, i32 %29)
%31 = load %struct.node**, %struct.node*** %5
store %struct.node* %30, %struct.node** %31
br label %32
32: ; preds = %24, %15
ret void
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [12 x i8] c"Enter #%d: \00"
@.str.1 = [3 x i8] c"%d\00"
define void @not_random_add(%struct.node** nocapture %0, %struct.node** nocapture %1, i32 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = add nsw i32 %2, 1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%9 = load %struct.node*, %struct.node** %0
%10 = icmp eq %struct.node* %9, null
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = call %struct.node* @push(%struct.node* null, i32 %2)
store %struct.node* %12, %struct.node** %0
br label %17
13: ; preds = %3
%14 = load %struct.node*, %struct.node** %1
%15 = load i32, i32* %4
%16 = call %struct.node* @append(%struct.node* %9, %struct.node* %14, i32 %15)
br label %17
17: ; preds = %13, %11
%18 = phi %struct.node* [ %16, %13 ], [ %12, %11 ]
store %struct.node* %18, %struct.node** %1
ret void
}