#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 */

/* Variables and functions */
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main_unfinished() {
  int memory[100000];
  int head, listSize, k;
  scanf("%d %d %d", &head, &listSize, &k);
  int *address, *next;
  address = (int *)malloc(sizeof(int) * listSize);
  next = (int *)malloc(sizeof(int) * listSize);
  for (int i = 0; i < listSize; i++) {
    int data;
    scanf("%d %d %d", &address[i], &data, &next[i]);
    memory[address[i]] = data;
  }
  free(address);
  free(next);
  return 0;
}


x86 assembly (clang, -O0):
<main_unfinished>:
push   %rbp
mov    %rsp,%rbp
sub    $0x61ab0,%rsp
lea    0xebe(%rip),%rdi
lea    -0x61a84(%rbp),%rsi
lea    -0x61a88(%rbp),%rdx
lea    -0x61a8c(%rbp),%rcx
call   1050 <scanf@plt>
movslq -0x61a88(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x61a98(%rbp)
movslq -0x61a88(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x61aa0(%rbp)
movl   $0x0,-0x61aa4(%rbp)
mov    -0x61aa4(%rbp),%eax
cmp    -0x61a88(%rbp),%eax
jge    121a <main_unfinished+0xea>
mov    -0x61a98(%rbp),%rsi
movslq -0x61aa4(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
mov    -0x61aa0(%rbp),%rcx
movslq -0x61aa4(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rcx
lea    0xe25(%rip),%rdi
lea    -0x61aa8(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x61aa8(%rbp),%ecx
mov    -0x61a98(%rbp),%rax
movslq -0x61aa4(%rbp),%rdx
movslq (%rax,%rdx,4),%rax
mov    %ecx,-0x61a80(%rbp,%rax,4)
mov    -0x61aa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x61aa4(%rbp)
jmp    1198 <main_unfinished+0x68>
mov    -0x61a98(%rbp),%rdi
call   1030 <free@plt>
mov    -0x61aa0(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x61ab0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main_unfinished>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xebb(%rip),%rdi
lea    0x24(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x20(%rsp),%rcx
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
shl    $0x2,%edi
call   1040 <malloc@plt>
mov    %rax,0x10(%rsp)
mov    0xc(%rsp),%edi
shl    $0x2,%edi
call   1040 <malloc@plt>
mov    %rax,%r15
cmpl   $0x0,0xc(%rsp)
jle    11c7 <main_unfinished+0x97>
xor    %r14d,%r14d
lea    0xe76(%rip),%r12
lea    0x1c(%rsp),%r13
mov    0x10(%rsp),%rbx
mov    %r15,%rbp
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %rbp,%rcx
call   1050 <scanf@plt>
add    $0x1,%r14
movslq 0xc(%rsp),%rax
add    $0x4,%rbp
add    $0x4,%rbx
cmp    %rax,%r14
jl     11a0 <main_unfinished+0x70>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d %d %d\00"
define i32 @main_unfinished() {
%1 = alloca [100000 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = mul i64 4, %11
%13 = trunc i64 %12 to i32
%14 = call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to i32*
store i32* %15, i32** %5
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = mul i64 4, %17
%19 = trunc i64 %18 to i32
%20 = call i64 @malloc(i32 %19)
%21 = inttoptr i64 %20 to i32*
store i32* %21, i32** %6
store i32 0, i32* %7
br label %22
22: ; preds = %44, %0
%23 = load i32, i32* %7
%24 = load i32, i32* %3
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %47
26: ; preds = %22
%27 = load i32*, i32** %5
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
%31 = load i32*, i32** %6
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %31, i64 %33
%35 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %30, i32* %8, i32* %34)
%36 = load i32, i32* %8
%37 = load i32*, i32** %5
%38 = load i32, i32* %7
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %37, i64 %39
%41 = load i32, i32* %40
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [100000 x i32], [100000 x i32]* %1, i64 0, i64 %42
store i32 %36, i32* %43
br label %44
44: ; preds = %26
%45 = load i32, i32* %7
%46 = add nsw i32 %45, 1
store i32 %46, i32* %7
br label %22
47: ; preds = %22
%48 = load i32*, i32** %5
%49 = call i32 @free(i32* %48)
%50 = load i32*, i32** %6
%51 = call i32 @free(i32* %50)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d %d %d\00"
define i32 @main_unfinished() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %2
%10 = shl i32 %9, 2
%11 = call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to i32*
%13 = load i32, i32* %2
%14 = shl i32 %13, 2
%15 = call i64 @malloc(i32 %14)
%16 = inttoptr i64 %15 to i32*
%17 = load i32, i32* %2
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %0
%20 = bitcast i32* %4 to i8*
br label %24
21: ; preds = %24, %0
%22 = call i32 @free(i32* %12)
%23 = call i32 @free(i32* %16)
ret i32 0
24: ; preds = %19, %24
%25 = phi i64 [ 0, %19 ], [ %29, %24 ]
%26 = getelementptr inbounds i32, i32* %12, i64 %25
%27 = getelementptr inbounds i32, i32* %16, i64 %25
%28 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %26, i32* %4, i32* %27)
%29 = add nuw nsw i64 %25, 1
%30 = load i32, i32* %2
%31 = sext i32 %30 to i64
%32 = icmp slt i64 %29, %31
br i1 %32, label %24, label %21
}