int main(int argc, char *argv[]) {
  char *c_pt;
  int sz;
  if (argc < 3) {
    printf("USAGE: %s %s %s\n", argv[0], "[str]", "[int]");
    exit(0);
  }
  sz = atoi(argv[2]);
  c_pt = (char *)chk_malloc(sz);
  strcpy(c_pt, argv[1]);
  printf("String \'%s\' at 0x%08x is of %d size in array of %d size\n", c_pt,
         c_pt, strlen(c_pt), sz);
  free(c_pt);
  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)
cmpl   $0x3,-0x8(%rbp)
jge    11ba <main+0x4a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe62(%rip),%rdi
lea    0xe6c(%rip),%rdx
lea    0xe6b(%rip),%rcx
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    $0x0,%al
call   1080 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    $0x0,%al
call   1070 <chk_malloc@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    %rax,%rcx
mov    -0x1c(%rbp),%r8d
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
jle    11d3 <main+0x63>
mov    0x10(%rbx),%rdi
xor    %eax,%eax
call   1080 <atoi@plt>
mov    %eax,%r14d
mov    %eax,%edi
xor    %eax,%eax
call   1070 <chk_malloc@plt>
movslq %eax,%rbp
mov    0x8(%rbx),%rsi
mov    %rbp,%rdi
call   1040 <strcpy@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
lea    0xe6c(%rip),%rdi
mov    %rbp,%rsi
mov    %rbp,%rdx
mov    %rax,%rcx
mov    %r14d,%r8d
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    (%rbx),%rsi
lea    0xe23(%rip),%rdi
lea    0xe2d(%rip),%rdx
lea    0xe2c(%rip),%rcx
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"USAGE: %s %s %s\0A\00"
@.str.1 = [6 x i8] c"[str]\00"
@.str.2 = [6 x i8] c"[int]\00"
@.str.3 = [57 x i8] c"String '%s' at 0x%08x is of %d size in array of %d size\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 3
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
unreachable
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 2
%18 = load i8*, i8** %17
%19 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %18)
store i32 %19, i32* %7
%20 = load i32, i32* %7
%21 = call i32 (i32, ...) bitcast (i32 (...)* @chk_malloc to i32 (i32, ...)*)(i32 %20)
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to i8*
store i8* %23, i8** %6
%24 = load i8*, i8** %6
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i8* @strcpy(i8* %24, i8* %27)
%29 = load i8*, i8** %6
%30 = load i8*, i8** %6
%31 = load i8*, i8** %6
%32 = call i64 @strlen(i8* %31)
%33 = load i32, i32* %7
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0), i8* %29, i8* %30, i64 %32, i32 %33)
%35 = load i8*, i8** %6
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"USAGE: %s %s %s\0A\00"
@.str.1 = [6 x i8] c"[str]\00"
@.str.2 = [6 x i8] c"[int]\00"
@.str.3 = [57 x i8] c"String '%s' at 0x%08x is of %d size in array of %d size\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
tail call void @exit(i32 0)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %9)
%11 = tail call i32 (i32, ...) bitcast (i32 (...)* @chk_malloc to i32 (i32, ...)*)(i32 %10)
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i8*
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i8* @strcpy(i8* dereferenceable(1) %13, i8* dereferenceable(1) %15)
%17 = tail call i64 @strlen(i8* dereferenceable(1) %13)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0), i8* %13, i8* %13, i64 %17, i32 %10)
tail call void @free(i8* %13)
ret i32 0
}