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

/* Variables and functions */
int atoi(char *);
struct sl_node *construct_sl(int);
struct sl_node *del_node_pp_inprv(struct sl_node **, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ traverse_sl(struct sl_node *);
int main(int argc, char **argv) {
  int ret, i = 0, n = 9;
  struct sl_node *head = NULL;
  if (argc != 0) {
    if (argv[1] != NULL)
      n = atoi(argv[1]);
    if (argv[2] != NULL)
      i = atoi(argv[2]);
  }
  head = construct_sl(n);
  traverse_sl(head);
  head = del_node_pp_inprv(&head, i);
  printf("deleted %d\n", i);
  traverse_sl(head);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x9,-0x1c(%rbp)
movq   $0x0,-0x28(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11c9 <main+0x79>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     11a5 <main+0x55>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x10(%rax)
je     11c4 <main+0x74>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    11c9 <main+0x79>
mov    -0x1c(%rbp),%edi
call   1030 <construct_sl@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <traverse_sl@plt>
mov    -0x18(%rbp),%esi
lea    -0x28(%rbp),%rdi
call   1060 <del_node_pp_inprv@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe08(%rip),%rdi
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1050 <traverse_sl@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
test   %edi,%edi
je     1174 <main+0x24>
mov    %rsi,%rbp
mov    0x8(%rsi),%rdi
test   %rdi,%rdi
je     117c <main+0x2c>
call   1070 <atoi@plt>
mov    %eax,%r14d
jmp    1182 <main+0x32>
mov    $0x9,%r14d
jmp    1192 <main+0x42>
mov    $0x9,%r14d
mov    0x10(%rbp),%rdi
test   %rdi,%rdi
je     1192 <main+0x42>
call   1070 <atoi@plt>
mov    %eax,%ebx
mov    %r14d,%edi
call   1030 <construct_sl@plt>
mov    %rax,0x8(%rsp)
mov    %rax,%rdi
call   1050 <traverse_sl@plt>
lea    0x8(%rsp),%rdi
mov    %ebx,%esi
call   1060 <del_node_pp_inprv@plt>
mov    %rax,0x8(%rsp)
lea    0xe41(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
mov    0x8(%rsp),%rdi
call   1050 <traverse_sl@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.sl_node = type { i32 }
@.str = [12 x i8] c"deleted %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.sl_node*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 9, i32* %8
store %struct.sl_node* null, %struct.sl_node** %9
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %33
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %22
17: ; preds = %12
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %8
br label %22
22: ; preds = %17, %12
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %32
27: ; preds = %22
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 2
%30 = load i8*, i8** %29
%31 = call i32 @atoi(i8* %30)
store i32 %31, i32* %7
br label %32
32: ; preds = %27, %22
br label %33
33: ; preds = %32, %2
%34 = load i32, i32* %8
%35 = call %struct.sl_node* @construct_sl(i32 %34)
store %struct.sl_node* %35, %struct.sl_node** %9
%36 = load %struct.sl_node*, %struct.sl_node** %9
%37 = call i32 @traverse_sl(%struct.sl_node* %36)
%38 = load i32, i32* %7
%39 = call %struct.sl_node* @del_node_pp_inprv(%struct.sl_node** %9, i32 %38)
store %struct.sl_node* %39, %struct.sl_node** %9
%40 = load i32, i32* %7
%41 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %40)
%42 = load %struct.sl_node*, %struct.sl_node** %9
%43 = call i32 @traverse_sl(%struct.sl_node* %42)
ret i32 0
}

LLVM IR (-O2):
%struct.sl_node = type { i32 }
@.str = [12 x i8] c"deleted %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sl_node*
%4 = bitcast %struct.sl_node** %3 to i8*
%5 = icmp eq i32 %0, 0
br i1 %5, label %19, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = icmp eq i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = tail call i32 @atoi(i8* %8)
br label %12
12: ; preds = %10, %6
%13 = phi i32 [ %11, %10 ], [ 9, %6 ]
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = icmp eq i8* %15, null
br i1 %16, label %19, label %17
17: ; preds = %12
%18 = tail call i32 @atoi(i8* %15)
br label %19
19: ; preds = %12, %17, %2
%20 = phi i32 [ %18, %17 ], [ 0, %12 ], [ 0, %2 ]
%21 = phi i32 [ %13, %17 ], [ %13, %12 ], [ 9, %2 ]
%22 = tail call %struct.sl_node* @construct_sl(i32 %21)
store %struct.sl_node* %22, %struct.sl_node** %3
%23 = tail call i32 @traverse_sl(%struct.sl_node* %22)
%24 = call %struct.sl_node* @del_node_pp_inprv(%struct.sl_node** %3, i32 %20)
store %struct.sl_node* %24, %struct.sl_node** %3
%25 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %20)
%26 = load %struct.sl_node*, %struct.sl_node** %3
%27 = call i32 @traverse_sl(%struct.sl_node* %26)
ret i32 0
}