#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 /*<<< orphan*/ sscanf(char *, char *, unsigned short *, unsigned char *);
int main(int argc, char *argv[]) {
  unsigned short addr = 0x0;
  unsigned char val = 0x0;
  printf("hello world, this is my first github project!\n");
  sscanf("0x0B24, 0xC0", "0x%hx, 0x%hhx", &addr, &val);
  printf("addr = 0x%04x, val = 0x%02x\n", addr, val);
  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)
movb   $0x0,-0x13(%rbp)
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    0xee0(%rip),%rsi
lea    -0x12(%rbp),%rdx
lea    -0x13(%rbp),%rcx
call   1040 <sscanf@plt>
movzwl -0x12(%rbp),%esi
movzbl -0x13(%rbp),%edx
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movw   $0x0,0x6(%rsp)
movb   $0x0,0x5(%rsp)
lea    0xef4(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb0(%rip),%rdi
lea    0xeb6(%rip),%rsi
lea    0x6(%rsp),%rdx
lea    0x5(%rsp),%rcx
call   1050 <sscanf@plt>
movzwl 0x6(%rsp),%esi
movzbl 0x5(%rsp),%edx
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"hello world, this is my first github project!\0A\00"
@.str.1 = [13 x i8] c"0x0B24, 0xC0\00"
@.str.2 = [14 x i8] c"0x%hx, 0x%hhx\00"
@.str.3 = [29 x i8] c"addr = 0x%04x, val = 0x%02x\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i16
%7 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i16 0, i16* %6
store i8 0, i8* %7
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @sscanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i16* %6, i8* %7)
%10 = load i16, i16* %6
%11 = zext i16 %10 to i32
%12 = load i8, i8* %7
%13 = zext i8 %12 to i32
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %11, i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [13 x i8] c"0x0B24, 0xC0\00"
@.str.2 = [14 x i8] c"0x%hx, 0x%hhx\00"
@.str.3 = [29 x i8] c"addr = 0x%04x, val = 0x%02x\0A\00"
@str = [46 x i8] c"hello world, this is my first github project!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i16
%4 = alloca i8
%5 = bitcast i16* %3 to i8*
store i16 0, i16* %3
store i8 0, i8* %4
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
%7 = call i32 @sscanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i16* %3, i8* %4)
%8 = load i16, i16* %3
%9 = zext i16 %8 to i32
%10 = load i8, i8* %4
%11 = zext i8 %10 to i32
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %9, i32 %11)
ret i32 0
}