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

/* Variables and functions */
int /*<<< orphan*/ list_push(int, struct list **);
struct list *list_constructor_dup(int n, int d) {
  struct list *head = NULL;
  int i, j;
  for (i = 0; i < n; i++) {
    for (j = 0; j < d; j++) {
      list_push(i, &head);
    }
  }
  return head;
}


x86 assembly (clang, -O0):
<list_constructor_dup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1179 <list_constructor_dup+0x69>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1166 <list_constructor_dup+0x56>
mov    -0x14(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1030 <list_push@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1140 <list_constructor_dup+0x30>
jmp    116b <list_constructor_dup+0x5b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <list_constructor_dup+0x1d>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_constructor_dup>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
xor    %ebx,%ebx
test   %edi,%edi
jle    1166 <list_constructor_dup+0x56>
mov    %esi,%r15d
mov    %edi,%r14d
lea    0x8(%rsp),%r12
jmp    1148 <list_constructor_dup+0x38>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    %r14d,%ebx
je     1161 <list_constructor_dup+0x51>
test   %r15d,%r15d
jle    1140 <list_constructor_dup+0x30>
mov    %r15d,%ebp
mov    %ebx,%edi
mov    %r12,%rsi
call   1030 <list_push@plt>
add    $0xffffffff,%ebp
jne    1150 <list_constructor_dup+0x40>
jmp    1140 <list_constructor_dup+0x30>
mov    0x8(%rsp),%rbx
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.list = type { i32 }
define %struct.list* @list_constructor_dup(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.list*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store %struct.list* null, %struct.list** %5
store i32 0, i32* %6
br label %8
8: ; preds = %24, %2
%9 = load i32, i32* %6
%10 = load i32, i32* %3
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %27
12: ; preds = %8
store i32 0, i32* %7
br label %13
13: ; preds = %20, %12
%14 = load i32, i32* %7
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %23
17: ; preds = %13
%18 = load i32, i32* %6
%19 = call i32 @list_push(i32 %18, %struct.list** %5)
br label %20
20: ; preds = %17
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
store i32 %22, i32* %7
br label %13
23: ; preds = %13
br label %24
24: ; preds = %23
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %8
27: ; preds = %8
%28 = load %struct.list*, %struct.list** %5
ret %struct.list* %28
}

LLVM IR (-O2):
%struct.list = type { i32 }
define %struct.list* @list_constructor_dup(i32 %0, i32 %1) {
%3 = alloca %struct.list*
%4 = bitcast %struct.list** %3 to i8*
store %struct.list* null, %struct.list** %3
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %20
6: ; preds = %2
%7 = icmp sgt i32 %1, 0
br label %8
8: ; preds = %6, %15
%9 = phi i32 [ 0, %6 ], [ %16, %15 ]
br i1 %7, label %10, label %15
10: ; preds = %8, %10
%11 = phi i32 [ %13, %10 ], [ 0, %8 ]
%12 = call i32 @list_push(i32 %9, %struct.list** %3)
%13 = add nuw nsw i32 %11, 1
%14 = icmp eq i32 %13, %1
br i1 %14, label %15, label %10
15: ; preds = %10, %8
%16 = add nuw nsw i32 %9, 1
%17 = icmp eq i32 %16, %0
br i1 %17, label %18, label %8
18: ; preds = %15
%19 = load %struct.list*, %struct.list** %3
br label %20
20: ; preds = %18, %2
%21 = phi %struct.list* [ %19, %18 ], [ null, %2 ]
ret %struct.list* %21
}