#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 *create(struct node *, float, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
struct node *input(struct node *start) {
  int i, n, ex;
  float co;
  printf("No of terms to be entered: ");
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    printf("Enter coefficient for term %d: ", i);
    scanf("%f", &co);
    printf("Enter exponent for term %d: ", i);
    scanf("%d", &ex);
    start = create(start, co, ex);
  }
  return start;
}


x86 assembly (clang, -O0):
<input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11d8 <input+0xa8>
mov    -0xc(%rbp),%esi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0xc(%rbp),%esi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe72(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x8(%rbp),%rdi
movss  -0x18(%rbp),%xmm0
mov    -0x14(%rbp),%esi
call   1040 <create@plt>
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1163 <input+0x33>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11ec <input+0xbc>
lea    0x10(%rsp),%r12
lea    0xec9(%rip),%r13
lea    0xe9c(%rip),%rbp
lea    0x14(%rsp),%r14
xor    %r15d,%r15d
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15d
lea    0xe84(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe93(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %r13,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x10(%rsp),%xmm0
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
call   1040 <create@plt>
mov    %rax,%rbx
cmp    0xc(%rsp),%r15d
jl     1190 <input+0x60>
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [28 x i8] c"No of terms to be entered: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [32 x i8] c"Enter coefficient for term %d: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [29 x i8] c"Enter exponent for term %d: \00"
define %struct.node* @input(%struct.node* %0) {
%2 = alloca %struct.node*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
store %struct.node* %0, %struct.node** %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
store i32 1, i32* %3
br label %9
9: ; preds = %24, %1
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %27
13: ; preds = %9
%14 = load i32, i32* %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %6)
%17 = load i32, i32* %3
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %17)
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%20 = load %struct.node*, %struct.node** %2
%21 = load float, float* %6
%22 = load i32, i32* %5
%23 = call %struct.node* @create(%struct.node* %20, float %21, i32 %22)
store %struct.node* %23, %struct.node** %2
br label %24
24: ; preds = %13
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %9
27: ; preds = %9
%28 = load %struct.node*, %struct.node** %2
ret %struct.node* %28
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [28 x i8] c"No of terms to be entered: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [32 x i8] c"Enter coefficient for term %d: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [29 x i8] c"Enter exponent for term %d: \00"
define %struct.node* @input(%struct.node* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = bitcast float* %4 to i8*
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 1
br i1 %11, label %25, label %12
12: ; preds = %1, %12
%13 = phi i32 [ %22, %12 ], [ 1, %1 ]
%14 = phi %struct.node* [ %21, %12 ], [ %0, %1 ]
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %4)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %13)
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%19 = load float, float* %4
%20 = load i32, i32* %3
%21 = call %struct.node* @create(%struct.node* %14, float %19, i32 %20)
%22 = add nuw nsw i32 %13, 1
%23 = load i32, i32* %2
%24 = icmp slt i32 %13, %23
br i1 %24, label %12, label %25
25: ; preds = %12, %1
%26 = phi %struct.node* [ %0, %1 ], [ %21, %12 ]
ret %struct.node* %26
}