#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 *, unsigned int, unsigned int, unsigned int);
int /*<<< orphan*/ sscanf(char *, char *, short *);
main(int argc, char *argv[]) {
  short n1, n2;
  unsigned op1, op2, result;
  sscanf(argv[1], "%hd", &n1);
  sscanf(argv[2], "%hd", &n2);
  op1 = *(unsigned short *)&n1;
  op2 = *(unsigned short *)&n2;
  result = op1 - op2;
  printf("%08X - %08X = %08X\n", op1, op2, result);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xec2(%rip),%rsi
lea    -0x12(%rbp),%rdx
call   1040 <sscanf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xeaa(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <sscanf@plt>
movzwl -0x12(%rbp),%eax
mov    %eax,-0x18(%rbp)
movzwl -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xece(%rip),%r14
lea    0x6(%rsp),%rdx
mov    %r14,%rsi
call   1040 <sscanf@plt>
mov    0x10(%rbx),%rdi
lea    0x4(%rsp),%rdx
mov    %r14,%rsi
call   1040 <sscanf@plt>
movzwl 0x6(%rsp),%esi
movzwl 0x4(%rsp),%edx
mov    %esi,%ecx
sub    %edx,%ecx
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%hd\00"
@.str.1 = [20 x i8] c"%08X - %08X = %08X\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i16
%6 = alloca i16
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%10 = load i8**, i8*** %4
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @sscanf(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i16* %5)
%14 = load i8**, i8*** %4
%15 = getelementptr inbounds i8*, i8** %14, i64 2
%16 = load i8*, i8** %15
%17 = call i32 @sscanf(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i16* %6)
%18 = load i16, i16* %5
%19 = zext i16 %18 to i32
store i32 %19, i32* %7
%20 = load i16, i16* %6
%21 = zext i16 %20 to i32
store i32 %21, i32* %8
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = sub i32 %22, %23
store i32 %24, i32* %9
%25 = load i32, i32* %7
%26 = load i32, i32* %8
%27 = load i32, i32* %9
%28 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %25, i32 %26, i32 %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%hd\00"
@.str.1 = [20 x i8] c"%08X - %08X = %08X\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i16
%4 = alloca i16
%5 = bitcast i16* %3 to i8*
%6 = bitcast i16* %4 to i8*
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i16* %3)
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i16* %4)
%13 = load i16, i16* %3
%14 = zext i16 %13 to i32
%15 = load i16, i16* %4
%16 = zext i16 %15 to i32
%17 = sub nsw i32 %14, %16
%18 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32 %16, i32 %17)
ret i32 0
}