#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 /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ malloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main(int argc, char **argv) {
  char *p;
  char *q;
  char *r;
  char *s;
  if (argc < 3) {
    exit(0);
  }
  p = (char *)malloc(0x800);
  q = (char *)malloc(0x10);
  r = (char *)malloc(0x800);
  strcpy(r, argv[1]);
  s = (char *)malloc(0x10);
  strncpy(s, argv[2], 0xf);
  exit(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    1167 <main+0x27>
xor    %edi,%edi
call   1060 <exit@plt>
mov    $0x800,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x800,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1040 <strcpy@plt>
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    $0xf,%edx
call   1030 <strncpy@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jg     114d <main+0xd>
xor    %edi,%edi
call   1060 <exit@plt>
mov    %rsi,%rbx
mov    $0x800,%edi
call   1050 <malloc@plt>
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    $0x800,%edi
call   1050 <malloc@plt>
mov    0x8(%rbx),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    0x10(%rbx),%rsi
mov    %rax,%rdi
mov    $0xf,%edx
call   1030 <strncpy@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 3
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @exit(i32 0)
unreachable
14: ; preds = %2
%15 = call i64 @malloc(i32 2048)
%16 = inttoptr i64 %15 to i8*
store i8* %16, i8** %6
%17 = call i64 @malloc(i32 16)
%18 = inttoptr i64 %17 to i8*
store i8* %18, i8** %7
%19 = call i64 @malloc(i32 2048)
%20 = inttoptr i64 %19 to i8*
store i8* %20, i8** %8
%21 = load i8*, i8** %8
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @strcpy(i8* %21, i8* %24)
%26 = call i64 @malloc(i32 16)
%27 = inttoptr i64 %26 to i8*
store i8* %27, i8** %9
%28 = load i8*, i8** %9
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
%32 = call i32 @strncpy(i8* %28, i8* %31, i32 15)
%33 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @exit(i32 0)
unreachable
6: ; preds = %2
%7 = tail call i64 @malloc(i32 2048)
%8 = tail call i64 @malloc(i32 16)
%9 = tail call i64 @malloc(i32 2048)
%10 = inttoptr i64 %9 to i8*
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @strcpy(i8* %10, i8* %12)
%14 = tail call i64 @malloc(i32 16)
%15 = inttoptr i64 %14 to i8*
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32 @strncpy(i8* %15, i8* %17, i32 15)
%19 = tail call i32 @exit(i32 0)
unreachable
}