#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 strlen(char *);
int pl_Char(void *variable, int argc, char *argv[], int i, int k) {
  int length;
  if (k == 0)
    --i;
  length = strlen(argv[i]);
  *(char *)variable = argv[i][length - 1];
  return (i + 1);
}


x86 assembly (clang, -O0):
<pl_Char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    113d <pl_Char+0x2d>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pl_Char>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rdi,%r14
cmp    $0x1,%r8d
sbb    $0x0,%ecx
movslq %ecx,%rbx
mov    (%rdx,%rbx,8),%rdi
call   1030 <strlen@plt>
mov    (%r15,%rbx,8),%rcx
cltq
mov    -0x1(%rax,%rcx,1),%al
mov    %al,(%r14)
add    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @pl_Char(i8* %0, i32 %1, i8** %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8** %2, i8*** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%12 = load i32, i32* %10
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %5
%15 = load i32, i32* %9
%16 = add nsw i32 %15, -1
store i32 %16, i32* %9
br label %17
17: ; preds = %14, %5
%18 = load i8**, i8*** %8
%19 = load i32, i32* %9
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 @strlen(i8* %22)
store i32 %23, i32* %11
%24 = load i8**, i8*** %8
%25 = load i32, i32* %9
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = load i32, i32* %11
%30 = sub nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %28, i64 %31
%33 = load i8, i8* %32
%34 = load i8*, i8** %6
store i8 %33, i8* %34
%35 = load i32, i32* %9
%36 = add nsw i32 %35, 1
ret i32 %36
}

LLVM IR (-O2):
define i32 @pl_Char(i8* nocapture writeonly %0, i32 %1, i8** nocapture %2, i32 %3, i32 %4) {
%6 = icmp eq i32 %4, 0
%7 = sext i1 %6 to i32
%8 = add nsw i32 %7, %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8*, i8** %2, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32 @strlen(i8* %11)
%13 = load i8*, i8** %10
%14 = add nsw i32 %12, -1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
store i8 %17, i8* %0
%18 = add nsw i32 %8, 1
ret i32 %18
}