#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, int *);
scalar_t__ powi(int, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
int main(int argc, char *argv[]) {
  FILE *fp;
  int n;
  if (argc != 2) {
    printf("Usage: %s [FILE]\n", argv[0]);
    return 1;
  }
  fp = fopen(*++argv, "r");
  while (fscanf(fp, "%d;", &n) != EOF) {
    int a, e = 0, s = 0;
    for (a = n; a; a /= 10)
      e++;
    for (a = n; a; a /= 10)
      s += powi(a % 10, e);
    puts(n == s ? "True" : "False");
  }
  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)
je     118f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe82(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1280 <main+0x130>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xe69(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe57(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1050 <fscanf@plt>
mov    0x2e1b(%rip),%rcx
cmp    (%rcx),%rax
je     1279 <main+0x129>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1210 <main+0xc0>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
jmp    11ea <main+0x9a>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1255 <main+0x105>
mov    -0x20(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
mov    -0x24(%rbp),%esi
call   1060 <powi@plt>
mov    %rax,%rcx
movslq -0x28(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
jmp    1216 <main+0xc6>
mov    -0x1c(%rbp),%ecx
mov    -0x28(%rbp),%edx
lea    0xdbb(%rip),%rdi
lea    0xdaf(%rip),%rax
cmp    %edx,%ecx
cmove  %rax,%rdi
call   1030 <puts@plt>
jmp    11b2 <main+0x62>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    1288 <main+0x138>
mov    0x8(%rsi),%rdi
lea    0xea3(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r15
lea    0xe96(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rax,%rdi
call   1050 <fscanf@plt>
mov    0x2e56(%rip),%rbp
xor    %r12d,%r12d
jmp    11d3 <main+0x83>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
xor    %r14d,%r14d
cmp    %r14d,%eax
lea    0xe6e(%rip),%rdi
lea    0xe62(%rip),%rax
cmove  %rax,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
lea    0xe4b(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1050 <fscanf@plt>
cmp    0x0(%rbp),%rax
je     129d <main+0x14d>
mov    0x4(%rsp),%r13d
xor    %r12d,%r12d
mov    $0x0,%eax
mov    $0x0,%r14d
test   %r13d,%r13d
je     11a5 <main+0x55>
xor    %ebx,%ebx
mov    %r13d,%eax
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
movslq %eax,%rcx
imul   $0x66666667,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
add    $0x9,%ecx
cmp    $0x13,%ecx
jae    1200 <main+0xb0>
test   %r13d,%r13d
je     11a0 <main+0x50>
mov    %r15,%r12
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movslq %r13d,%r15
imul   $0x66666667,%r15,%r13
mov    %r13,%rax
shr    $0x3f,%rax
sar    $0x22,%r13
add    %eax,%r13d
lea    0x0(%r13,%r13,1),%eax
lea    (%rax,%rax,4),%eax
mov    %r15d,%edi
sub    %eax,%edi
mov    %ebx,%esi
call   1060 <powi@plt>
add    %eax,%r14d
add    $0x9,%r15d
cmp    $0x12,%r15d
ja     1240 <main+0xf0>
mov    0x4(%rsp),%eax
mov    %r12,%r15
xor    %r12d,%r12d
jmp    11a5 <main+0x55>
mov    (%rsi),%rsi
lea    0xd6e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%r12d
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%d;\00"
@EOF = global i64 0
@.str.3 = [5 x i8] c"True\00"
@.str.4 = [6 x i8] c"False\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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 2
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 1, i32* %3
br label %64
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i32 1
store i8** %20, i8*** %5
%21 = load i8*, i8** %20
%22 = call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %22, i32** %6
br label %23
23: ; preds = %56, %18
%24 = load i32*, i32** %6
%25 = call i64 @fscanf(i32* %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%26 = load i64, i64* @EOF
%27 = icmp ne i64 %25, %26
br i1 %27, label %28, label %63
28: ; preds = %23
store i32 0, i32* %9
store i32 0, i32* %10
%29 = load i32, i32* %7
store i32 %29, i32* %8
br label %30
30: ; preds = %36, %28
%31 = load i32, i32* %8
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %39
33: ; preds = %30
%34 = load i32, i32* %9
%35 = add nsw i32 %34, 1
store i32 %35, i32* %9
br label %36
36: ; preds = %33
%37 = load i32, i32* %8
%38 = sdiv i32 %37, 10
store i32 %38, i32* %8
br label %30
39: ; preds = %30
%40 = load i32, i32* %7
store i32 %40, i32* %8
br label %41
41: ; preds = %53, %39
%42 = load i32, i32* %8
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %56
44: ; preds = %41
%45 = load i32, i32* %8
%46 = srem i32 %45, 10
%47 = load i32, i32* %9
%48 = call i64 @powi(i32 %46, i32 %47)
%49 = load i32, i32* %10
%50 = sext i32 %49 to i64
%51 = add nsw i64 %50, %48
%52 = trunc i64 %51 to i32
store i32 %52, i32* %10
br label %53
53: ; preds = %44
%54 = load i32, i32* %8
%55 = sdiv i32 %54, 10
store i32 %55, i32* %8
br label %41
56: ; preds = %41
%57 = load i32, i32* %7
%58 = load i32, i32* %10
%59 = icmp eq i32 %57, %58
%60 = zext i1 %59 to i64
%61 = select i1 %59, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0)
%62 = call i32 @puts(i8* %61)
br label %23
63: ; preds = %23
store i32 0, i32* %3
br label %64
64: ; preds = %63, %13
%65 = load i32, i32* %3
ret i32 %65
}

LLVM IR (-O2):
@.str = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%d;\00"
@EOF = global i64 0
@.str.3 = [5 x i8] c"True\00"
@.str.4 = [6 x i8] c"False\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp eq i32 %0, 2
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %48
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = call i64 @fscanf(i32* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%14 = load i64, i64* @EOF
%15 = icmp eq i64 %13, %14
br i1 %15, label %48, label %16
16: ; preds = %9, %39
%17 = load i32, i32* %3
%18 = icmp eq i32 %17, 0
br i1 %18, label %39, label %20
19: ; preds = %20
br i1 %18, label %39, label %27
20: ; preds = %16, %20
%21 = phi i32 [ %23, %20 ], [ 0, %16 ]
%22 = phi i32 [ %24, %20 ], [ %17, %16 ]
%23 = add nuw nsw i32 %21, 1
%24 = sdiv i32 %22, 10
%25 = add i32 %22, 9
%26 = icmp ult i32 %25, 19
br i1 %26, label %19, label %20
27: ; preds = %19, %27
%28 = phi i32 [ %33, %27 ], [ 0, %19 ]
%29 = phi i32 [ %34, %27 ], [ %17, %19 ]
%30 = srem i32 %29, 10
%31 = call i64 @powi(i32 %30, i32 %23)
%32 = trunc i64 %31 to i32
%33 = add i32 %28, %32
%34 = sdiv i32 %29, 10
%35 = add i32 %29, 9
%36 = icmp ult i32 %35, 19
br i1 %36, label %37, label %27
37: ; preds = %27
%38 = load i32, i32* %3
br label %39
39: ; preds = %16, %37, %19
%40 = phi i32 [ 0, %19 ], [ %38, %37 ], [ 0, %16 ]
%41 = phi i32 [ 0, %19 ], [ %33, %37 ], [ 0, %16 ]
%42 = icmp eq i32 %40, %41
%43 = select i1 %42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0)
%44 = call i32 @puts(i8* dereferenceable(1) %43)
%45 = call i64 @fscanf(i32* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%46 = load i64, i64* @EOF
%47 = icmp eq i64 %45, %46
br i1 %47, label %48, label %16
48: ; preds = %39, %9, %6
%49 = phi i32 [ 1, %6 ], [ 0, %9 ], [ 0, %39 ]
ret i32 %49
}