#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);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
scalar_t__ gets(char *);
int /*<<< orphan*/ printf(char *, unsigned int, unsigned int, unsigned int);
int sscanf(char *, char *, unsigned int *, unsigned int *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  char line[256];
  unsigned l, r, x;
  int lno = 0;
  while (gets(line)) {
    lno++;
    if (sscanf(line, "%x %x", &l, &r) != 2) {
      fprintf(stderr, "%s:  parse error at line %d.\n", argv[0], lno);
      exit(1);
    }
    x = l ^ r;
    printf("0x%08x ^ 0x%08x = 0x%08x\n", l, r, x);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x120(%rbp)
lea    -0x110(%rbp),%rdi
call   1050 <gets@plt>
cmp    $0x0,%rax
je     1223 <main+0xd3>
mov    -0x120(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x120(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xe5a(%rip),%rsi
lea    -0x114(%rbp),%rdx
lea    -0x118(%rbp),%rcx
call   1060 <sscanf@plt>
cmp    $0x2,%eax
je     11ee <main+0x9e>
mov    0x2e17(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x120(%rbp),%ecx
lea    0xe27(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x114(%rbp),%eax
xor    -0x118(%rbp),%eax
mov    %eax,-0x11c(%rbp)
mov    -0x114(%rbp),%esi
mov    -0x118(%rbp),%edx
mov    -0x11c(%rbp),%ecx
lea    0xe0b(%rip),%rdi
call   1030 <printf@plt>
jmp    1173 <main+0x23>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %rsi,0x8(%rsp)
lea    0x10(%rsp),%rdi
call   1050 <gets@plt>
test   %rax,%rax
je     11d9 <main+0x89>
mov    $0x1,%ebp
lea    0xe7f(%rip),%r15
lea    0x10(%rsp),%rbx
lea    0x4(%rsp),%r12
mov    %rsp,%r13
lea    0xe8f(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
call   1060 <sscanf@plt>
cmp    $0x2,%eax
jne    11ed <main+0x9d>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
mov    %edx,%ecx
xor    %esi,%ecx
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1050 <gets@plt>
add    $0x1,%ebp
test   %rax,%rax
jne    11a0 <main+0x50>
xor    %eax,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
lea    0xe01(%rip),%rsi
mov    %ebp,%ecx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%x %x\00"
@stderr = global i32 0
@.str.1 = [30 x i8] c"%s: parse error at line %d.\0A\00"
@.str.2 = [26 x i8] c"0x%08x ^ 0x%08x = 0x%08x\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %10
br label %11
11: ; preds = %29, %2
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%13 = call i64 @gets(i8* %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %37
15: ; preds = %11
%16 = load i32, i32* %10
%17 = add nsw i32 %16, 1
store i32 %17, i32* %10
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%19 = call i32 @sscanf(i8* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %7, i32* %8)
%20 = icmp ne i32 %19, 2
br i1 %20, label %21, label %29
21: ; preds = %15
%22 = load i32, i32* @stderr
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = load i32, i32* %10
%27 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %25, i32 %26)
%28 = call i32 @exit(i32 1)
unreachable
29: ; preds = %15
%30 = load i32, i32* %7
%31 = load i32, i32* %8
%32 = xor i32 %30, %31
store i32 %32, i32* %9
%33 = load i32, i32* %7
%34 = load i32, i32* %8
%35 = load i32, i32* %9
%36 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %33, i32 %34, i32 %35)
br label %11
37: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%x %x\00"
@stderr = global i32 0
@.str.1 = [30 x i8] c"%s: parse error at line %d.\0A\00"
@.str.2 = [26 x i8] c"0x%08x ^ 0x%08x = 0x%08x\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = call i64 @gets(i8* %6)
%10 = icmp eq i64 %9, 0
br i1 %10, label %28, label %11
11: ; preds = %2, %21
%12 = phi i32 [ %13, %21 ], [ 0, %2 ]
%13 = add nuw nsw i32 %12, 1
%14 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %5)
%15 = icmp eq i32 %14, 2
br i1 %15, label %21, label %16
16: ; preds = %11
%17 = load i32, i32* @stderr
%18 = load i8*, i8** %1
%19 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %18, i32 %13)
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %11
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = xor i32 %23, %22
%25 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32 %23, i32 %24)
%26 = call i64 @gets(i8* %6)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %11
28: ; preds = %21, %2
ret i32 0
}