#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*/ printf(char *, ...);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
scalar_t__ strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  int i;
  char tmp[3];
  tmp[2] = '\0';
  if (argc > 1) {
    for (i = 2; i < strlen(argv[1]); i += 4) {
      strncpy(tmp, argv[1] + i, 2);
      printf("%c", (char)strtol(tmp, NULL, 16));
    }
  } else {
    printf("USAGE: printf.exe \\x41\\x42\n");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x15(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11de <main+0x9e>
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jge    11d9 <main+0x99>
lea    -0x17(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
movslq -0x14(%rbp),%rax
add    %rax,%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
lea    -0x17(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1060 <strtol@plt>
movsbl %al,%esi
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x14(%rbp)
jmp    116b <main+0x2b>
jmp    11f8 <main+0xb8>
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ff <main+0xbf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movb   $0x0,0x7(%rsp)
cmp    $0x2,%edi
jl     11c1 <main+0x71>
mov    %rsi,%r15
mov    0x8(%rsi),%rdi
call   1060 <strlen@plt>
xor    %r12d,%r12d
cmp    $0x3,%eax
jl     11d3 <main+0x83>
mov    $0x2,%ebx
lea    0x5(%rsp),%r14
mov    0x8(%r15),%rsi
add    %rbx,%rsi
mov    %r14,%rdi
mov    $0x2,%edx
call   1040 <strncpy@plt>
xor    %r12d,%r12d
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1070 <strtol@plt>
movsbl %al,%edi
call   1030 <putchar@plt>
add    $0x4,%rbx
mov    0x8(%r15),%rdi
call   1060 <strlen@plt>
cmp    %ebx,%eax
jg     1180 <main+0x30>
jmp    11d3 <main+0x83>
lea    0xe38(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%r12d
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [28 x i8] c"USAGE: printf.exe \\x41\\x42\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [3 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 2
store i8 0, i8* %8
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %37
11: ; preds = %2
store i32 2, i32* %6
br label %12
12: ; preds = %33, %11
%13 = load i32, i32* %6
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strlen(i8* %16)
%18 = icmp slt i32 %13, %17
br i1 %18, label %19, label %36
19: ; preds = %12
%20 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 0
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = call i32 @strncpy(i8* %20, i8* %26, i32 2)
%28 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 0
%29 = call i64 @strtol(i8* %28, i32* null, i32 16)
%30 = trunc i64 %29 to i8
%31 = sext i8 %30 to i32
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %19
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 4
store i32 %35, i32* %6
br label %12
36: ; preds = %12
br label %39
37: ; preds = %2
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %40
39: ; preds = %36
store i32 0, i32* %3
br label %40
40: ; preds = %39, %37
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@str = [27 x i8] c"USAGE: printf.exe \\x41\\x42\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [3 x i8]
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 2
store i8 0, i8* %5
%6 = icmp sgt i32 %0, 1
br i1 %6, label %7, label %27
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = call i32 @strlen(i8* %9)
%11 = icmp sgt i32 %10, 2
br i1 %11, label %12, label %29
12: ; preds = %7, %12
%13 = phi i64 [ %22, %12 ], [ 2, %7 ]
%14 = load i8*, i8** %8
%15 = getelementptr inbounds i8, i8* %14, i64 %13
%16 = call i32 @strncpy(i8* %4, i8* %15, i32 2)
%17 = call i64 @strtol(i8* nocapture %4, i32* null, i32 16)
%18 = trunc i64 %17 to i32
%19 = shl i32 %18, 24
%20 = ashr exact i32 %19, 24
%21 = call i32 @putchar(i32 %20)
%22 = add nuw i64 %13, 4
%23 = load i8*, i8** %8
%24 = call i32 @strlen(i8* %23)
%25 = trunc i64 %22 to i32
%26 = icmp sgt i32 %24, %25
br i1 %26, label %12, label %29
27: ; preds = %2
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %29
29: ; preds = %12, %7, %27
%30 = phi i32 [ 1, %27 ], [ 0, %7 ], [ 0, %12 ]
ret i32 %30
}