#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 *);
int /*<<< orphan*/ printf(char *, int);
int rotate(unsigned int, unsigned int);
int /*<<< orphan*/ stderr;
unsigned int strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char **argv) {
  if (argc != 3) {
    fprintf(stderr, "arguments: x, n in hex\n");
    exit(-21432);
  }
  unsigned int x = strtol(argv[1], NULL, 16);
  unsigned int n = strtol(argv[2], NULL, 16);
  printf("%x\n", rotate(x, n));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x4(%rbp)
je     1188 <main+0x38>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
lea    0xe87(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffac48,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1050 <strtol@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1050 <strtol@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1060 <rotate@plt>
mov    %eax,%esi
lea    0xe4a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    119d <main+0x4d>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1050 <strtol@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1050 <strtol@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1060 <rotate@plt>
lea    0xe8b(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x2e3c(%rip),%rax
mov    (%rax),%edi
lea    0xe53(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffac48,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"arguments: x, n in hex\0A\00"
@.str.1 = [4 x i8] c"%x\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 3
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 -21432)
unreachable
13: ; preds = %2
%14 = load i8**, i8*** %4
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strtol(i8* %16, i32* null, i32 16)
store i32 %17, i32* %5
%18 = load i8**, i8*** %4
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i32 @strtol(i8* %20, i32* null, i32 16)
store i32 %21, i32* %6
%22 = load i32, i32* %5
%23 = load i32, i32* %6
%24 = call i32 @rotate(i32 %22, i32 %23)
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"arguments: x, n in hex\0A\00"
@.str.1 = [4 x i8] c"%x\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -21432)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @strtol(i8* nocapture %10, i32* null, i32 16)
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @strtol(i8* nocapture %13, i32* null, i32 16)
%15 = tail call i32 @rotate(i32 %11, i32 %14)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
ret i32 0
}