#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_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int gut_parse_uint(char *, unsigned int *);
int /*<<< orphan*/ printf(char *, unsigned int);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc < 2) {
    fprintf(stderr, "Usage: %s <number>\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  unsigned int val;
  int err;
  err = gut_parse_uint(argv[1], &val);
  if (err) {
    fprintf(stderr, "Error: conversion failed (%d)\n", err);
    if (err == -3) {
      fprintf(stderr, "(value returned: %u)\n", val);
    }
    exit(EXIT_FAILURE);
  }
  printf("gut_parse_uint() returned %u\n", val);
  exit(EXIT_SUCCESS);
}


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)
cmpl   $0x2,-0x8(%rbp)
jge    118c <main+0x4c>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe89(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <gut_parse_uint@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     11f6 <main+0xb6>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
lea    0xe57(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
cmpl   $0xfffffffd,-0x18(%rbp)
jne    11e8 <main+0xa8>
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xe52(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x14(%rbp),%esi
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
mov    0x2dc4(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x1,%edi
jg     1165 <main+0x25>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xea4(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    11cb <main+0x8b>
mov    0x8(%rsi),%rdi
lea    0x4(%rsp),%rsi
call   1050 <gut_parse_uint@plt>
test   %eax,%eax
jne    1195 <main+0x55>
mov    0x4(%rsp),%esi
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    %eax,%ebx
mov    0x2e42(%rip),%r14
mov    (%r14),%edi
lea    0xe6c(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
cmp    $0xfffffffd,%ebx
jne    11cb <main+0x8b>
mov    (%r14),%edi
mov    0x4(%rsp),%edx
lea    0xe6f(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"Usage: %s <number>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [31 x i8] c"Error: conversion failed (%d)\0A\00"
@.str.2 = [22 x i8] c"(value returned: %u)\0A\00"
@.str.3 = [30 x i8] c"gut_parse_uint() returned %u\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %18
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32, i32* @EXIT_FAILURE
%17 = call i32 @exit(i32 %16)
unreachable
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @gut_parse_uint(i8* %21, i32* %6)
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %38
25: ; preds = %18
%26 = load i32, i32* @stderr
%27 = load i32, i32* %7
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %7
%30 = icmp eq i32 %29, -3
br i1 %30, label %31, label %35
31: ; preds = %25
%32 = load i32, i32* @stderr
%33 = load i32, i32* %6
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %31, %25
%36 = load i32, i32* @EXIT_FAILURE
%37 = call i32 @exit(i32 %36)
unreachable
38: ; preds = %18
%39 = load i32, i32* %6
%40 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %39)
%41 = load i32, i32* @EXIT_SUCCESS
%42 = call i32 @exit(i32 %41)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"Usage: %s <number>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [31 x i8] c"Error: conversion failed (%d)\0A\00"
@.str.2 = [22 x i8] c"(value returned: %u)\0A\00"
@.str.3 = [30 x i8] c"gut_parse_uint() returned %u\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %1
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %2
%12 = bitcast i32* %3 to i8*
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @gut_parse_uint(i8* %14, i32* %3)
%16 = icmp eq i32 %15, 0
br i1 %16, label %28, label %17
17: ; preds = %11
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%20 = icmp eq i32 %15, -3
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = load i32, i32* @stderr
%23 = load i32, i32* %3
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %21, %17
%26 = load i32, i32* @EXIT_FAILURE
%27 = call i32 @exit(i32 %26)
unreachable
28: ; preds = %11
%29 = load i32, i32* %3
%30 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %29)
%31 = load i32, i32* @EXIT_SUCCESS
%32 = call i32 @exit(i32 %31)
unreachable
}