#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 atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int pow_modn(int, int, int);
int /*<<< orphan*/ printf(char *, int, int, int);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int exp, prime, gen, receive, send, shared;
  if (argc < 2)
    exit(1);
  exp = atoi(argv[1]);
  scanf("%d %d %d", &prime, &gen, &receive);
  send = pow_modn(gen, exp, prime);
  printf("%d %d %d", prime, gen, send);
  shared = pow_modn(receive, exp, prime);
  fprintf(stderr, "%d\n", shared);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    118a <main+0x2a>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x14(%rbp)
lea    0xe5f(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1060 <scanf@plt>
mov    -0x1c(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1050 <pow_modn@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x24(%rbp),%ecx
lea    0xe2d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1050 <pow_modn@plt>
mov    %eax,-0x28(%rbp)
mov    0x2df0(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%edx
lea    0xe0d(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
cmp    $0x1,%edi
jle    11e6 <main+0x86>
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebx
lea    0xe82(%rip),%r14
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x14(%rsp),%rcx
mov    %r14,%rdi
call   1060 <scanf@plt>
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%edx
mov    %ebx,%esi
call   1050 <pow_modn@plt>
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%edx
mov    %r14,%rdi
mov    %eax,%ecx
call   1030 <printf@plt>
mov    0x14(%rsp),%edi
mov    0xc(%rsp),%edx
mov    %ebx,%esi
call   1050 <pow_modn@plt>
mov    0x2e14(%rip),%rcx
mov    (%rcx),%edi
lea    0xe34(%rip),%rsi
mov    %eax,%edx
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret
mov    $0x1,%edi
call   1080 <exit@plt>

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

LLVM IR (-O2):
@.str = [9 x i8] c"%d %d %d\00"
@stderr = global i32 0
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = icmp slt i32 %0, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32 @atoi(i8* %14)
%16 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4, i32* %5)
%17 = load i32, i32* %4
%18 = load i32, i32* %3
%19 = call i32 @pow_modn(i32 %17, i32 %15, i32 %18)
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %21, i32 %19)
%23 = load i32, i32* %5
%24 = load i32, i32* %3
%25 = call i32 @pow_modn(i32 %23, i32 %15, i32 %24)
%26 = load i32, i32* @stderr
%27 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %25)
ret i32 0
}