#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 *, short);
int /*<<< orphan*/ sscanf(char *, char *, short *);
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  short nascii = 0;
  if (argc != 2 || strncmp(argv[1], "-h", 2) == 0) {
    usage(argv[0]);
    return 1;
  }
  sscanf(argv[1], "%hi", &nascii);
  printf("%c", nascii);
  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)
movw   $0x0,-0x12(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    1189 <main+0x49>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe8b(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11a1 <main+0x61>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    11d0 <main+0x90>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe53(%rip),%rsi
lea    -0x12(%rbp),%rdx
call   1050 <sscanf@plt>
lea    0xe47(%rip),%rdi
movswl -0x12(%rbp),%esi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
movw   $0x0,0xe(%rsp)
cmp    $0x2,%edi
jne    1198 <main+0x58>
mov    0x8(%rbx),%rdi
lea    0xea1(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1198 <main+0x58>
mov    0x8(%rbx),%rdi
lea    0xe8a(%rip),%rsi
lea    0xe(%rsp),%rdx
call   1050 <sscanf@plt>
movswl 0xe(%rsp),%esi
lea    0xe78(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
jmp    11a5 <main+0x65>
mov    (%rbx),%rdi
call   1060 <usage@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
@.str.1 = [4 x i8] c"%hi\00"
@.str.2 = [3 x i8] c"%c\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i16
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i16 0, i16* %6
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %15, label %9
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i64 @strncmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %9, %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 @usage(i8* %18)
store i32 1, i32* %3
br label %27
20: ; preds = %9
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @sscanf(i8* %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i16* %6)
%25 = load i16, i16* %6
%26 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i16 signext %25)
store i32 0, i32* %3
br label %27
27: ; preds = %20, %15
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@.str.1 = [4 x i8] c"%hi\00"
@.str.2 = [3 x i8] c"%c\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i16
%4 = bitcast i16* %3 to i8*
store i16 0, i16* %3
%5 = icmp eq i32 %0, 2
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strncmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %6, %2
%12 = load i8*, i8** %1
%13 = tail call i32 @usage(i8* %12)
br label %19
14: ; preds = %6
%15 = load i8*, i8** %7
%16 = call i32 @sscanf(i8* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i16* %3)
%17 = load i16, i16* %3
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i16 signext %17)
br label %19
19: ; preds = %14, %11
%20 = phi i32 [ 1, %11 ], [ 0, %14 ]
ret i32 %20
}