#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 */
typedef int /*<<< orphan*/ temp;
struct node15 {
  int dummy;
};

/* Variables and functions */
struct node15 *add_num15(struct node15 *, struct node15 *, char *);
struct node15 *create_list15(struct node15 *, struct node15 *, char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
struct node15 *getLowest15(struct node15 *, struct node15 *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
int main() {
  int n, i;
  char string[1000], temp[1000] = "";
  struct node15 *head = NULL, *current;
  printf("Input n: ");
  scanf("%d", &n);
  getchar();
  printf("Input %d numbers (separated by a comma): ", n);
  fgets(string, 1000, stdin);
  string[strlen(string) - 1] = '\0';
  printf("The output is: ");
  for (i = 0; i < strlen(string); i++) {
    for (i; string[i] != ',' && i < strlen(string); i++) {
      strncat(temp, &string[i], 1);
    }
    if (head == NULL) {
      head = create_list15(head, current, temp);
      memset(temp, 0, sizeof(temp));
    } else {
      head = add_num15(head, current, temp);
      memset(temp, 0, sizeof(temp));
    }
  }
  while (head) {
    current = head;
    head = getLowest15(head, current);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x7f0(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1060 <memset@plt>
movq   $0x0,-0x7f8(%rbp)
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe25(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   10b0 <scanf@plt>
mov    $0x0,%al
call   1090 <getchar@plt>
mov    -0x8(%rbp),%esi
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x400(%rbp),%rdi
mov    0x2dd4(%rip),%rax
mov    (%rax),%edx
mov    $0x3e8,%esi
call   1080 <fgets@plt>
lea    -0x400(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x400(%rbp,%rax,1)
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x804(%rbp)
lea    -0x400(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x804(%rbp),%eax
cmp    %ecx,%eax
jge    1386 <main+0x1e6>
movslq -0xc(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0x2c,%ecx
mov    %al,-0x805(%rbp)
je     12b8 <main+0x118>
mov    -0xc(%rbp),%eax
mov    %eax,-0x80c(%rbp)
lea    -0x400(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x80c(%rbp),%eax
cmp    %ecx,%eax
setl   %al
mov    %al,-0x805(%rbp)
mov    -0x805(%rbp),%al
test   $0x1,%al
jne    12cb <main+0x12b>
jmp    12f8 <main+0x158>
lea    -0x7f0(%rbp),%rdi
movslq -0xc(%rbp),%rax
lea    -0x400(%rbp),%rsi
add    %rax,%rsi
mov    $0x1,%edx
call   1070 <strncat@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1273 <main+0xd3>
cmpq   $0x0,-0x7f8(%rbp)
jne    133f <main+0x19f>
mov    -0x7f8(%rbp),%rdi
mov    -0x800(%rbp),%rsi
lea    -0x7f0(%rbp),%rdx
call   10c0 <create_list15@plt>
mov    %rax,-0x7f8(%rbp)
lea    -0x7f0(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1060 <memset@plt>
jmp    1373 <main+0x1d3>
mov    -0x7f8(%rbp),%rdi
mov    -0x800(%rbp),%rsi
lea    -0x7f0(%rbp),%rdx
call   1030 <add_num15@plt>
mov    %rax,-0x7f8(%rbp)
lea    -0x7f0(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1060 <memset@plt>
jmp    1378 <main+0x1d8>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    124e <main+0xae>
jmp    138b <main+0x1eb>
cmpq   $0x0,-0x7f8(%rbp)
je     13c6 <main+0x226>
mov    -0x7f8(%rbp),%rax
mov    %rax,-0x800(%rbp)
mov    -0x7f8(%rbp),%rdi
mov    -0x800(%rbp),%rsi
call   10a0 <getLowest15@plt>
mov    %rax,-0x7f8(%rbp)
jmp    138b <main+0x1eb>
mov    -0x4(%rbp),%eax
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x7f0,%rsp
lea    0x400(%rsp),%rdi
xor    %r13d,%r13d
mov    $0x3e8,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0xe32(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe2e(%rip),%rdi
lea    0xc(%rsp),%rsi
call   10b0 <scanf@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
mov    0xc(%rsp),%esi
lea    0xe15(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2de2(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x3e8,%esi
call   1080 <fgets@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r14,1)
lea    0xe06(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1313 <main+0x173>
lea    0x400(%rsp),%r14
lea    0x10(%rsp),%r15
xor    %r12d,%r12d
jmp    1296 <main+0xf6>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%r13
test   %r12,%r12
je     12e0 <main+0x140>
mov    %r12,%rdi
mov    %r14,%rdx
call   1030 <add_num15@plt>
mov    %rax,%r12
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1060 <memset@plt>
add    $0x1,%r13d
mov    %r15,%rdi
call   1040 <strlen@plt>
cmp    %eax,%r13d
jge    12ec <main+0x14c>
movslq %r13d,%rbx
cmpb   $0x2c,0x10(%rsp,%rbx,1)
je     1263 <main+0xc3>
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    1260 <main+0xc0>
lea    (%rsp,%rbx,1),%rsi
add    $0x10,%rsi
mov    %r14,%rdi
mov    $0x1,%edx
call   1070 <strncat@plt>
lea    0x1(%rbx),%r13
cmpb   $0x2c,0x11(%rsp,%rbx,1)
mov    %r13,%rbx
jne    12a0 <main+0x100>
jmp    1263 <main+0xc3>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %edi,%edi
mov    %r14,%rdx
call   10c0 <create_list15@plt>
jmp    1273 <main+0xd3>
test   %r12,%r12
je     1313 <main+0x173>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r12,%rsi
call   10a0 <getLowest15@plt>
mov    %rax,%r12
test   %rax,%rax
jne    1300 <main+0x160>
xor    %eax,%eax
add    $0x7f0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.node15 = type { i32 }
@.str = [10 x i8] c"Input n: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [42 x i8] c"Input %d numbers (separated by a comma): \00"
@stdin = global i32 0
@.str.3 = [16 x i8] c"The output is: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1000 x i8]
%5 = alloca [1000 x i8]
%6 = alloca %struct.node15*
%7 = alloca %struct.node15*
store i32 0, i32* %1
%8 = bitcast [1000 x i8]* %5 to i8*
store %struct.node15* null, %struct.node15** %6
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = call i32 (...) @getchar()
%12 = load i32, i32* %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%15 = load i32, i32* @stdin
%16 = call i32 @fgets(i8* %14, i32 1000, i32 %15)
%17 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%18 = call i32 @strlen(i8* %17)
%19 = sub nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 %20
store i8 0, i8* %21
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
br label %23
23: ; preds = %71, %0
%24 = load i32, i32* %3
%25 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%26 = call i32 @strlen(i8* %25)
%27 = icmp slt i32 %24, %26
br i1 %27, label %28, label %74
28: ; preds = %23
%29 = load i32, i32* %3
br label %30
30: ; preds = %50, %28
%31 = load i32, i32* %3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp ne i32 %35, 44
br i1 %36, label %37, label %42
37: ; preds = %30
%38 = load i32, i32* %3
%39 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%40 = call i32 @strlen(i8* %39)
%41 = icmp slt i32 %38, %40
br label %42
42: ; preds = %37, %30
%43 = phi i1 [ false, %30 ], [ %41, %37 ]
br i1 %43, label %44, label %53
44: ; preds = %42
%45 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%46 = load i32, i32* %3
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 %47
%49 = call i32 @strncat(i8* %45, i8* %48, i32 1)
br label %50
50: ; preds = %44
%51 = load i32, i32* %3
%52 = add nsw i32 %51, 1
store i32 %52, i32* %3
br label %30
53: ; preds = %42
%54 = load %struct.node15*, %struct.node15** %6
%55 = icmp eq %struct.node15* %54, null
br i1 %55, label %56, label %63
56: ; preds = %53
%57 = load %struct.node15*, %struct.node15** %6
%58 = load %struct.node15*, %struct.node15** %7
%59 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%60 = call %struct.node15* @create_list15(%struct.node15* %57, %struct.node15* %58, i8* %59)
store %struct.node15* %60, %struct.node15** %6
%61 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%62 = call i32 @memset(i8* %61, i32 0, i32 1000)
br label %70
63: ; preds = %53
%64 = load %struct.node15*, %struct.node15** %6
%65 = load %struct.node15*, %struct.node15** %7
%66 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%67 = call %struct.node15* @add_num15(%struct.node15* %64, %struct.node15* %65, i8* %66)
store %struct.node15* %67, %struct.node15** %6
%68 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%69 = call i32 @memset(i8* %68, i32 0, i32 1000)
br label %70
70: ; preds = %63, %56
br label %71
71: ; preds = %70
%72 = load i32, i32* %3
%73 = add nsw i32 %72, 1
store i32 %73, i32* %3
br label %23
74: ; preds = %23
br label %75
75: ; preds = %78, %74
%76 = load %struct.node15*, %struct.node15** %6
%77 = icmp ne %struct.node15* %76, null
br i1 %77, label %78, label %83
78: ; preds = %75
%79 = load %struct.node15*, %struct.node15** %6
store %struct.node15* %79, %struct.node15** %7
%80 = load %struct.node15*, %struct.node15** %6
%81 = load %struct.node15*, %struct.node15** %7
%82 = call %struct.node15* @getLowest15(%struct.node15* %80, %struct.node15* %81)
store %struct.node15* %82, %struct.node15** %6
br label %75
83: ; preds = %75
%84 = load i32, i32* %1
ret i32 %84
}

LLVM IR (-O2):
%struct.node15 = type { i32 }
@.str = [10 x i8] c"Input n: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [42 x i8] c"Input %d numbers (separated by a comma): \00"
@stdin = global i32 0
@.str.3 = [16 x i8] c"The output is: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i8]
%3 = alloca [1000 x i8]
%4 = bitcast i32* %1 to i8*
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = call i32 (...) @getchar()
%10 = load i32, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = load i32, i32* @stdin
%13 = call i32 @fgets(i8* %5, i32 1000, i32 %12)
%14 = call i32 @strlen(i8* %5)
%15 = add nsw i32 %14, -1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %16
store i8 0, i8* %17
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 @strlen(i8* %5)
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %62
21: ; preds = %0, %52
%22 = phi %struct.node15* [ %53, %52 ], [ null, %0 ]
%23 = phi i32 [ %55, %52 ], [ 0, %0 ]
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 44
br i1 %27, label %45, label %30
28: ; preds = %52
%29 = icmp eq %struct.node15* %53, null
br i1 %29, label %62, label %58
30: ; preds = %21, %36
%31 = phi i64 [ %38, %36 ], [ %24, %21 ]
%32 = phi i8* [ %39, %36 ], [ %25, %21 ]
%33 = call i32 @strlen(i8* %5)
%34 = sext i32 %33 to i64
%35 = icmp slt i64 %31, %34
br i1 %35, label %36, label %42
36: ; preds = %30
%37 = call i32 @strncat(i8* %6, i8* %32, i32 1)
%38 = add nsw i64 %31, 1
%39 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = icmp eq i8 %40, 44
br i1 %41, label %42, label %30
42: ; preds = %36, %30
%43 = phi i64 [ %31, %30 ], [ %38, %36 ]
%44 = trunc i64 %43 to i32
br label %45
45: ; preds = %42, %21
%46 = phi i32 [ %23, %21 ], [ %44, %42 ]
%47 = icmp eq %struct.node15* %22, null
br i1 %47, label %48, label %50
48: ; preds = %45
%49 = call %struct.node15* @create_list15(%struct.node15* null, %struct.node15* undef, i8* %6)
br label %52
50: ; preds = %45
%51 = call %struct.node15* @add_num15(%struct.node15* %22, %struct.node15* undef, i8* %6)
br label %52
52: ; preds = %48, %50
%53 = phi %struct.node15* [ %49, %48 ], [ %51, %50 ]
%54 = call i32 @memset(i8* %6, i32 0, i32 1000)
%55 = add nsw i32 %46, 1
%56 = call i32 @strlen(i8* %5)
%57 = icmp slt i32 %55, %56
br i1 %57, label %21, label %28
58: ; preds = %28, %58
%59 = phi %struct.node15* [ %60, %58 ], [ %53, %28 ]
%60 = call %struct.node15* @getLowest15(%struct.node15* %59, %struct.node15* %59)
%61 = icmp eq %struct.node15* %60, null
br i1 %61, label %62, label %58
62: ; preds = %58, %0, %28
ret i32 0
}