#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 getchar();
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
void edit(char **db) {
  getchar();
  int pos;
  while (getchar() != 10)
    ;
  printf("Enter postion to edit");
  scanf("%d", &pos);
  puts("Edit the name ");
  while (getchar() != 10)
    ;
  gets(db[pos]);
  printf("Edited at postion: %d with %s\n", pos, db[pos]);
}


x86 assembly (clang, -O0):
<edit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
cmp    $0xa,%eax
je     1178 <edit+0x28>
jmp    1163 <edit+0x13>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe89(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <scanf@plt>
lea    0xe7c(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
cmp    $0xa,%eax
je     11b7 <edit+0x67>
jmp    11a2 <edit+0x52>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <gets@plt>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<edit>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <getchar@plt>
nop
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%eax
jne    1160 <edit+0x10>
lea    0xe8d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe95(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
lea    0xe87(%rip),%rdi
call   1030 <puts@plt>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%eax
jne    11a0 <edit+0x50>
movslq 0xc(%rsp),%rax
mov    (%rbx,%rax,8),%rdi
call   1060 <gets@plt>
movslq 0xc(%rsp),%rsi
mov    (%rbx,%rsi,8),%rdx
lea    0xe5e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Enter postion to edit\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"Edit the name \00"
@.str.3 = [31 x i8] c"Edited at postion: %d with %s\0A\00"
define void @edit(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
store i8** %0, i8*** %2
%4 = call i32 (...) @getchar()
br label %5
5: ; preds = %8, %1
%6 = call i32 (...) @getchar()
%7 = icmp ne i32 %6, 10
br i1 %7, label %8, label %9
8: ; preds = %5
br label %5
9: ; preds = %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %13
13: ; preds = %16, %9
%14 = call i32 (...) @getchar()
%15 = icmp ne i32 %14, 10
br i1 %15, label %16, label %17
16: ; preds = %13
br label %13
17: ; preds = %13
%18 = load i8**, i8*** %2
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 @gets(i8* %22)
%24 = load i32, i32* %3
%25 = load i8**, i8*** %2
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %25, i64 %27
%29 = load i8*, i8** %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %24, i8* %29)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"Enter postion to edit\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"Edit the name \00"
@.str.3 = [31 x i8] c"Edited at postion: %d with %s\0A\00"
define void @edit(i8** nocapture %0) {
%2 = alloca i32
%3 = tail call i32 (...) @getchar()
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %5, %1
%6 = tail call i32 (...) @getchar()
%7 = icmp eq i32 %6, 10
br i1 %7, label %8, label %5
8: ; preds = %5
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 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 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %12, %8
%13 = call i32 (...) @getchar()
%14 = icmp eq i32 %13, 10
br i1 %14, label %15, label %12
15: ; preds = %12
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %0, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 @gets(i8* %19)
%21 = load i32, i32* %2
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %0, i64 %22
%24 = load i8*, i8** %23
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %21, i8* %24)
ret void
}